Closed Beanocean closed 9 years ago
Gah, yeah you're right they moved the phase from caffe global into Net class. In your case since you already added the phase as 3rd arg in constructor of Net (the new way), should you just delete that line that's causing trouble? You've already set the test phase with your fix.
Thank you very much @karpathy . I have fixed it as you advised.
Hi I'm a total newbie in Caffe in CNNs. I have the same problem when I wanted to run the code for visualization. I didn't get the solution from your response. Could you please explain it a little more? I have n't done what Beanocean did first I mean: "So I change the code in extract_features.py#101 as: net = caffe.Net(args.model_def, args.model, caffe.TEST). It worked, but a new problem came out:"
Hi , I want to check the trained model on my own set of images, and while running extract_features.m and after downloading caffe , "caffe('set_device', 1); " is not running. I couldn't find caffe.m
Hi I'm a total newbie in Caffe in CNNs. I have the same problem when I wanted to run the code for visualization. I didn't get the solution from your response. Could you please explain it a little more? I have n't done what Beanocean did first I mean: "So I change the code in extract_features.py#101 as: net = caffe.Net(args.model_def, args.model, caffe.TEST). It worked, but a new problem came out:"
I think we have different problem though you got the same error. my problem is about feature extraction, but yours is about visualization. Here you can see the different version of python_features/extract_features.py. My problem was caused by the update of CAFFE's API, and it has been fixed up in new version.
Hi , I want to check the trained model on my own set of images, and while running extract_features.m and after downloading caffe , "caffe('set_device', 1); " is not running. I couldn't find caffe.m
I think you need to compile matcaffe firstly(execute make matcaffe
in your caffe's directory), and add caffe path to the system path of your MATLAB by using addpath("Your caffe path")
I also met this problems:
my code follows here:
import numpy as np import matplotlib.pyplot as plt
caffe_root = '/home/guyunee/Desktop/caffe-master/' # this file is expected to be in {caffe_root}/examples,建议使用绝对路径 import sys sys.path.insert(0, caffe_root + 'python')
import caffe
plt.rcParams['figure.figsize'] = (10, 10) plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray'
caffe.set_phase_test() caffe.set_mode_cpu() net = caffe.Classifier(caffe_root + 'models/bvlc_reference_caffenet/deploy.prototxt', caffe_root + 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel')
net.set_mean('data', np.load(caffe_root + 'python/caffe/imagenet/ilsvrc_2012_mean.npy')) # ImageNet mean net.set_raw_scale('data', 255) net.set_channel_swap('data', (2,1,0))
AttributeError Traceback (most recent call last)
When I tried to run the python scripts
python_features/extract_features.py
today, I met with a problem as follow:Then I search this error on the Internet, and I find a same issue in caffe's issue page: Caffe#1905. I think it's an error caused by the update of Caffe's API. So I change the code in extract_features.py#101 as:
net = caffe.Net(args.model_def, args.model, caffe.TEST)
. It worked, but a new problem came out:I think the reason is that some APIs in
python_features/extract_features.py
are too old.