airockchip/rknn-toolkit2

Cannot load RKNN in jupyter-notebook

Opened this issue · 1 comments

Extending rockchip-linux/rknn-toolkit2#222

Here's the Proof of Concept (run all cells) - https://colab.research.google.com/drive/1X5KeI0TVZui0teakQantH8CW5OWYA8mx?usp=sharing

It would be super-useful if this worked - there's a solid volume of users who would like to train or convert an existing model, but don't have access to a dedicated piece of hardware (or the ability to set up a docker image locally).

The specific error - after installing...

Running

from rknn.api import RKNN

produces

/usr/local/lib/python3.10/dist-packages/rknn/api/__init__.py in <module>
----> 1 from rknn.api.rknn import RKNN

/usr/local/lib/python3.10/dist-packages/rknn/api/rknn.py in <module>
      5 from .rknn_log import set_log_level_and_file_path
      6 from .rknn_platform import get_host_os_platform, get_librknn_api_require_dll_dir
----> 7 from .rknn_base import RKNNBase
      8 from argparse import Namespace
      9 

/usr/local/lib/python3.10/dist-packages/rknn/api/rknn_base.cpython-310-x86_64-linux-gnu.so in init rknn.api.rknn_base()

/usr/local/lib/python3.10/dist-packages/rknn/api/graph_optimizer.cpython-310-x86_64-linux-gnu.so in init rknn.api.graph_optimizer()

NameError: name 'exit' is not defined

Quick bump up here - a similar issue exists with Kaggle:

/kaggle/working/2023RobotCode/zebROS_ws/src/tf_object_detection/src
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[13], line 3
      1 get_ipython().run_line_magic('cd', '/kaggle/working/2023RobotCode/zebROS_ws/src/tf_object_detection/src')
----> 3 from rknn.api import RKNN
      5 DEFAULT_RKNN_PATH = './frc900-obj-detect-2023.rknn'
      7 # Create RKNN object

File /opt/conda/lib/python3.10/site-packages/rknn/api/__init__.py:1
----> 1 from rknn.api.rknn import RKNN

File /opt/conda/lib/python3.10/site-packages/rknn/api/rknn.py:7
      5 from .rknn_log import set_log_level_and_file_path
      6 from .rknn_platform import get_host_os_platform, get_librknn_api_require_dll_dir
----> 7 from .rknn_base import RKNNBase
      8 from argparse import Namespace
     10 already_imported = False

File rknn/api/rknn_base.py:24, in init rknn.api.rknn_base()

File rknn/api/graph_optimizer.py:1, in init rknn.api.graph_optimizer()

NameError: name 'exit' is not defined