I am trying an MXNet tutorial mentioned at http://mxnet.io/tutorials/embedded/wine_detector.html (Section "Running the Model" on a raspberry pi3 using python3.4, specifically the script "inception_predict.py". I managed to fix a couple of issue but am getting stumped at this error:
>> import inception_predict
[23:43:37] src/nnvm/legacy_json_util.cc:190: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[23:43:37] src/nnvm/legacy_json_util.cc:198: Symbol successfully upgraded!>> predict_from_url("https://i.sstatic.net/VcX0e.jpg")
Traceback (most recent call last):
File "", line 1, in
NameError: name 'predict_from_url' is not defined
Function predict_from_url is defined in the imported file inception_predict.py (as mentioned in the tutorial) so why is python telling me it is not defined? What am I doing wrong?
The tutorial has a few errors that you need to fix to make it run:
add time to the import list in the inception_predict.py
... import cv2, os, urllib, time ...
use a URL that you can actually download directly (use your favorite image search engine to find ones)
call the full name function
inception_predict. predict_from_url("https://media.mnn.com/assets/images/2017/01/cow-in-pasture.jpg.838x0_q80.jpg")
After these small changes you will see something like this:
pre-processed image in 0.27312707901
MKL Build:20170209
forward pass in 0.131096124649
probability=0.784963, class=n02403003 ox
probability=0.099463, class=n03868242 oxcart
probability=0.035585, class=n03967562 plow, plough
probability=0.033620, class=n02415577 bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis
probability=0.015443, class=n02412080 ram, tup
[(0.78496253, 'n02403003 ox'), (0.09946309, 'n03868242 oxcart'), (0.035584591, 'n03967562 plow, plough'), (0.033620458, 'n02415577 bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis'), (0.015442736, 'n02412080 ram, tup')]