1
這樣做的確切程度如何。現在,我必須遍歷每個圖像並轉發它。我想知道我是否可以一次設定多個圖像,並通過將所有圖像設置爲一個批處理,然後運行net.forward()
一次整批轉發它們通過咖啡 - 通過網絡並行傳送多個圖像
for f in fnames:
i+=1
print i,"/",len(fnames), f
img = Image.open(f)
# scale all images to 256x256
img = img.resize((256,256), PIL.Image.ANTIALIAS)
img = numpy.array(img).astype(numpy.float32)
transformed_image = transformer.preprocess('data', img)
#print transformed_image.shape
# use CNN to predict (but don't use predicted class)
net.blobs['data'].data[...] = transformed_image
output = net.forward()
我只是試圖做that..but遺憾的是,似乎我網的尺寸固定爲10(10,3,224,224) – Raaj
@Raaj整形不能解決呢? – Shai
重塑在這裏不起作用。 3,244,244部分是指RGB圖像。 10是指N個圖像。你的意思是我以某種方式追加/修改網絡對象? – Raaj