Introduction to TIDL Jupyter notebooks examples
Example Jupyter notebooks help to quickly runs analytics demos, on C7x MMA DSP, from different open source frameworks. Example notebooks contain OOB demos and custom model notebooks. OOB notebooks demos show how to run inference in a selected model from a list of options. OOB notebooks showcase main frameworks APIs for running inferece, gives an example of pre and post-processing funtions, and report back performance metrics.
On the other hand, custom models, take a pre-trained classification model and compile it using one of the framework compilers to generate deployable artifacts, which can be run on the target by using frameworks inference APIs.
Analytics OOB demos and frameworks covered:
- Image Classification TFLite
- Image Classification ONNX
- Image Classification DLR
- Image Detection TFLITE
- Image Detection DLR
- Image Segmentation TFlite
- Image Segmentation ONNX
- Image Segmenatoin DLR
Custom model notebook examples:
- custom-model-onnx.ipynb
- custom-model-tfl.ipynb
- custom-model-tvm-dlr.ipynb
Requirements
In your computer:
- Download jacinto-ai-benchmark
- Download jacinto-ai-modelzo
Changes to work via NFS
- sudo apt-get install nfs-kernel-server
- Edit or create file /etc/exports and add below line (please change path to the path in which you have installed PSDK RTOS)
- /home/alice/ti/ *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
In your EVM:
- Connect to your EVM
- Install required packages via pip:
- pip3 install pillow
- pip3 install pycocotools
- pip3 install colorama
- pip3 install tqdm
- pip3 install pyyaml
- pip3 install pytest
- pip3 install notebook
- pip3 install ipywidgets
- Mount your workdir in /mnt
- ex: mount {your_pc_ipaddr}:/home/alice/ti /mnt
- Move to jacinto-ai-benchmark
- Install jacinto-ai-benchmark as a local module
- Move to TIDL root path
- ex: cd {PSDK_RTOS}/tidl_j7_xx_xx_xx_xx/ti_dl/test/notebooks
- Create a "prebuilt-models" softlink to models + prebuild artifacts
- ex: ln -s /mnt/jacinto-ai-benchmark/work_dirs/ prebuilt-models
- Inside /ti_dl/test/notebooks/setup.sh modify paths acordingly and run script
- ex: source /mnt/ti-processor-sdk-rtos-j721e-evm-07_03_00_02/tidl_j7_02_00_00_03/ti_dl/test/notebooks/setup.sh
- Move to TIDL
- ex: cd /mnt/ti-processor-sdk-rtos-j721e-evm-xx_xx_xx_xx/tidl_j7_xx_xx_xx_xx/ti_dl/test/notebooks
- Define shared libraries path
- export LD_LIBRARY_PATH=/usr/lib
- Note your EVM ipaddr
- Launch jupyter notebook
- jupyter notebook –allow-root –no-browser –ip=0.0.0.0
- If it is the first time, copy "token" from printed information in the EVM
Back to your computer:
- In a webbrowser open Jupiter notebook using EVM IP address and token
- Open any of the notebooks and run the cells