<s> '''<STR_LIT>''' <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from PIL import Image <EOL> import caffe <EOL> from nideep . iow . read_img import read_img_cv2 , read_img_PIL <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> caffe . set_mode_cpu ( ) <EOL> path_img = '<STR_LIT>' <EOL> bgr_mean = np . array ( ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> im = Image . open ( path_img ) <EOL> in_ = np . array ( im , dtype = np . float32 ) <EOL> in_ = in_ [ : , : , : : - <NUM_LIT:1> ] <EOL> print in_ . shape <EOL> print in_ <EOL> in_ -= bgr_mean <EOL> print in_ <EOL> in_ = in_ . transpose ( ( <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:1> ) ) <EOL> in_ = read_img_PIL ( path_img , mean = bgr_mean ) <EOL> print '<STR_LIT>' <EOL> print in_ [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> print in_ [ <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> print in_ [ <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> in2 = read_img_cv2 ( path_img , mean = bgr_mean ) <EOL> print in2 . shape <EOL> print in2 [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> print in2 [ <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> print in2 [ <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> print np . all ( in_ == in2 ) <EOL> print in_ [ in_ != in2 ] <EOL> print in2 [ in_ != in2 ] <EOL> return <NUM_LIT:0> <EOL> path_model = '<STR_LIT>' <EOL> path_weights = '<STR_LIT>' <EOL> net = caffe . Net ( path_model , path_weights , caffe . TEST ) <EOL> net . blobs [ '<STR_LIT:data>' ] . reshape ( <NUM_LIT:1> , * in_ . shape ) <EOL> net . blobs [ '<STR_LIT:data>' ] . data [ ... ] = in_ <EOL> pass </s>
