---
# System prepended metadata

title: TIDL readme
tags: [TEXAS INSTRUMENTS TDA4]

---

# TIDL readme

## edgeai-modelzoo
**註1.** edgeai-torchvision-master/torchvision/datasets/coco.py中沒import到cv2, 請自行加入

### 安裝

1. dowload https://github.com/TexasInstruments/edgeai-modelzoo
2. open terminal and cd edgeai-modelzoo-master/
3. run ./run_download_modelartifacts.sh # to download all model (onnx, tflite, tvmdir)
4. dowload https://github.com/TexasInstruments/edgeai-torchvision
5. edgeai-torchvision中的torchvision folder要改，不然會與原本pip中的package衝突 (如果原本就沒下載pytorch的torchvision則忽略)
6. cd /edgeai-torchvision-master
7. 創建環境 conda create --name your_conda_name python=3.7 (python版本為3.7以上)
8. run setup.sh (pytorch和dgeai-torchvision中的torchvision版本要對應)
--> 在setup.sh中更改torch==1.10.0+cuxxx (xxx為對應版本)

### training

***For coco***
1. 進入conda 或 pip 的環境 (e.g. conda activate tda4)
2. open edgeai-torchvision-master/run_edgeailite_segmentation.sh 找到 COCO 21 class Segmentation Training 範例, 更改--data_path的路徑為自己的coco data路徑、更改--gpus為當前電腦的gpuid, **更改--batch_size(太高會OOM, e.g. 3090+3060設32bz會OOM)**
***e.g.*** ![](https://i.imgur.com/KQEvVFW.png)
COCO data: https://cocodataset.org/#home
3. 參照 註1
4. cd /edgeai-torchvision-master and run run_edgeailite_segmentation.sh
5. training ...

***For cityscapes***
1. 進入conda 或 pip 的環境 (e.g. conda activate tda4)
2. open edgeai-torchvision-master/run_edgeailite_segmentation.sh 找到 Cityscapes Semantic Segmentation - Training with RegNetX800MF+FPNEdgeAILite 範例, 更改--data_path的路徑為自己的Cityscapes data路徑
***e.g.*** ![](https://i.imgur.com/nM74vGg.png)
Cityscapes data: https://www.cityscapes-dataset.com/
3. cd /edgeai-torchvision-master and run run_edgeailite_segmentation.sh
4. training ...

### inference

***For cityscapes***
1. 進入conda 或 pip 的環境 (e.g. conda activate tda4)
2. open edgeai-torchvision-master/run_edgeailite_segmentation.sh 找到 Validation - Cityscapes Semantic Segmentation - Inference with RegNetX+FPNEdgeAILite 範例, 更改--data_path的路徑為自己的Cityscapes data路徑, 更改--pretrained 為 training所訓練出來的pth路徑(默認./data/checkpoints/edgeailite/cityscapes_segmentation/2022-05-12_09-27-55_cityscapes_segmentation_fpn_aspp_regnetx800mf_edgeailite_resize768x384_traincrop768x384/training/model_best.pth)
3. cd /edgeai-torchvision-master and run run_edgeailite_segmentation.sh

## Build Vision Apps
**V4L2**
***For PC***
* copy tisdk-default-image-j7-evm.tar.xz and boot-j7-evm.tar.gz to your_dir/ti-processor-sdk-rtos-j721e-evm-08_02_00_05/psdk_rtos/scripts/
* run your_dir/ti-processor-sdk-rtos-j721e-evm-08_02_00_05/psdk_rtos/scripts/setup_psdk_rtos.sh
* In your_dir/ti-processor-sdk-rtos-j721e-evm-08_02_00_05/psdk_rtos/scripts/ copy all output folder to your_dir/ti-processor-sdk-rtos-j721e-evm-08_02_00_05/

**Important h file**
/home/mike/Desktop/docker-ti-tda4/share_home/ti-processor-sdk-rtos-j721e-evm-08_02_00_05/tiovx/include/TI/*


###### tags: `TEXAS INSTRUMENTS TDA4`