#!wget https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/jet.jpeg modeldir = 'mymodel/' modelname = 'mymodel.onnx' # Set TIDL_TOOLS you want to use # TIDL tools should be pre-installed from the command line # after cloning edgeai-tidl-tools and running source ./setup.sh # after setting SOC environment variable TIDL_TOOLS='/home/a0194920local/10_0/edgeai-tidl-tools/' #!wget https://git.ti.com/cgit/jacinto-ai/jacinto-ai-modelzoo/plain/models/vision/classification/imagenet1k/torchvision/resnet18_opset9.onnx !mkdir -p {modeldir} !cp jet.jpeg {modeldir} #!wget https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/car.jpeg #!mv car.jpeg {model_dir} Create config and in_data_list.txt files. These files contain the simulator configuration and a set of input images with their groundtruth. !mkdir -p {modeldir} with open(modeldir+"/config", "w") as myfile: myfile.write("perfSimConfig = "+ TIDL_TOOLS + "tidl_tools/device_config.cfg") #!echo "perfSimConfig = "+ TIDL_TOOLS + "tidl_tools/device_config.cfg" >> {modeldir}/config !echo "/home/a0194920local/colab-notebooks/{modeldir}/jet.jpeg 895" > {modeldir}/in_data_list.txt #!echo "/home/a0194920local/colab-notebooks/{modeldir}/car.jpeg 846" >> {modeldir}/in_data_list.txt #with open(modeldir+"in_data_list.txt", "a") as myfile: # myfile.write(TIDL_TOOLS + " {modeldir}/jet.jpeg 895") Model import/compilation to generate artifacts for model inference on device print("Compiling: ",modelname) !/home/a0194920local/10_0/edgeai-tidl-tools/tidl_tools/tidl_model_import.out {modeldir}/config --modelType 2 \ --inputNetFile {modelname} --outputNetFile {modeldir}/tidl_net.bin \ --outputParamsFile {modeldir}/tidl_io_buff --inDataNorm 1 \ --inMean 123.675 116.28 103.53 --inScale 0.017125 0.017507 0.017429 \ --inData {modeldir}/in_data_list.txt --inFileFormat 2 \ --tidlStatsTool /home/a0194920local/10_0/edgeai-tidl-tools/tidl_tools//PC_dsp_test_dl_algo.out \ --perfSimTool /home/a0194920local/10_0/edgeai-tidl-tools/tidl_tools/ti_cnnperfsim.out \ --graphVizTool /home/a0194920local/10_0/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser.out \ --inHeight 224 --inWidth 224 --inNumChannels 3 --numFrames 1 Compiling: mymodel.onnx ========================= [Model Compilation Started] ========================= Model compilation will perform the following stages: 1. Parsing 2. Graph Optimization 3. Quantization & Calibration 4. Memory Planning ============================== [Version Summary] ============================== ------------------------------------------------------------------------------- | TIDL Tools Version | 10_00_08_00 | ------------------------------------------------------------------------------- | C7x Firmware Version | 10_00_02_00 | ------------------------------------------------------------------------------- ONNX model (Proto) file : mymodel.onnx TIDL network file : mymodel//tidl_net.bin TIDL IO info file : mymodel//tidl_io_buff Current ONNX OpSet version : 11 ============================ [Optimization started] ============================ ----------------------------- Optimization Summary ----------------------------- -------------------------------------------------------------------------------- | Layer | Nodes before optimization | Nodes after optimization | -------------------------------------------------------------------------------- | TIDL_EltWiseLayer | 170 | 170 | | TIDL_ConcatLayer | 1 | 1 | | TIDL_ReLULayer | 269 | 0 | | TIDL_ResizeLayer | 34 | 38 | | TIDL_ConvolutionLayer | 307 | 307 | -------------------------------------------------------------------------------- =========================== [Optimization completed] =========================== -------- Running Calibration in Float Mode to Collect Tensor Statistics -------- [=============================================================================] 100 % ------------------ Fixed-point Calibration Iteration [1 / 1]: ------------------ [=============================================================================] 100 % ==================== [Quantization & Calibration Completed] ==================== ========================== [Memory Planning Started] ========================== ------------------------- Network Compiler Traces ------------------------------ Successful Memory Allocation Successful Workload Creation ========================= [Memory Planning Completed] ========================= [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored [TIDL Import] WARNING: TIDL does not use coordinate_transformation_mode attribute in Resize layer, it will be ignored ======================== Subgraph Compiled Successfully ========================