Cannot find custom operator when visualizing network.
When I tried to visualize the mask rcnn network, I used the script below:
import mxnet as mx
sym = mx.sym.load('rcnn1-symbol.json')
mx.viz.plot_network(symbol=sym, node_attrs={"shape": 'oval', "fixedsize": 'false'}).view()
But a error is reported:
/home/jiawenhe/workspace/mxnet/dmlc-core/include/dmlc/logging.h:308: [20:47:29] src/operator/custom/custom.cc:78: Check failed: Registry::Get()->Find(params.op_type) != nullptr Cannot find custom operator MaskOutput
Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN4dmlc15LogMessageFatalD1Ev+0x3c) [0x7f4e99987f2c]
[bt] (1) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN5mxnet2op6custom10AttrParserEPN4nnvm9NodeAttrsE+0xaac) [0x7f4e99a5658c]
[bt] (2) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN5mxnet17UpgradeJSON_ParseEN4nnvm5GraphE+0x330) [0x7f4e9b9e1cd0]
[bt] (3) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZNSt17_Function_handlerIFN4nnvm5GraphES1_EPS2_E9_M_invokeERKSt9_Any_dataS1_+0x11f) [0x7f4e9b9e538f]
[bt] (4) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN5mxnet18LoadLegacyJSONPassEN4nnvm5GraphE+0x333) [0x7f4e9b9df9c3]
[bt] (5) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZNSt17_Function_handlerIFN4nnvm5GraphES1_EPS2_E9_M_invokeERKSt9_Any_dataS1_+0x11f) [0x7f4e9b9e538f]
[bt] (6) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN4nnvm11ApplyPassesENS_5GraphERKSt6vectorISsSaISsEE+0x518) [0x7f4e9cf24448]
[bt] (7) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(_ZN4nnvm9ApplyPassENS_5GraphERKSs+0x8e) [0x7f4e9b7c46ae]
[bt] (8) /usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/libmxnet.so(MXSymbolCreateFromFile+0x469) [0x7f4e9b7be799]
[bt] (9) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f4ec7f07adc]
Traceback (most recent call last):
File "../visual_net.py", line 4, in <module>
sym = mx.sym.load('/home/jiawenhe/workspace/mx-maskrcnn/rcnn1-symbol.json')
File "/usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/symbol/symbol.py", line 2494, in load
check_call(_LIB.MXSymbolCreateFromFile(c_str(fname), ctypes.byref(handle)))
File "/usr/local/lib/python2.7/dist-packages/mxnet-0.12.0-py2.7.egg/mxnet/base.py", line 146, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [20:47:29] src/operator/custom/custom.cc:78: Check failed: Registry::Get()->Find(params.op_type) != nullptr Cannot find custom operator MaskOutput
This problem also occured with annother custom operator such as RPN, both RPN and MaskOutput are layers implemented by Python. How to fix this?
from rcnn.PY_OP import fpn_roi_pooling, proposal_fpn, mask_roi, mask_output
You need to import those custom ops before you visualize the network, otherwise it can't find them.
proposed labels: "Bug", "Python", "Visualization"
@LeonJWH can you confirm that you could fix this after @PhanTask 's suggestion?
We have open-sourced MXBoard which enables users to visualize MXNet data (including network structures) in TensorBoard. The current version on PyPI is 0.1.0rc3. You can either install from source or pip install. The GitHub site has rich examples and tutorials on installation and how to use it in MXNet. Could you try it and give us feedbacks? Thanks.
@eric-haibin-lin can this issue be closed. The issue has been answered by @PhanTask.