Skip to content
New issue

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

Testing network on CPU #23

Open
nguyenminhduc9988 opened this issue Mar 7, 2016 · 4 comments
Open

Testing network on CPU #23

nguyenminhduc9988 opened this issue Mar 7, 2016 · 4 comments
Assignees

Comments

@nguyenminhduc9988
Copy link

Hi, I would like to use the pretrained model to classify some image and I have a CPU only machine.
Can you give me some instruction on how to do this.

Thank you

@gwding
Copy link
Contributor

gwding commented Mar 7, 2016

you'll need to modify the ConvPoolLayer in layer.py such that it use the CPU-compatible convolution operation. and you should be able to reuse the alex_net.py with no/minimal modification

@nguyenminhduc9988
Copy link
Author

Thank you for your quick comment. I will try it.

@nguyenminhduc9988
Copy link
Author

How can I only load the model up. The code in the validate suggest to have a dataset. I want to only load the model and input an image into it.

@hma02
Copy link
Contributor

hma02 commented Mar 10, 2016

@ducminhnguyen
For computing with CPU, I think you need to run the code with THEANO_FLAGS=mode=FAST_RUN,device=cpu,floatX=float32 python train.py

Follow the link below for Theano comparison on using CPU and GPU:
http://deeplearning.net/software/theano/tutorial/using_gpu.html

Currently, a single image reference is not implemented in this code. Only training and validation on a given batch size of images is supported. If you want to do a single image inference, you may want to construct a theano funtion like this:

inference = theano.funciton(x, [y])

where x is the input image batch to the model (batch size=1, may just pass in an image stored in a numpy array of dimension "c01b", b=1), y is the catagorical binary output of the softmax layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants