Open donaldm opened 9 years ago
Hmm, have you tried different caffemodels? I tried, but failed miserably...
Yes I have. The real secret is for the end parameter you need to specify the layer name from the blob list that you want to use. The "higher" layers should contain more details. It might take some trial and error to find the right layers to use. Also you will need to use a (potentially) different image mean.
What is odd... is that in the train_val.prototxt that is in the bvlc_googlenet if you grep for "mean" you get the numbers: 104, 117, 123... but the mean used in the dreamify.py is "104, 116, 122".
Also in other models it seems there is potentially something like "places_mean.mat"... from research it seems this needs to be loaded like:
"net = caffe.Classifier(MODEL_FILE, PRETRAINED) net.set_raw_scale('data',255) net.set_channel_swap('data',(2,1,0)) net.set_mean('data',np.load(caffe_root+'python/caffe/imagenet/ilsvrc_2012_mean.npy'))"
is how that should be done roughly: https://github.com/BVLC/caffe/issues/1936
Here is a sample json that works with the googlenet_places205 dataset:
{ "model_path": "/home/vagrant/caffe/models/googlenet_places205/", "prototxt": "deploy_places205.protxt", "caffemodel": "googlelet_places205_train_iter_2400000.caffemodel", "image_mean": [104.0, 116.0, 122.0], "end": "inception_4d/output" }
You probably want to fork this repo (in the github sense), commit your changes (in a more atomic fashion, rather than one huge commit), and then drop a pointer to your repo here, or maybe open another issue with Dhar to have him link to your repo from the Readme. You seem to have some really good insights into the what the code actually does :+1:
Also, you could track your own issues there ;)
The setters from your example above all yield 'Classifier' object has no attribute 'set_foo'
when used on the bvlc_googlenet model. Is that expected?
Hello Tildebyte,
The error you are seeing is not expected. I do not see that error on my end, so I find it quite odd.
Creating a repo is not a bad idea, but I do not really have time to maintain anything at the moment. I just posted the code in-case there were any useful bits or ideas that could be gained from it.
Thanks for the input, @donaldm and @tildebyte! I just got back from a vacation without internet, so it might take me a bit to catch up and check this out. I haven't forgotten you! :)
Two suggestions:
set a default value for iterations. If not set from the command line, I get an error when it tries to int('').
parser.add_option('-i', '--iterations', action='store',
dest='iterations', default='10', help='The number of iterations')
If Caffe was built for the NVIDIA GPU, these lines will speed things up a LOT...
# If your GPU supports CUDA and Caffe was built with CUDA support,
# uncomment the following to run Caffe operations on the GPU.
caffe.set_mode_gpu()
caffe.set_device(0) # select GPU device if multiple devices exist
Hi,
I spent some time and rewrote the dreamify.py a bit. I moved the data to a json file.
Dreamify.py:
And an example json: