TexasInstruments / edgeai-modelzoo

This repository has been moved. The new location is in https://github.com/TexasInstruments/edgeai-tensorlab
https://github.com/TexasInstruments/edgeai
Other
2 stars 0 forks source link

Question about prototxt file #8

Open BJ-ZhaoXiaoyang opened 2 years ago

BJ-ZhaoXiaoyang commented 2 years ago

Hello, I have a question about prototxt. I found that in the modelzoo, some models do not have prototxt files, as shown below:

image

while some models have prototxt files, as shown below:

image

When/where are prototxt files needed and when/where not needed? What is the relationship between the prototxt file and artifact file/ And How do I generate prototxt files for the Customer model?

I am looking forward for your reponse!

Thanks!

mathmanu commented 2 years ago

Classification models don't need the prototxt. Object detection models need the prototxt. Also some other models such as for keypoint detection and 3DOD also uses a similar mechanism as object detection - they also use prototxt.

BJ-ZhaoXiaoyang commented 2 years ago

Thanks for your response!! Thanks!

But I found that some tflite format object detection models also do not have prototxt, like delow:

image

Are prototxt files also related to the ONNX and tflite formats? And if my customer model is an object detection model, how can I generate the prototxt for the model? Is there some script for the generation?

Thanks!!!

mathmanu commented 2 years ago

If you check the object detection onnx models, there are several small operators at the end that effects the performance.

Actually the prototoxt is not needed, onnxruntime-tidl is able to offload only the supported layers to underlying TIDL and run it on DSP and run the remaining unsupported layers (at the end) on the ARM. But that will be slow. The prototxt is a mechanism to offload all those layers into a Detection Post Processing operator in TIDL.

If you check the .tflite models, most of them have already compacted those operators into a Detection Post Process layer. TIDL is able to understand this layer layer in tflite - hence prototxt is not needed.

But certain tflite models do not come with this compact operator - in that case the performance will be affected - and this case the prototxt will help to improve the performance.

BJ-ZhaoXiaoyang commented 2 years ago

Thank you very much for your detailed answer!!!

BJ-ZhaoXiaoyang commented 2 years ago

Hi mathmanu. I still want to ask, if my customer model is an object detection model, how can I generate the prototxt for the model? Is there some script for the generation?

Thanks!

mathmanu commented 2 years ago

This is how we are generating the prototxt: https://github.com/TexasInstruments/edgeai-mmdetection/blob/master/mmdet/utils/save_model.py

https://github.com/TexasInstruments/edgeai-mmdetection/blob/master/tools/deployment/pytorch2onnx.py#L144

BJ-ZhaoXiaoyang commented 2 years ago

Thanks a lot! You are very nice!

BeautyMess commented 1 year ago

@BJ-ZhaoXiaoyang Have you found some way to generate the prototxt? I want to generate it for NanoDet-Plus