Created
May 19, 2015 08:14
-
-
Save huyng/34b0b5e6af6e623f331f to your computer and use it in GitHub Desktop.
simple inference for caffe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import caffe | |
from PIL import Image | |
import numpy as np | |
pimga = Image.open("a.jpg") | |
pimgb = Image.open("b.jpg") | |
nimga = np.array(pimga).reshape(1,256,256,3).transpose(0,3,1,2) | |
nimgb = np.array(pimgb).reshape(1,256,256,3).transpose(0,3,1,2) | |
caffe.set_mode_cpu() | |
net = caffe.Net("model/net.prototxt", "model/net.caffemodel",0) | |
print net.forward_all(**{"data_a":nimga, "data_b":nimgb}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Huyng,
Can you please send the Git repository link for this code, it would be a great help.
Thanks in advance.
Regards,
Surendra Allam.