You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YOLO expects inputs in the range [0,1] while the OpenCV img has range [0, 255]. The function caffe.io.load_image takes already care of that by calling skimage.img_as_float.
You need simply to rescale the OpenCV image by adding the following option to the transformer:
I modified yolo_main.py to work on video instead of image as follows . It doesn't however work.Is there anything else I need to change ?
net = caffe.Net(model_filename, weight_filename, caffe.TEST)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))
transformer.set_channel_swap('data', (2,1,0))
cap = cv2.VideoCapture(video_filename);
ret, img = cap.read();
while(ret):
inputs = img
out = net.forward_all(data=np.asarray([transformer.preprocess('data', inputs)]))
print out.iteritems()
img_cv = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
results = interpret_output(out['result'][0], img.shape[1], img.shape[0])
show_results(img_cv,results, img.shape[1], img.shape[0])
cv2.waitKey(10000)
ret, img = cap.read()
end = datetime.now()
The text was updated successfully, but these errors were encountered: