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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM