problem about using mnist
When I test mnist with python,an error arise:
Traceback (most recent call last):
File "1.py", line 16, in
Here is the code:
import caffe import numpy as np MODEL_FILE = 'lenet.prototxt' PRETRAINED = 'lenet_iter_10000' IMAGE_FILE = 'charblk_11.jpg' net = caffe.Classifier(MODEL_FILE, PRETRAINED, mean=np.load('caffe/imagenet/ilsvrc_2012_mean.npy'), channel_swap=None, raw_scale=255, image_dims=(28, 28)) net.set_phase_test() net.set_mode_cpu() input_image = caffe.io.load_image(IMAGE_FILE,False) prediction = net.predict([input_image])
lenet_iter_10000 and lenet.prototxt are from the example. charblk_11.jpg is a gray image.
Please ask on caffe-users. Issues are for development discussion. Thanks!
The issue here is that you are mismatching input dimensionality: the model needs the right number of channels.