0

I'm trying to implement the Inception model on a Raspberry Pi using mxnet, and getting an error that I haven't been able to unravel: "unknown activation type".

I successfully installed opencv, mxnet, and all dependencies. I'm running a short python script which on line 19 calls a function from inception_predict which in turn calls (line 74) a prediction function (forward propagation) from mxnet. Mxnet then refers to a file called activation-in.h which on line 149 has a last, fatal error if it can't find the activation type (e.g., Relu, Tanh, etc) you sent in.

I looked at the layers in the model (visualized here) and all the activation functions appear to be Relu, which, I would have thought, would work fine.

Am I missing something easy?

[16:49:22] /usr/bin/incubator-mxnet/src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[16:49:22] /usr/bin/incubator-mxnet/src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
/usr/bin/incubator-mxnet/python/mxnet/module/base_module.py:67: UserWarning: Data provided by label_shapes don't match names specified by label_names ([] vs. ['softmax_label'])
  warnings.warn(msg)
Capturing
Predicting
pre-processed image in 0.22853398323059082
Traceback (most recent call last):
  File "camera_test.py", line 19, in <module>
    topn = inception_predict.predict_from_local_file(filename, N=5)
  File "/home/pi/inception_predict.py", line 74, in predict_from_local_file
    return predict(filename, mod, synsets, N)
  File "/home/pi/inception_predict.py", line 48, in predict
    prob = mod.get_outputs()[0].asnumpy()
  File "/usr/bin/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 1972, in asnumpy
    ctypes.c_size_t(data.size)))
  File "/usr/bin/incubator-mxnet/python/mxnet/base.py", line 252, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [16:49:24] /usr/bin/incubator-mxnet/src/operator/nn/./activation-inl.h:149: unknown activation type

Stack trace returned 9 entries:
[bt] (0) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(dmlc::StackTrace[abi:cxx11]()+0x38) [0x6ed769e0]
[bt] (1) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x30) [0x6ed77134]
[bt] (2) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(void mxnet::op::ActivationCompute<mshadow::cpu>(nnvm::NodeAttrs const&, mxnet::OpContext const&, std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob> > const&, std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType> > const&, std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob> > const&)+0x288) [0x6f19e0ac]
[bt] (3) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(mxnet::exec::FComputeExecutor::Run(mxnet::RunContext, bool)+0x68) [0x6ee3de84]
[bt] (4) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(+0x4bef54) [0x6ee44f54]
[bt] (5) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(mxnet::engine::ThreadedEngine::ExecuteOprBlock(mxnet::RunContext, mxnet::engine::OprBlock*)+0x3ec) [0x6ee2a800]
[bt] (6) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(std::_Function_handler<void (std::shared_ptr<dmlc::ManualEvent>), mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, bool)::{lambda()#1}::operator()() const::{lambda(std::shared_ptr<dmlc::ManualEvent>)#1}>::_M_invoke(std::_Any_data const&, std::shared_ptr<dmlc::ManualEvent>&&)+0xd4) [0x6ee2b0a0]
[bt] (7) /usr/bin/incubator-mxnet/python/mxnet/../../build/libmxnet.so(std::thread::_State_impl<std::_Bind_simple<std::function<void (std::shared_ptr<dmlc::ManualEvent>)> (std::shared_ptr<dmlc::ManualEvent>)> >::_M_run()+0x38) [0x6ee2ad28]
[bt] (8) /usr/lib/arm-linux-gnueabihf/libstdc++.so.6(+0x9c9dc) [0x6e1fb9dc]

There is also the following warning up front about name matching, but it doesn't seem fatal or even necessarily pertinent to having an unrecognized activation function:

  /usr/bin/incubator-mxnet/python/mxnet/module/base_module.py:67: UserWarning: Data provided by label_shapes don't match names specified by label_names ([] vs. ['softmax_label'])
DJP_123
  • 1
  • 1
  • Can you print the output of `sym.get_internals()` in `inception_predict` and see if there is any activation that the code is complaining about? Also which version of MXNet did you build for your RPi? – Sina Afrooze Aug 27 '18 at 20:46
  • Thanks Sina. I am using MXNET 1.3.0. Installed per instructions from Apache located [here](https://mxnet.incubator.apache.org/install/index.html?platform=Devices&language=Python&processor=CPU) which should yield have yielded 1.2.1. Also, I tried sym.get_internals() which yielded the list I put [here](https://github.com/djpetersen/pi-vision/blob/master/sym.get_internals). It gives the layer descriptions though not apparently the simple layer type names -- those are in the [model layer file](https://github.com/djpetersen/pi-vision/blob/master/inception_model_layers), they look vanilla so far. – DJP_123 Aug 27 '18 at 23:34
  • That's really bizarre. Does your code work fine on a non RPi build? – Sina Afrooze Sep 18 '18 at 02:02
  • Great question that I should have looked into sooner. So running it on a file on a Mac with python3.5 does, in fact, work. So the conclusion must be that something about my MXNet install on the RPi is incorrect? – DJP_123 Sep 24 '18 at 21:53
  • That is what the experiment suggests. Did you compile MXNet on the device or did you use the docker cross-platform build [here](http://mxnet.apache.org/install/index.html?platform=Devices&language=Python&processor=CPU). If you didn't use docker, do you mind trying that and see if that works? – Sina Afrooze Sep 25 '18 at 03:12
  • I had compiled MXNet on the device from source. Have been trying now to use the docker cross platform build, not yet successful as I'm getting some errors suggesting it's using the wrong arm architecture. – DJP_123 Sep 27 '18 at 15:34

0 Answers0