When I try to get out of pre-prepared VGG 16/19 models using Caffe with Python (both 2.7 and 3.5), it takes more than 15 seconds in the net.forward () step (on my laptop processor).
I was wondering if anyone could advise me why this could be, like in many other models (e.g. ResNet, AlexNet), I get output per second, this is the only model I have found so far, doing this badly.
The code I use is as follows:
img = cv2.imread(path + img_name + '.jpg')
img = transform_img(img,224,224)
net = caffe.Net(model_prototxt,model_trained,caffe.TEST)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))
net.blobs['data'].data[...] = transformer.preprocess('data', img)
start = timer()
out = net.forward()
end = timer()
print('Runtime: ' + "{0:.2f}".format(end-start) + 's')
Sorry for being extremely bridal, and thanks in advance to anyone who answers.
source
share