(转)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  
版权声明:本文为博主原创文章,转载请附上博文链接!

posted @ 2018-10-19 14:46  HOU_JUN  阅读(1228)  评论(0编辑  收藏  举报