1. Python Loaded Caffe Mean.binaryproto
# # # # mean_file # # " RB " == Caffe.io.blobproto_to_array (a) [0]
2. Python Loading caffe image input
## # # Load input and configure preprocessing type 1 # # # # #im = Caffe.io.load_image ("tmp.jpg")#read it in RGB format and 0~1Transformer = Caffe.io.Transformer ({'Data': net_full_conv.blobs['Data'].data.shape})#Transformer.set_mean (' Data ', np.load (caffe_root + ' python/caffe/imagenet/ilsvrc_2012_mean.npy '). Mean (1). Mean (1))Transformer.set_transpose ('Data', (2, 0, 1))#channel width (cols) height (cows)Transformer.set_channel_swap ('Data', (2, 1, 0))#transform RGB to BGRTransformer.set_raw_scale ('Data', 255.0)#Zoom to 0~255
# # # # Load input and configure preprocessing type 2 # # # # # #Cv_im = Cv2.imread ("tmp.jpg" c5>) transformer.set_transpose ('data'#
3. Python OpenCV
# # # #python opencv#### = Img.rows = High img.shape[1] = img.cols= cv2.resize (src, newshape[1], newshape[0], interpolation = Cv2. Inter_linear) C+ +: Resize (midimage, Tmpimage, Cv::size (Ratio*midimage.cols, ratio*midimage.rows), (0, 0), (0, 0), Cv::inter_area);
4. Python matplotlib
## # #python matplotlib####ImportMatplotlib.pyplot as Plt#plt for displaying picturesImportMatplotlib.image as Mpimg#mpimg for reading picturesImportNumPy as Nplena= Mpimg.imread ('Lena.png')#Lena.png of Reading and code in the same directory#at this time Lena is already a np.array, you can handle it arbitrarilyLena.shape#(3)Plt.imshow (Lena)#Show PicturesPlt.axis ('off')#do not display axesplt.show () FIG= Plt.figure ()#New Figure 0Plt.savefig ()#SavePlt.close (' All')#close Up Figure 0
Python usage record