We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a python version for inference. I am able to run a forward pass with the following code. Output is shown.
For inference, is net.blobs('zero').set_data(zeros(width_test, height_test)); net.blobs('coord_canon').set_data(coord); needed?
path_left = 'left.jpg' path_right = 'right.jpg' MODEL_FILE = 'deploy_kitti.prototxt' PRETRAINED = 'crl.caffemodel' left_img = cv2.imread(path_left) right_img = cv2.imread(path_right) caffe.set_mode_gpu() caffe.set_device(0) net = caffe.Net(MODEL_FILE, PRETRAINED, caffe.TEST) left_img = cv2.resize(left_img, (net.blobs['img0'].data.shape[3],net.blobs['img0'].data.shape[2])) right_img = cv2.resize(right_img, (net.blobs['img1'].data.shape[3],net.blobs['img1'].data.shape[2])) left_img = left_img.astype(np.float32) left_img = left_img.transpose((2, 0, 1)) right_img = right_img.astype(np.float32) right_img = right_img.transpose((2, 0, 1)) net.blobs['img0'].data[...] = left_img net.blobs['img1'].data[...] = right_img caffe.set_mode_gpu() caffe.set_device(0) disp = net.forward() out = -disp["predict_flow2_s2"].transpose(2,3,0,1).reshape(320,1792) img = Image.fromarray(out, 'RGB') img.save('my.png') img.show()
The text was updated successfully, but these errors were encountered:
FIXED::
Sorry, something went wrong.
Hey @xjoshramos How did you fix it?
No branches or pull requests
Is there a python version for inference. I am able to run a forward pass with the following code. Output is shown.
For inference, is net.blobs('zero').set_data(zeros(width_test, height_test));
net.blobs('coord_canon').set_data(coord); needed?
path_left = 'left.jpg'
path_right = 'right.jpg'
MODEL_FILE = 'deploy_kitti.prototxt'
PRETRAINED = 'crl.caffemodel'
left_img = cv2.imread(path_left)
right_img = cv2.imread(path_right)
caffe.set_mode_gpu()
caffe.set_device(0)
net = caffe.Net(MODEL_FILE, PRETRAINED, caffe.TEST)
left_img = cv2.resize(left_img, (net.blobs['img0'].data.shape[3],net.blobs['img0'].data.shape[2]))
right_img = cv2.resize(right_img, (net.blobs['img1'].data.shape[3],net.blobs['img1'].data.shape[2]))
left_img = left_img.astype(np.float32)
left_img = left_img.transpose((2, 0, 1))
right_img = right_img.astype(np.float32)
right_img = right_img.transpose((2, 0, 1))
net.blobs['img0'].data[...] = left_img
net.blobs['img1'].data[...] = right_img
caffe.set_mode_gpu()
caffe.set_device(0)
disp = net.forward()
out = -disp["predict_flow2_s2"].transpose(2,3,0,1).reshape(320,1792)
img = Image.fromarray(out, 'RGB')
img.save('my.png')
img.show()
The text was updated successfully, but these errors were encountered: