Skip to content

Instantly share code, notes, and snippets.

@XericZephyr
Created October 23, 2015 02:10
Show Gist options
  • Save XericZephyr/72d2c177733cdb896b66 to your computer and use it in GitHub Desktop.
Save XericZephyr/72d2c177733cdb896b66 to your computer and use it in GitHub Desktop.
Lenet Train Test
__author__ = 'caffedemo'
import caffe
import os
from PIL import Image
CAFFE_ROOT = "/home/caffedemo/caffe/caffe/"
TRAIN_TEST_NET = os.path.join(CAFFE_ROOT, 'examples/mnist/lenet_train_test.prototxt')
def ut_test_lenet_train_test():
os.chdir(CAFFE_ROOT)
net = caffe.Net(TRAIN_TEST_NET, caffe.TEST)
result = net.forward()
Image.fromarray(net.blobs['data'].data[0,:].reshape((28,28))*255).show()
pass
if __name__ == '__main__':
ut_test_lenet_train_test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment