(转)opencv 代替caffe.io.load_image

self.net.blobs['data'].reshape(1, 3, self.image_resize, self.image_resize)

#image = caffe.io.load_image(image_file)

image = cv2.imread(image_file)

image = cv2.resize(image, (300,300))

img = np.zeros((1,3,300,300))

img[0,0,:,:] = image[:,:,0]-104.0

img[0,1,:,:] = image[:,:,1]-113.0

img[0,2,:,:] = image[:,:,2]-127.0

self.net.blobs['data'].data[...] = img 

---------------------  
作者:eclipSYcn  
来源:CSDN  
原文:https://blog.csdn.net/Eclipsesy/article/details/79109500  
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/houjun/p/9816361.html