(轉)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