{
  "id": 6845,
  "title": "Example: Use DeCAF via nolearn for 94% accuracy",
  "url": "/competitions/dogs-vs-cats/discussion/6845",
  "author_name": "Daniel Nouri",
  "post_date": "2014-01-15T22:16:19.567000",
  "votes": 17,
  "comment_count": 46,
  "views": 35718,
  "content": "<p>I've posted a simple example for nolearn.convnet that shows how to use the ImageNet-pretrained DeCAF as a feature extractor, and get a score of 94% with only 50 lines of code, and with merely 100 examples used for training.</p>\n<p>http://pythonhosted.org/nolearn/decaf.html#example-dogs-vs-cats</p>\n<p>https://github.com/dnouri/nolearn</p>\n<p>Edit: Install instructions are <a href=\"#post37548\">here</a>.</p>",
  "messages": [
    {
      "id": 37424,
      "postDate": "2014-01-15T22:16:19.567Z",
      "content": "<p>I've posted a simple example for nolearn.convnet that shows how to use the ImageNet-pretrained DeCAF as a feature extractor, and get a score of 94% with only 50 lines of code, and with merely 100 examples used for training.</p>\n<p>http://pythonhosted.org/nolearn/decaf.html#example-dogs-vs-cats</p>\n<p>https://github.com/dnouri/nolearn</p>\n<p>Edit: Install instructions are <a href=\"#post37548\">here</a>.</p>",
      "votes": 17
    },
    {
      "id": 113980,
      "postDate": "2016-04-06T16:14:43.490Z",
      "content": "<p>Cannot find DecafNet files. How can I get the decaf_pretrained file  imagnet.decaf.epoch90</p>",
      "rawMarkdown": "Cannot find DecafNet files. How can I get the decaf_pretrained file  imagnet.decaf.epoch90",
      "votes": 3
    },
    {
      "id": 126752,
      "postDate": "2016-07-12T05:25:54.923Z",
      "content": "<p>Can someone help in finding Pretrained imagenet models? The link provided doesn't exist anymore.</p>",
      "rawMarkdown": "Can someone help in finding Pretrained imagenet models? The link provided doesn't exist anymore.",
      "votes": 1
    },
    {
      "id": 37548,
      "postDate": "2014-01-18T00:24:46.263Z",
      "content": "<p>I believe the problem is that your numpy is too old. &nbsp;This might fix your issue:</p>\n<p>&nbsp; # pip install -U numpy</p>\n<p>Although I'd recommend against installing Python packages with pip system-wide because it's too easy to mess up your global install. &nbsp;Instead you could use a virtualenv, and then always use the &quot;python&quot; and &quot;pip&quot; commands from its &quot;bin/&quot; directory to run and install libs.</p>\n<h3>Quick install instructions for nolearn and decaf</h3>\n<p>&nbsp; $ git clone git@github.com:UCB-ICSI-Vision-Group/decaf-release.git</p>\n<p>&nbsp; $ cd decaf-release</p>\n<p>&nbsp; $ virtualenv . --system-site-packages</p>\n<p>&nbsp; $ bin/pip install -U numpy &nbsp;# if your system numpy is too old</p>\n<p>&nbsp; $ bin/pip install -U scipy &nbsp;# if your system scipy is too old</p>\n<p>&nbsp; $ bin/pip install -U Cython &nbsp;# if your system Cython is too old</p>\n<p>&nbsp; $ bin/python setup.py install &nbsp;# compile, install decaf; make sure it runs w/o errors</p>\n<p><span style=\"line-height: 1.4\">&nbsp; $ bin/pip install nolearn &nbsp;# install nolearn</span></p>\n<p>&nbsp; $ bin/python mydecaf.py &nbsp;# run your own script</p>\n<p>&nbsp;</p>",
      "votes": 5
    },
    {
      "id": 37923,
      "postDate": "2014-01-25T17:06:58.450Z",
      "content": "<p>[quote=stevenwudi;37921]</p>\n<p><span style=\"line-height: 1.4\">Though just one line of code, but I could not understand your cache mechanism. Can you brief enlighten me about the </span><em style=\"line-height: 1.4\"><strong>@cache.cached </strong></em><span style=\"line-height: 1.4\">&nbsp;purpose? Many thanks</span></p>\n<p><span style=\"line-height: 1.4\">[/quote]</span></p>\n<p><span style=\"line-height: 1.4\">Take a look at the <a href=\"http://pythonhosted.org/nolearn/cache.html\">nolearn.cache docs</a>, they explain what this is about.</span></p>\n<p>The gist is that computing features with decaf can be slow if you have a lot of examples. &nbsp;So you don't want to do the calculation every time you run the script, but cache the results between runs (if you're using the same parameters).</p>",
      "votes": 1
    },
    {
      "id": 37920,
      "postDate": "2014-01-25T16:51:19.033Z",
      "content": "<p>[quote=stevenwudi;37919]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>[/quote]</p>\n<p>So you've found a bug in the caching code of nolearn.convnet. &nbsp;I've pushed a quick fix; will make a proper release next week. &nbsp;For now you'll have the get the latest version from here:</p>\n<p>&nbsp; https://github.com/dnouri/nolearn</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>I checked out your personal website yesterday and like your works a lot.&nbsp;</p>\n<p>[/quote]</p>\n<p>Thanks :-)</p>",
      "votes": 1
    },
    {
      "id": 37899,
      "postDate": "2014-01-25T03:45:49.407Z",
      "content": "<p>It's&nbsp; a gcc issue on mac it seems , while installing decaf :</p>\n<p>python setup.py install</p>\n<p>make -C layers/cpp/g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cppclang: warning: argument unused during compilation: '-fopenmp'local_response_normalization.cpp:7:10: fatal error: 'omp.h' file not found#include &lt;omp.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>\n<p>^1 error generated.make[1]: ***</p>\n<p>[all] Error 1make: *** [all]</p>\n<p>Error 2Failed to build the C libraries; exiting</p>",
      "votes": 1
    },
    {
      "id": 37886,
      "postDate": "2014-01-24T19:55:34.610Z",
      "content": "<p>[quote=charizard;37884]</p>\n<p>Thanks for sharing <br>I tried this method , but I am not able to run my script</p>\n<p>Error: <br>ImportError: No module named decaf.scripts.imagenet</p>\n<p>[/quote]</p>\n<p>Have you followed the <a href=\"https://www.kaggle.com/c/dogs-vs-cats/forums/t/6845/example-use-decaf-via-nolearn-for-94-accuracy#post37548\">install instructions</a> that I posted? &nbsp;Because it seems you haven't run this command from within the decaf folder:</p>\n<p>&nbsp; $ bin/python setup.py install &nbsp;#&nbsp;compile, install decaf; make sure it runs w/o errors</p>",
      "votes": 1
    },
    {
      "id": 37748,
      "postDate": "2014-01-22T18:33:47.503Z",
      "content": "<p>Pip install pil</p>",
      "votes": 1
    },
    {
      "id": 37734,
      "postDate": "2014-01-22T17:33:55.683Z",
      "content": "<p>Unfortunately I couldn't manage to have it run on Windows (yet). It seems I have some not so well identified trouble with MPI, but I have to further investigate the matter. So, in the end, I made it run under Linux (on a virtual machine, I assure you, a very sloow experience!).</p>\n<p>As for as the problem mentioned by Steven,&nbsp;the pretrained netfile is in Unix format, so, Steven, you have to modify the code in such a fashion:</p>\n<p>cuda_decafnet = pickle.load(open(net_file,&quot;rb&quot;))</p>\n<p>The &quot;rb&quot; option will have Python to read smoothly the data. Please let me know if, after fixing that, your script runs well because I would like to ask you some information about your specific configuration and compiling procedures, then.</p>\n<p>&nbsp;</p>",
      "votes": 1
    },
    {
      "id": 37708,
      "postDate": "2014-01-22T03:40:20.117Z",
      "content": "<p>0.09x is also possible with a regular non-conv neural net. I'd guess imagenet's features don't generalize too well to such a specific non-general purpose task. Also wouldn't using a system like that break the no outside data without public declaration/consent rule for galaxy zoo?</p>",
      "votes": 1
    },
    {
      "id": 37698,
      "postDate": "2014-01-21T23:45:30.927Z",
      "content": "<p>i tried decaf in galaxy zoo with random forest on top of it, but couldnt get a score of less than 0.15</p>",
      "votes": 1
    },
    {
      "id": 37697,
      "postDate": "2014-01-21T23:43:46.537Z",
      "content": "<p>[quote=Matt;37695]</p>\n<p>Ok, bear with me, I'll try to rephrase the question: How do the features generated from decaf and overfeat compare with each other regarding predictive power (e.g. have you tried to stick the same supervised learning algorithm on top of both and compared the results?).</p>\n<p>[/quote]</p>\n<p>Yes, you can use OverFeat pretty much the same way. &nbsp;OverFeat looks at multiple scales and sliding windows of the test image to extract features, which will give you more (and more powerful) features, at the expense of speed.</p>\n<p>Of course one could use multiple scales with decaf or caffe, too. &nbsp;That wouldn't be too hard to implement.</p>\n<p>[quote=Matt;37695]</p>\n<p>Furthermore, does it make sense to apply the feature extraction step in the galaxy zoo competition or do these model only perform so well because they were trained on a similar (but larger) training set (ImageNet)?</p>\n<p>[/quote]</p>\n<p>I'd say it's definitely worth a try to use decaf in the galaxy zoo competition. &nbsp;You would however want to extract features from maybe the second or the third layer, and possibly feed those features into a neural net. &nbsp;Then again, the galaxy zoo competition comes with plenty images for training (60k), so it might just work better to just train a convnet from scratch.</p>\n<p>If you try decaf with galaxy zoo, I'd be interested to hear how that goes.</p>\n<p>(I just saw that someone else had the <a href=\"https://www.kaggle.com/c/galaxy-zoo-the-galaxy-challenge/forums/t/6882/does-any-one-try-the-imagenet-model\">exact same question as you</a> in the galaxy zoo competition's forum.)</p>\n<p>&nbsp;</p>",
      "votes": 1
    },
    {
      "id": 37547,
      "postDate": "2014-01-18T00:22:54.847Z",
      "content": "<p>Delete numpy from the decaf egg. I had this error - it's looking for multiarray in decaf version of numpy.</p>",
      "votes": 1
    },
    {
      "id": 37539,
      "postDate": "2014-01-17T21:27:21.937Z",
      "content": "<p><span style=\"line-height: 1.4\">[quote=orchid;37538]ImportError: No module named multiarray[/quote]</span></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">multiarray is part of numpy, which numpy version are you using?</span></p>",
      "votes": 1
    },
    {
      "id": 37706,
      "postDate": "2014-01-22T03:31:33.470Z",
      "content": "<p>For galaxy, if I remember correctly second-last hidden layer of decaf trained with a neural net got me around 0.11. You can get 0.09x pretty easily with a convnet trained from scratch, so I don't expect decaf features to be competitive there.</p>",
      "votes": 2
    },
    {
      "id": 37515,
      "postDate": "2014-01-17T16:35:13.407Z",
      "content": "<p>remove that param from decaf/layers/Makefile and compile</p>",
      "votes": 2
    },
    {
      "id": 365214,
      "postDate": "2018-08-02T05:55:35.857Z",
      "content": "<p>Looks like link to pre-trained model is now broken: <a href=\"http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/\">http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/</a>\nIt's showing github 404 page</p>",
      "rawMarkdown": "Looks like link to pre-trained model is now broken: http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/\nIt's showing github 404 page"
    },
    {
      "id": 59460,
      "postDate": "2014-12-03T13:57:38.050Z",
      "content": "<p>[quote=stevenwudi;37747]</p>\n<p>[quote=Luca Massaron;37741]</p>\n<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>\n<p>[/quote]</p>\n<p>Hi Luca, for meta file, &quot;rb&quot; is not an issue, I used Anaconda and there is some conflicts (not sure why)</p>\n\n<p>So I used official Python2.7 and install packages from scratch and now it can read the files.</p>\n\n<p>But one more issue:&nbsp;</p>\n<p>&quot;</p>\n<p>in \\site-packages\\nolearn\\convent.py line 112, in transform</p>\n<p>import Images #soft dep</p>\n<p>ImportError: No module name Image&quot;</p>\n\n<p>So I am wondering what is module Image here. Sorry for the spam..</p>\n<p>[/quote]</p>\n\n<p>I have met the same problem. It is fortunate that I am familiar with the Library PIL. Check that you have installed the PIL. Then change the &quot;import Image&quot; into &quot;from PIL import Image&quot; and it works.</p>"
    },
    {
      "id": 59443,
      "postDate": "2014-12-03T05:43:32.283Z",
      "content": "<p>[quote=charizard;37899]</p>\n<p>It's&nbsp; a gcc issue on mac it seems , while installing decaf :</p>\n<p>python setup.py install</p>\n<p>make -C layers/cpp/g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cppclang: warning: argument unused during compilation: '-fopenmp'local_response_normalization.cpp:7:10: fatal error: 'omp.h' file not found#include &lt;omp.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>\n<p>^1 error generated.make[1]: ***</p>\n<p>[all] Error 1make: *** [all]</p>\n<p>Error 2Failed to build the C libraries; exiting</p>\n<p>[/quote]</p>\n\n<p>I have met the same error on MAC OS. Can anyone give us a solution to such error? Thank you.</p>"
    },
    {
      "id": 38013,
      "postDate": "2014-01-27T16:37:32.870Z",
      "content": "<p>Hello everyone, this piece of code throws errors on Windows:</p>\n<p><code>try:<br>&nbsp; &nbsp; _DLL = np.ctypeslib.load_library('libcpputil.so',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;os.path.join(os.path.dirname(__file__)))<br>except Exception as error:<br>&nbsp; &nbsp; raise error</code></p>\n<p>&nbsp;</p>\n<p>It's inside wrapper.py</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37921,
      "postDate": "2014-01-25T16:58:59.827Z",
      "content": "<p>[quote=Daniel Nouri;37920]</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>[/quote]</p>\n<p>So you've found a bug in the caching code of nolearn.convnet. &nbsp;I've pushed a quick fix; will make a proper release next week. &nbsp;For now you'll have the get the latest version from here:</p>\n<p>&nbsp; https://github.com/dnouri/nolearn</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>I checked out your personal website yesterday and like your works a lot.&nbsp;</p>\n<p>[/quote]</p>\n<p>Thanks :-)</p>\n<p>[/quote]</p>\n<p>&nbsp;</p>\n<p>Thanks Daniel, you are truly efficient! Now it works fine.</p>\n<p>Though just one line of code, but I could not understand your cache mechanism. Can you brief enlighten me about the <em><strong>@cache.cached </strong></em>&nbsp;purpose? Many thanks</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37919,
      "postDate": "2014-01-25T16:44:27.283Z",
      "content": "<p>[quote=Daniel Nouri;37917]</p>\n<p>[quote=stevenwudi;37916]</p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>\n<p>[/quote]</p>\n<p>&lt;strike&gt;The way you use KFold you're using only 20 examples for testing, which explains the discrepancy. &nbsp;Increase the number you use for testing and training, maybe by a factor of 10:&lt;/strike&gt;</p>\n<p>Woops, looks like I was wrong. &nbsp;I can reproduce your problem even with more examples. &nbsp;Will look into this soon.</p>\n<p>[/quote]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>I checked out your personal website yesterday and like your works a lot. (I used to use matlab, now much more convincing to use Python now.) And I do agree you pair-coding working style :)</p>\n<p>Best X</p>"
    },
    {
      "id": 37917,
      "postDate": "2014-01-25T16:37:21.050Z",
      "content": "<p>[quote=stevenwudi;37916]</p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>\n<p>[/quote]</p>\n<p>&lt;strike&gt;The way you use KFold you're using only 20 examples for testing, which explains the discrepancy. &nbsp;Increase the number you use for testing and training, maybe by a factor of 10:&lt;/strike&gt;</p>\n<p>Woops, looks like I was wrong. &nbsp;I can reproduce your problem even with more examples. &nbsp;Looking into this right now.</p>"
    },
    {
      "id": 37916,
      "postDate": "2014-01-25T16:14:09.883Z",
      "content": "<p>Hi, I have encounter some problems in cross-validation (I am new to explore the sklearn):</p>\n<p>I used nolearn and cv: as</p>\n<p>&lt;pre&gt; X_train, y_train = X[:100], y[:100]<br> #X_test, y_test = X[500:1000], y[500:1000]</p>\n<p># Simple K-Fold cross validation. 5 folds.<br> cv = cross_validation.KFold(len(X_train), n_folds=5, indices=True)</p>\n<p>for traincv, testcv in cv:<br> print &quot;Fitting...&quot;<br> pl.fit(X_train[traincv], y_train[traincv])<br> print &quot;Predicting...&quot;<br> y_pred = pl.predict(X_train[testcv])<br> print &quot;Accuracy: %.3f&quot; % accuracy_score(y_train[testcv], y_pred)</p>\n<p>&lt;/pre&gt;</p>\n<p>the output is</p>\n<p>&lt;pre&gt;</p>\n<p>0.9</p>\n<p>0.9</p>\n<p>0.36</p>\n<p>0.45</p>\n<p>1.0</p>\n<p><span style=\"line-height: 1.4\">&lt;/pre&gt;</span></p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>"
    },
    {
      "id": 37884,
      "postDate": "2014-01-24T19:12:43.023Z",
      "content": "<p>Thanks for sharing <br>I tried this method , but I am not able to run my script</p>\n<p>Error: <br>ImportError: No module named decaf.scripts.imagenet</p>"
    },
    {
      "id": 37774,
      "postDate": "2014-01-23T01:10:03.107Z",
      "content": "<p>[quote=Luca Massaron;37734]</p>\n<p>Unfortunately I couldn't manage to have it run on Windows (yet). It seems I have some not so well identified trouble with MPI, but I have to further investigate the matter. So, in the end, I made it run under Linux (on a virtual machine, I assure you, a very sloow experience!).</p>\n<p>As for as the problem mentioned by Steven,&nbsp;the pretrained netfile is in Unix format, so, Steven, you have to modify the code in such a fashion:</p>\n<p>cuda_decafnet = pickle.load(open(net_file,&quot;rb&quot;))</p>\n<p>The &quot;rb&quot; option will have Python to read smoothly the data. Please let me know if, after fixing that, your script runs well because I would like to ask you some information about your specific configuration and compiling procedures, then.</p>\n<p>&nbsp;</p>\n<p>[/quote]</p>\n<p>&nbsp;</p>\n<p>Hey, Luca. Finally I am able to run the code and have the 93% accuracy. I have scribble a blog here:http://vision.group.shef.ac.uk/wordpress/?p=93</p>\n<p>Apologies if anything unclear. Too late now, need to sleep...</p>"
    },
    {
      "id": 37769,
      "postDate": "2014-01-22T22:48:14.980Z",
      "content": "<p>I finally got the code running under Windows Visual Studio environment. However, when I run some simple demo like:</p>\n<p>&quot;</p>\n<p><em><strong>scores = net.classify(img)</strong></em></p>\n<p>&quot;</p>\n<p>It just kept running without any output. And I checked the python code, for<em><strong> base.py,&nbsp;</strong>&nbsp;<strong>Class Layer</strong>,&nbsp;<strong>def predict</strong></em> method, the predict method says&nbsp;</p>\n<p><em> &quot;&quot;&quot;A wrapper function to do prediction. If a layer has different</em><br><em> behaviors during training and testing, one can write a predict()</em><br><em> function which is called during testing time.</em><br> <br><em> In default, the predict() function will simply call forward.</em><br><em> &quot;&quot;&quot;</em></p>\n<p><em>Not sure why the code just keeps running... ( I compiled the cpp code in the layer folder using Cygwin, not sure whether it is relevant)&nbsp;</em></p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37747,
      "postDate": "2014-01-22T18:31:28.623Z",
      "content": "<p>[quote=Luca Massaron;37741]</p>\n<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>\n<p>[/quote]</p>\n<p>Hi Luca, for meta file, &quot;rb&quot; is not an issue, I used Anaconda and there is some conflicts (not sure why)</p>\n<p>&nbsp;</p>\n<p>So I used official Python2.7 and install packages from scratch and now it can read the files.</p>\n<p>&nbsp;</p>\n<p>But one more issue:&nbsp;</p>\n<p>&quot;</p>\n<p>in \\site-packages\\nolearn\\convent.py line 112, in transform</p>\n<p>import Images #soft dep</p>\n<p>ImportError: No module name Image&quot;</p>\n<p>&nbsp;</p>\n<p>So I am wondering what is module Image here. Sorry for the spam..</p>"
    },
    {
      "id": 37741,
      "postDate": "2014-01-22T18:00:57.713Z",
      "content": "<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>"
    },
    {
      "id": 37736,
      "postDate": "2014-01-22T17:50:12.037Z",
      "content": "<p>[quote=Luca Massaron;37734]</p>\n<p>Unfortunately I couldn't manage to have it run on Windows (yet). It seems I have some not so well identified trouble with MPI, but I have to further investigate the matter. So, in the end, I made it run under Linux (on a virtual machine, I assure you, a very sloow experience!).</p>\n<p>As for as the problem mentioned by Steven,&nbsp;the pretrained netfile is in Unix format, so, Steven, you have to modify the code in such a fashion:</p>\n<p>cuda_decafnet = pickle.load(open(net_file,&quot;rb&quot;))</p>\n<p>The &quot;rb&quot; option will have Python to read smoothly the data. Please let me know if, after fixing that, your script runs well because I would like to ask you some information about your specific configuration and compiling procedures, then.</p>\n<p>&nbsp;</p>\n<p>[/quote]</p>\n<p>&nbsp;</p>\n<p>HI Luca,</p>\n<p>&nbsp; It does work now. However, for line 52 in imagenet.py, I encounter the error:</p>\n<p>&quot; self.label_names = meta['label_names']&quot;&nbsp;'Access violation'.</p>\n<p>&nbsp;</p>\n<p>Quite bizarre error, anyone can help?</p>"
    },
    {
      "id": 37729,
      "postDate": "2014-01-22T17:00:51.837Z",
      "content": "<p>[quote=stevenwudi;37728]</p>\n<p>Hi, I am wondering whether anybody has made DeCAF work under windows?</p>\n<p>My issue is that for the pretrained netfile, which I downloaded from&nbsp;http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/, I am not able to read it</p>\n<p>&quot; cuda_decafnet = pickle.load(open(net_file)) &nbsp;EOFError&quot;</p>\n<p>Anyone can cast light on this? Many thanks!</p>\n<p>[/quote]</p>\n<p>I believe at least Luca has it running under Windows.</p>\n<p>Your EOFError looks like the file you downloaded may be corrupted. &nbsp;The md5 checksum of&nbsp;imagenet.decafnet.epoch90 should be&nbsp;66155aca4447b9fe8c203ccbfb19b93b.</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37728,
      "postDate": "2014-01-22T16:51:32.040Z",
      "content": "<p>Hi, I am wondering whether anybody has made DeCAF work under windows?</p>\n<p>My issue is that for the pretrained netfile, which I downloaded from&nbsp;http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/, I am not able to read it</p>\n<p>&quot; cuda_decafnet = pickle.load(open(net_file)) &nbsp;EOFError&quot;</p>\n<p>Anyone can cast light on this? Many thanks!</p>"
    },
    {
      "id": 37703,
      "postDate": "2014-01-22T02:36:07.947Z",
      "content": "<p>tried all available ones using grid search</p>"
    },
    {
      "id": 37699,
      "postDate": "2014-01-21T23:48:17.773Z",
      "content": "<p>[quote=Abhishek;37698]</p>\n<p>i tried decaf in galaxy zoo with random forest on top of it, but couldnt get a score of less than 0.15</p>\n<p>[/quote]</p>\n<p>Which layer did you use for extracting features?</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37695,
      "postDate": "2014-01-21T22:44:07.897Z",
      "content": "<p>Haha :D</p>\n<p>Ok, bear with me, I'll try to rephrase the question: How do the features generated from decaf and overfeat compare with each other regarding predictive power (e.g. have you tried to stick the same supervised learning algorithm on top of both and compared the results?).</p>\n<p>Furthermore, does it make sense to apply the feature extraction step in the galaxy zoo competition or do these model only perform so well because they were trained on a similar (but larger) training set (ImageNet)?</p>"
    },
    {
      "id": 37691,
      "postDate": "2014-01-21T20:36:10.370Z",
      "content": "<p>I think it's save to say Pierre did. &nbsp;;-)</p>"
    },
    {
      "id": 37685,
      "postDate": "2014-01-21T18:24:17.380Z",
      "content": "<p>Has anybody tried to do the same with Overfeat?</p>"
    },
    {
      "id": 37603,
      "postDate": "2014-01-19T12:27:49.247Z",
      "content": "<p>[quote=saraswathi;37598]</p>\n<p>I tried installing nolearn using the command:</p>\n<p>$pip install nolearn</p>\n<p>&nbsp;</p>\n<p>After downloading nolearn, I get the following error:</p>\n<p>Downloading/unpacking gdbn (from nolearn)<br> Could not find any downloads that satisfy the requirement gdbn (from nolearn)<br>Cleaning up...<br>No distributions at all found for gdbn (from nolearn)<br><span style=\"line-height: 1.4\">[/quote]</span></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">I fixed this. &nbsp;You should be able to just use &quot;bin/pip install nolearn&quot; now.</span></p>"
    },
    {
      "id": 37598,
      "postDate": "2014-01-19T08:02:33.500Z",
      "content": "<p>I tried installing nolearn using the command:</p>\n<p>$pip install nolearn</p>\n<p>&nbsp;</p>\n<p>After downloading nolearn, I get the following error:</p>\n<p>Downloading/unpacking gdbn (from nolearn)<br> Could not find any downloads that satisfy the requirement gdbn (from nolearn)<br>Cleaning up...<br>No distributions at all found for gdbn (from nolearn)<br>Storing debug log for failure in /var/folders/m9/fndll3l57399ymnsyk5dnwcm0000gn/T/tmpd8G236</p>\n<p>&nbsp;</p>\n<p>Can someone suggest what I should do to fix this? (Am a Python noob). Using Anaconda on Mac 10.8.5</p>\n<p>&nbsp;</p>\n<p>Thanks.</p>\n<p>&nbsp;</p>\n<p>EDIT: Installed gdbn from github and now it works. The code runs. But now, getting warning to install mpi4py. Trying to understand what that one is :) .&nbsp;</p>"
    },
    {
      "id": 37546,
      "postDate": "2014-01-17T23:59:35.410Z",
      "content": "<p>Well, I got same&nbsp;&nbsp;&quot;No module named multiarray&quot; error on Cygwin like i got in Ubuntu.</p>\n<p>numpy version on Cygwin is 1.6.2 and multiarray.dll is already at numpy/core/ directory</p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">&nbsp;</span></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">$ python mydecaf.py</span></p>\n<p>Fitting...</p>\n<p>Couldn't import dot_parser, loading of dot files will not be possible.<br>WARNING:root:decaf.util.pyvml: unable to load the mkl library. Using fallback options.<br>Traceback (most recent call last):<br> File &quot;mydecaf.py&quot;, line 44, in &lt;module&gt;</p>\n<p>main()</p>\n<p>File &quot;mydecaf.py&quot;, line 40, in main</p>\n<p>pl.fit(X_train, y_train)<br> File &quot;/usr/lib/python2.7/site-packages/scikit_learn-0.14.1-py2.7-cygwin-1.7.27-x86_64.egg/sklearn/pipeline.py&quot;, line 130, in fit<br> Xt, fit_params = self._pre_transform(X, y, **fit_params)<br> File &quot;/usr/lib/python2.7/site-packages/scikit_learn-0.14.1-py2.7-cygwin-1.7.27-x86_64.egg/sklearn/pipeline.py&quot;, line 122, in _pre_transform<br> Xt = transform.fit(Xt, y, **fit_params_steps[name]) \\<br> File &quot;/usr/lib/python2.7/site-packages/nolearn-0.4.1dev-py2.7.egg/nolearn/convnet.py&quot;, line 98, in fit<br> self.pretrained_meta,<br> File &quot;/usr/lib/python2.7/site-packages/decaf-0.9-py2.7.egg/decaf/scripts/imagenet.py&quot;, line 45, in __init__<br> meta = pickle.load(open(meta_file))<br>ImportError: No module named multiarray</p>\n<p>&nbsp;</p>\n<p>$ cat mydecaf.py<br>import os<br>from nolearn.convnet import ConvNetFeatures<br>from sklearn.linear_model import LogisticRegression<br>from sklearn.metrics import accuracy_score<br>from sklearn.pipeline import Pipeline<br>from sklearn.utils import shuffle</p>\n<p>DECAF_IMAGENET_DIR = './imagenet/'<br>TRAIN_DATA_DIR = './data/'</p>\n<p>def get_dataset():<br> cat_dir = TRAIN_DATA_DIR + 'cat/'<br> cat_filenames = [cat_dir + fn for fn in os.listdir(cat_dir)]<br> dog_dir = TRAIN_DATA_DIR + 'dog/'<br> dog_filenames = [dog_dir + fn for fn in os.listdir(dog_dir)]</p>\n<p>labels = [0] * len(cat_filenames) + [1] * len(dog_filenames)<br> filenames = cat_filenames + dog_filenames<br> return shuffle(filenames, labels, random_state=0)</p>\n<p><br>def main():<br> convnet = ConvNetFeatures(<br> pretrained_params=DECAF_IMAGENET_DIR + 'imagenet.decafnet.epoch90',<br> pretrained_meta=DECAF_IMAGENET_DIR + 'imagenet.decafnet.meta',<br> )<br> clf = LogisticRegression()<br> pl = Pipeline([<br> ('convnet', convnet),<br> ('clf', clf),<br> ])</p>\n<p>X, y = get_dataset()<br> X_train, y_train = X[:100], y[:100]<br> X_test, y_test = X[100:300], y[100:300]</p>\n<p>print &quot;Fitting...&quot;<br> pl.fit(X_train, y_train)<br> print &quot;Predicting...&quot;<br> y_pred = pl.predict(X_test)<br> print &quot;Accuracy: %.3f&quot; % accuracy_score(y_test, y_pred)<br>main()</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37543,
      "postDate": "2014-01-17T22:12:35.803Z",
      "content": "<p>1.6.1.</p>\n<p>I checked my numpy directory dist-packages/numpy/core/, multiarray.so file actually is there. Just don't know why pickle.load can not locate this .so file.</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 37538,
      "postDate": "2014-01-17T21:09:04.363Z",
      "content": "<p>I ran the python codes (from the link http://pythonhosted.org/nolearn/convnet.html#example-dogs-vs-cats) on Ubuntu 12.04.4 and got below error message. I guess the issue was related to numpy on my Ubuntu. Any python expert has any thoughts ?</p>\n<p>&nbsp;</p>\n<p>root@ubuntu:~/test# python mydecaf.py<br>Fitting...<br>WARNING:root:decaf.util.pyvml: unable to load the mkl library. Using fallback options.<br>Traceback (most recent call last):</p>\n<p>File &quot;mydecaf.py&quot;, line 46, in &lt;module&gt;&nbsp;</p>\n<p>File &quot;mydecaf.py&quot;, line 42, in main</p>\n<p>pl.fit(X_train, y_train)<br>File &quot;/usr/local/lib/python2.7/dist-packages/sklearn/pipeline.py&quot;, line 130, in fit<br>Xt, fit_params = self._pre_transform(X, y, **fit_params)<br>File &quot;/usr/local/lib/python2.7/dist-packages/sklearn/pipeline.py&quot;, line 122, in _pre_transform<br>Xt = transform.fit(Xt, y, **fit_params_steps[name])&nbsp;</p>\n<p>File &quot;/usr/local/lib/python2.7/dist-packages/nolearn-0.4.1dev-py2.7.egg/nolearn/convnet.py&quot;, line 98, in fit&nbsp;self.pretrained_meta,<br>File &quot;/usr/local/lib/python2.7/dist-packages/decaf-0.9-py2.7.egg/decaf/scripts/imagenet.py&quot;, line 49, in __init__<br>meta = pickle.load(open(meta_file))<br>ImportError: No module named multiarray</p>"
    },
    {
      "id": 37514,
      "postDate": "2014-01-17T16:31:27.857Z",
      "content": "<p>A question: can&nbsp;DeCAF (which I understand is compulsory for nolearn.convnet.ConvNetFeature&nbsp;to work) be installed on a Windows 7 64-bit system? I've tried with Cygwin and MingW-w64 but it seems that g++ doesn't really like the syntax (-Wl parameter) required by the make process. Should I really turn to Linux to see it work? Thanks.</p>"
    },
    {
      "id": 37427,
      "postDate": "2014-01-15T22:34:00.543Z",
      "content": "<p>To find the example, follow the first link above.</p>\n<p>http://pythonhosted.org/nolearn/convnet.html#example-dogs-vs-cats</p>"
    },
    {
      "id": 37426,
      "postDate": "2014-01-15T22:31:54.847Z",
      "content": "<p>Great. I was working with nolearn convnet only but I didnt know that just 100 images can produce an accuracy of 94%. By the way, I'm unable to find the example you mentioned.</p>\n<p>EDIT: nevermind found it</p>"
    },
    {
      "id": 365213,
      "postDate": "2018-08-02T05:54:37.337Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 113980,
      "author_name": "PengfeiDu",
      "author_url": "",
      "post_date": "2016-04-06T16:14:43.490000",
      "content": "<p>Cannot find DecafNet files. How can I get the decaf_pretrained file  imagnet.decaf.epoch90</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 126752,
      "author_name": "apatti",
      "author_url": "",
      "post_date": "2016-07-12T05:25:54.923000",
      "content": "<p>Can someone help in finding Pretrained imagenet models? The link provided doesn't exist anymore.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37548,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-18T00:24:46.263000",
      "content": "<p>I believe the problem is that your numpy is too old. &nbsp;This might fix your issue:</p>\n<p>&nbsp; # pip install -U numpy</p>\n<p>Although I'd recommend against installing Python packages with pip system-wide because it's too easy to mess up your global install. &nbsp;Instead you could use a virtualenv, and then always use the &quot;python&quot; and &quot;pip&quot; commands from its &quot;bin/&quot; directory to run and install libs.</p>\n<h3>Quick install instructions for nolearn and decaf</h3>\n<p>&nbsp; $ git clone git@github.com:UCB-ICSI-Vision-Group/decaf-release.git</p>\n<p>&nbsp; $ cd decaf-release</p>\n<p>&nbsp; $ virtualenv . --system-site-packages</p>\n<p>&nbsp; $ bin/pip install -U numpy &nbsp;# if your system numpy is too old</p>\n<p>&nbsp; $ bin/pip install -U scipy &nbsp;# if your system scipy is too old</p>\n<p>&nbsp; $ bin/pip install -U Cython &nbsp;# if your system Cython is too old</p>\n<p>&nbsp; $ bin/python setup.py install &nbsp;# compile, install decaf; make sure it runs w/o errors</p>\n<p><span style=\"line-height: 1.4\">&nbsp; $ bin/pip install nolearn &nbsp;# install nolearn</span></p>\n<p>&nbsp; $ bin/python mydecaf.py &nbsp;# run your own script</p>\n<p>&nbsp;</p>",
      "votes": 5,
      "replies": []
    },
    {
      "id": 37923,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-25T17:06:58.450000",
      "content": "<p>[quote=stevenwudi;37921]</p>\n<p><span style=\"line-height: 1.4\">Though just one line of code, but I could not understand your cache mechanism. Can you brief enlighten me about the </span><em style=\"line-height: 1.4\"><strong>@cache.cached </strong></em><span style=\"line-height: 1.4\">&nbsp;purpose? Many thanks</span></p>\n<p><span style=\"line-height: 1.4\">[/quote]</span></p>\n<p><span style=\"line-height: 1.4\">Take a look at the <a href=\"http://pythonhosted.org/nolearn/cache.html\">nolearn.cache docs</a>, they explain what this is about.</span></p>\n<p>The gist is that computing features with decaf can be slow if you have a lot of examples. &nbsp;So you don't want to do the calculation every time you run the script, but cache the results between runs (if you're using the same parameters).</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37920,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-25T16:51:19.033000",
      "content": "<p>[quote=stevenwudi;37919]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>[/quote]</p>\n<p>So you've found a bug in the caching code of nolearn.convnet. &nbsp;I've pushed a quick fix; will make a proper release next week. &nbsp;For now you'll have the get the latest version from here:</p>\n<p>&nbsp; https://github.com/dnouri/nolearn</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>I checked out your personal website yesterday and like your works a lot.&nbsp;</p>\n<p>[/quote]</p>\n<p>Thanks :-)</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37899,
      "author_name": "charizard",
      "author_url": "",
      "post_date": "2014-01-25T03:45:49.407000",
      "content": "<p>It's&nbsp; a gcc issue on mac it seems , while installing decaf :</p>\n<p>python setup.py install</p>\n<p>make -C layers/cpp/g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cppclang: warning: argument unused during compilation: '-fopenmp'local_response_normalization.cpp:7:10: fatal error: 'omp.h' file not found#include &lt;omp.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>\n<p>^1 error generated.make[1]: ***</p>\n<p>[all] Error 1make: *** [all]</p>\n<p>Error 2Failed to build the C libraries; exiting</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37886,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-24T19:55:34.610000",
      "content": "<p>[quote=charizard;37884]</p>\n<p>Thanks for sharing <br>I tried this method , but I am not able to run my script</p>\n<p>Error: <br>ImportError: No module named decaf.scripts.imagenet</p>\n<p>[/quote]</p>\n<p>Have you followed the <a href=\"https://www.kaggle.com/c/dogs-vs-cats/forums/t/6845/example-use-decaf-via-nolearn-for-94-accuracy#post37548\">install instructions</a> that I posted? &nbsp;Because it seems you haven't run this command from within the decaf folder:</p>\n<p>&nbsp; $ bin/python setup.py install &nbsp;#&nbsp;compile, install decaf; make sure it runs w/o errors</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37748,
      "author_name": "Abhishek Thakur",
      "author_url": "",
      "post_date": "2014-01-22T18:33:47.503000",
      "content": "<p>Pip install pil</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37734,
      "author_name": "Luca Massaron",
      "author_url": "",
      "post_date": "2014-01-22T17:33:55.683000",
      "content": "<p>Unfortunately I couldn't manage to have it run on Windows (yet). It seems I have some not so well identified trouble with MPI, but I have to further investigate the matter. So, in the end, I made it run under Linux (on a virtual machine, I assure you, a very sloow experience!).</p>\n<p>As for as the problem mentioned by Steven,&nbsp;the pretrained netfile is in Unix format, so, Steven, you have to modify the code in such a fashion:</p>\n<p>cuda_decafnet = pickle.load(open(net_file,&quot;rb&quot;))</p>\n<p>The &quot;rb&quot; option will have Python to read smoothly the data. Please let me know if, after fixing that, your script runs well because I would like to ask you some information about your specific configuration and compiling procedures, then.</p>\n<p>&nbsp;</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37708,
      "author_name": "Alec Radford",
      "author_url": "",
      "post_date": "2014-01-22T03:40:20.117000",
      "content": "<p>0.09x is also possible with a regular non-conv neural net. I'd guess imagenet's features don't generalize too well to such a specific non-general purpose task. Also wouldn't using a system like that break the no outside data without public declaration/consent rule for galaxy zoo?</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37698,
      "author_name": "Abhishek Thakur",
      "author_url": "",
      "post_date": "2014-01-21T23:45:30.927000",
      "content": "<p>i tried decaf in galaxy zoo with random forest on top of it, but couldnt get a score of less than 0.15</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37697,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-21T23:43:46.537000",
      "content": "<p>[quote=Matt;37695]</p>\n<p>Ok, bear with me, I'll try to rephrase the question: How do the features generated from decaf and overfeat compare with each other regarding predictive power (e.g. have you tried to stick the same supervised learning algorithm on top of both and compared the results?).</p>\n<p>[/quote]</p>\n<p>Yes, you can use OverFeat pretty much the same way. &nbsp;OverFeat looks at multiple scales and sliding windows of the test image to extract features, which will give you more (and more powerful) features, at the expense of speed.</p>\n<p>Of course one could use multiple scales with decaf or caffe, too. &nbsp;That wouldn't be too hard to implement.</p>\n<p>[quote=Matt;37695]</p>\n<p>Furthermore, does it make sense to apply the feature extraction step in the galaxy zoo competition or do these model only perform so well because they were trained on a similar (but larger) training set (ImageNet)?</p>\n<p>[/quote]</p>\n<p>I'd say it's definitely worth a try to use decaf in the galaxy zoo competition. &nbsp;You would however want to extract features from maybe the second or the third layer, and possibly feed those features into a neural net. &nbsp;Then again, the galaxy zoo competition comes with plenty images for training (60k), so it might just work better to just train a convnet from scratch.</p>\n<p>If you try decaf with galaxy zoo, I'd be interested to hear how that goes.</p>\n<p>(I just saw that someone else had the <a href=\"https://www.kaggle.com/c/galaxy-zoo-the-galaxy-challenge/forums/t/6882/does-any-one-try-the-imagenet-model\">exact same question as you</a> in the galaxy zoo competition's forum.)</p>\n<p>&nbsp;</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37547,
      "author_name": "Bluefool",
      "author_url": "",
      "post_date": "2014-01-18T00:22:54.847000",
      "content": "<p>Delete numpy from the decaf egg. I had this error - it's looking for multiarray in decaf version of numpy.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37539,
      "author_name": "Matt",
      "author_url": "",
      "post_date": "2014-01-17T21:27:21.937000",
      "content": "<p><span style=\"line-height: 1.4\">[quote=orchid;37538]ImportError: No module named multiarray[/quote]</span></p>\n<p>&nbsp;</p>\n<p><span style=\"line-height: 1.4\">multiarray is part of numpy, which numpy version are you using?</span></p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 37706,
      "author_name": "Ryan Kiros",
      "author_url": "",
      "post_date": "2014-01-22T03:31:33.470000",
      "content": "<p>For galaxy, if I remember correctly second-last hidden layer of decaf trained with a neural net got me around 0.11. You can get 0.09x pretty easily with a convnet trained from scratch, so I don't expect decaf features to be competitive there.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 37515,
      "author_name": "Abhishek Thakur",
      "author_url": "",
      "post_date": "2014-01-17T16:35:13.407000",
      "content": "<p>remove that param from decaf/layers/Makefile and compile</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 365214,
      "author_name": "yhosoai",
      "author_url": "",
      "post_date": "2018-08-02T05:55:35.857000",
      "content": "<p>Looks like link to pre-trained model is now broken: <a href=\"http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/\">http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/</a>\nIt's showing github 404 page</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 59460,
      "author_name": "PengPai",
      "author_url": "",
      "post_date": "2014-12-03T13:57:38.050000",
      "content": "<p>[quote=stevenwudi;37747]</p>\n<p>[quote=Luca Massaron;37741]</p>\n<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>\n<p>[/quote]</p>\n<p>Hi Luca, for meta file, &quot;rb&quot; is not an issue, I used Anaconda and there is some conflicts (not sure why)</p>\n\n<p>So I used official Python2.7 and install packages from scratch and now it can read the files.</p>\n\n<p>But one more issue:&nbsp;</p>\n<p>&quot;</p>\n<p>in \\site-packages\\nolearn\\convent.py line 112, in transform</p>\n<p>import Images #soft dep</p>\n<p>ImportError: No module name Image&quot;</p>\n\n<p>So I am wondering what is module Image here. Sorry for the spam..</p>\n<p>[/quote]</p>\n\n<p>I have met the same problem. It is fortunate that I am familiar with the Library PIL. Check that you have installed the PIL. Then change the &quot;import Image&quot; into &quot;from PIL import Image&quot; and it works.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 59443,
      "author_name": "PengPai",
      "author_url": "",
      "post_date": "2014-12-03T05:43:32.283000",
      "content": "<p>[quote=charizard;37899]</p>\n<p>It's&nbsp; a gcc issue on mac it seems , while installing decaf :</p>\n<p>python setup.py install</p>\n<p>make -C layers/cpp/g++ -c -fPIC -O3 -Wall -ffast-math -msse -msse2 -fopenmp im2col.cpp fastpool.cpp local_response_normalization.cpp neuron.cppclang: warning: argument unused during compilation: '-fopenmp'local_response_normalization.cpp:7:10: fatal error: 'omp.h' file not found#include &lt;omp.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>\n<p>^1 error generated.make[1]: ***</p>\n<p>[all] Error 1make: *** [all]</p>\n<p>Error 2Failed to build the C libraries; exiting</p>\n<p>[/quote]</p>\n\n<p>I have met the same error on MAC OS. Can anyone give us a solution to such error? Thank you.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 38013,
      "author_name": "Fede",
      "author_url": "",
      "post_date": "2014-01-27T16:37:32.870000",
      "content": "<p>Hello everyone, this piece of code throws errors on Windows:</p>\n<p><code>try:<br>&nbsp; &nbsp; _DLL = np.ctypeslib.load_library('libcpputil.so',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;os.path.join(os.path.dirname(__file__)))<br>except Exception as error:<br>&nbsp; &nbsp; raise error</code></p>\n<p>&nbsp;</p>\n<p>It's inside wrapper.py</p>\n<p>&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37921,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-25T16:58:59.827000",
      "content": "<p>[quote=Daniel Nouri;37920]</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>[/quote]</p>\n<p>So you've found a bug in the caching code of nolearn.convnet. &nbsp;I've pushed a quick fix; will make a proper release next week. &nbsp;For now you'll have the get the latest version from here:</p>\n<p>&nbsp; https://github.com/dnouri/nolearn</p>\n<p>[quote=stevenwudi;37919]</p>\n<p>I checked out your personal website yesterday and like your works a lot.&nbsp;</p>\n<p>[/quote]</p>\n<p>Thanks :-)</p>\n<p>[/quote]</p>\n<p>&nbsp;</p>\n<p>Thanks Daniel, you are truly efficient! Now it works fine.</p>\n<p>Though just one line of code, but I could not understand your cache mechanism. Can you brief enlighten me about the <em><strong>@cache.cached </strong></em>&nbsp;purpose? Many thanks</p>\n<p>&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37919,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-25T16:44:27.283000",
      "content": "<p>[quote=Daniel Nouri;37917]</p>\n<p>[quote=stevenwudi;37916]</p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>\n<p>[/quote]</p>\n<p>&lt;strike&gt;The way you use KFold you're using only 20 examples for testing, which explains the discrepancy. &nbsp;Increase the number you use for testing and training, maybe by a factor of 10:&lt;/strike&gt;</p>\n<p>Woops, looks like I was wrong. &nbsp;I can reproduce your problem even with more examples. &nbsp;Will look into this soon.</p>\n<p>[/quote]</p>\n<p>HI Daniel, thank you for your answer, I used 1000 examples as well, rendering similar result for the 3rd and 4th fold, and normal accurarcy(95%) for the 1,2,5 fold. Quite bizarre for me to understand. And yes, I will read more thoroughly about your two recommendation links.</p>\n<p>I checked out your personal website yesterday and like your works a lot. (I used to use matlab, now much more convincing to use Python now.) And I do agree you pair-coding working style :)</p>\n<p>Best X</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37917,
      "author_name": "Daniel Nouri",
      "author_url": "",
      "post_date": "2014-01-25T16:37:21.050000",
      "content": "<p>[quote=stevenwudi;37916]</p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>\n<p>[/quote]</p>\n<p>&lt;strike&gt;The way you use KFold you're using only 20 examples for testing, which explains the discrepancy. &nbsp;Increase the number you use for testing and training, maybe by a factor of 10:&lt;/strike&gt;</p>\n<p>Woops, looks like I was wrong. &nbsp;I can reproduce your problem even with more examples. &nbsp;Looking into this right now.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37916,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-25T16:14:09.883000",
      "content": "<p>Hi, I have encounter some problems in cross-validation (I am new to explore the sklearn):</p>\n<p>I used nolearn and cv: as</p>\n<p>&lt;pre&gt; X_train, y_train = X[:100], y[:100]<br> #X_test, y_test = X[500:1000], y[500:1000]</p>\n<p># Simple K-Fold cross validation. 5 folds.<br> cv = cross_validation.KFold(len(X_train), n_folds=5, indices=True)</p>\n<p>for traincv, testcv in cv:<br> print &quot;Fitting...&quot;<br> pl.fit(X_train[traincv], y_train[traincv])<br> print &quot;Predicting...&quot;<br> y_pred = pl.predict(X_train[testcv])<br> print &quot;Accuracy: %.3f&quot; % accuracy_score(y_train[testcv], y_pred)</p>\n<p>&lt;/pre&gt;</p>\n<p>the output is</p>\n<p>&lt;pre&gt;</p>\n<p>0.9</p>\n<p>0.9</p>\n<p>0.36</p>\n<p>0.45</p>\n<p>1.0</p>\n<p><span style=\"line-height: 1.4\">&lt;/pre&gt;</span></p>\n<p><span style=\"line-height: 1.4\">No idea why such great discrepancies in accuracy: is there some thing fundamentally wrong in my code?</span></p>\n<p><span style=\"line-height: 1.4\">Thank you for your illumination. (P.S. sklearn seems awesome and neat!)</span></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37884,
      "author_name": "charizard",
      "author_url": "",
      "post_date": "2014-01-24T19:12:43.023000",
      "content": "<p>Thanks for sharing <br>I tried this method , but I am not able to run my script</p>\n<p>Error: <br>ImportError: No module named decaf.scripts.imagenet</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37774,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-23T01:10:03.107000",
      "content": "<p>[quote=Luca Massaron;37734]</p>\n<p>Unfortunately I couldn't manage to have it run on Windows (yet). It seems I have some not so well identified trouble with MPI, but I have to further investigate the matter. So, in the end, I made it run under Linux (on a virtual machine, I assure you, a very sloow experience!).</p>\n<p>As for as the problem mentioned by Steven,&nbsp;the pretrained netfile is in Unix format, so, Steven, you have to modify the code in such a fashion:</p>\n<p>cuda_decafnet = pickle.load(open(net_file,&quot;rb&quot;))</p>\n<p>The &quot;rb&quot; option will have Python to read smoothly the data. Please let me know if, after fixing that, your script runs well because I would like to ask you some information about your specific configuration and compiling procedures, then.</p>\n<p>&nbsp;</p>\n<p>[/quote]</p>\n<p>&nbsp;</p>\n<p>Hey, Luca. Finally I am able to run the code and have the 93% accuracy. I have scribble a blog here:http://vision.group.shef.ac.uk/wordpress/?p=93</p>\n<p>Apologies if anything unclear. Too late now, need to sleep...</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37769,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-22T22:48:14.980000",
      "content": "<p>I finally got the code running under Windows Visual Studio environment. However, when I run some simple demo like:</p>\n<p>&quot;</p>\n<p><em><strong>scores = net.classify(img)</strong></em></p>\n<p>&quot;</p>\n<p>It just kept running without any output. And I checked the python code, for<em><strong> base.py,&nbsp;</strong>&nbsp;<strong>Class Layer</strong>,&nbsp;<strong>def predict</strong></em> method, the predict method says&nbsp;</p>\n<p><em> &quot;&quot;&quot;A wrapper function to do prediction. If a layer has different</em><br><em> behaviors during training and testing, one can write a predict()</em><br><em> function which is called during testing time.</em><br> <br><em> In default, the predict() function will simply call forward.</em><br><em> &quot;&quot;&quot;</em></p>\n<p><em>Not sure why the code just keeps running... ( I compiled the cpp code in the layer folder using Cygwin, not sure whether it is relevant)&nbsp;</em></p>\n<p>&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37747,
      "author_name": "stevenwudi",
      "author_url": "",
      "post_date": "2014-01-22T18:31:28.623000",
      "content": "<p>[quote=Luca Massaron;37741]</p>\n<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>\n<p>[/quote]</p>\n<p>Hi Luca, for meta file, &quot;rb&quot; is not an issue, I used Anaconda and there is some conflicts (not sure why)</p>\n<p>&nbsp;</p>\n<p>So I used official Python2.7 and install packages from scratch and now it can read the files.</p>\n<p>&nbsp;</p>\n<p>But one more issue:&nbsp;</p>\n<p>&quot;</p>\n<p>in \\site-packages\\nolearn\\convent.py line 112, in transform</p>\n<p>import Images #soft dep</p>\n<p>ImportError: No module name Image&quot;</p>\n<p>&nbsp;</p>\n<p>So I am wondering what is module Image here. Sorry for the spam..</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37741,
      "author_name": "Luca Massaron",
      "author_url": "",
      "post_date": "2014-01-22T18:00:57.713000",
      "content": "<p>It seems the same problem as before:</p>\n<p>line 52:&nbsp;self.label_names = meta['label_names']</p>\n<p>so let's look for meta...</p>\n<p>line 45:&nbsp;meta = pickle.load(open(meta_file))</p>\n<p>please try to modify also this into:</p>\n<p>meta = pickle.load(open(meta_file,&quot;rb&quot;))</p>\n<p>Does it work?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37736,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-22T17:50:12.037000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37729,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-22T17:00:51.837000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37728,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-22T16:51:32.040000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37703,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-22T02:36:07.947000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37699,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-21T23:48:17.773000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37695,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-21T22:44:07.897000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37691,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-21T20:36:10.370000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37685,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-21T18:24:17.380000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37603,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-19T12:27:49.247000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37598,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-19T08:02:33.500000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37546,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-17T23:59:35.410000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37543,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-17T22:12:35.803000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37538,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-17T21:09:04.363000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37514,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-17T16:31:27.857000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37427,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-15T22:34:00.543000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 37426,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-01-15T22:31:54.847000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 365213,
      "author_name": "",
      "author_url": "",
      "post_date": "2018-08-02T05:54:37.337000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "37424": "",
    "113980": "Cannot find DecafNet files. How can I get the decaf_pretrained file  imagnet.decaf.epoch90",
    "126752": "Can someone help in finding Pretrained imagenet models? The link provided doesn't exist anymore.",
    "37548": "",
    "37923": "",
    "37920": "",
    "37899": "",
    "37886": "",
    "37748": "",
    "37734": "",
    "37708": "",
    "37698": "",
    "37697": "",
    "37547": "",
    "37539": "",
    "37706": "",
    "37515": "",
    "365214": "Looks like link to pre-trained model is now broken: http://www.eecs.berkeley.edu/~jiayq/decaf_pretrained/\nIt's showing github 404 page",
    "59460": "",
    "59443": "",
    "38013": "",
    "37921": "",
    "37919": "",
    "37917": "",
    "37916": "",
    "37884": "",
    "37774": "",
    "37769": "",
    "37747": "",
    "37741": "",
    "37736": "",
    "37729": "",
    "37728": "",
    "37703": "",
    "37699": "",
    "37695": "",
    "37691": "",
    "37685": "",
    "37603": "",
    "37598": "",
    "37546": "",
    "37543": "",
    "37538": "",
    "37514": "",
    "37427": "",
    "37426": "",
    "365213": ""
  }
}