dusty-nv / jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
https://developer.nvidia.com/embedded/twodaystoademo
MIT License
7.72k stars 2.97k forks source link

ssd-mobilenetv2 takes some time. #1644

Open DigeSegun opened 1 year ago

DigeSegun commented 1 year ago

@dusty-nv Every time I run detectnet it takes forever to start running because I think ssd-mobilenetv2 is trying to load. Even though I have ran the script many times it still takes forever to load. Is there a reason or fix to get out of the long wait time

dusty-nv commented 1 year ago

Hi @DigeSegun, the first time a new model is loaded (or when that model has changed), TensorRT optimizes the model and saves the optimized engine to disk. It should then start up quickly the next time. After the program runs, does it save a .engine file in your model's folder?

DigeSegun commented 1 year ago

@dusty-nv I don't believe it saves an .engine file. How long goes optimization usually take I've ran the script all the way through multiple times

DigeSegun commented 1 year ago

@dusty-nv [TRT] network profiling complete, saving engine cache to /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.1.1.8201.GPU.FP16.engine

[TRT] failed to open engine cache file for writing /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.1.1.8201.GPU.FP16.engine

dusty-nv commented 1 year ago

[TRT] failed to open engine cache file for writing /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.1.1.8201.GPU.FP16.engine

Are you running the jetson-inference container? If not, did you run sudo make install when you built jetson-inference from source?

You might want to try: sudo chown -R $USER /usr/local/bin/networks

DigeSegun commented 1 year ago

@dusty-nv I am running from source and I believe I did do a sudo make install. I just tried the sudo chown command and this is my output now

[TRT] failed to open engine cache file for writing /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.1.1.8201.GPU.FP16.engine [TRT] device GPU, completed saving engine cache to /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.1.1.8201.GPU.FP16.engine [TRT] saving model checksum to /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.sha256sum [TRT] sha256sum /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff | awk '{print $1}' > /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.sha256sum [TRT] failed to save model checksum to /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.sha256sum [TRT] device GPU, loaded /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff

dusty-nv commented 1 year ago

failed to save model checksum to /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff.sha256sum

I'm not sure why it was able to save your .engine file to this same folder, but not the checksum (it uses the checksum to determine when the model has changed). If there is already a .sha256sum file there, try deleting it and check the write permissions of that folder again.

Alternatively, you could just comment out lines 1683-1705 of this file:

https://github.com/dusty-nv/jetson-inference/blob/bd4098c7a3c9ea5d912356a3cc02409421cf3c15/c/tensorNet.cpp#L1683

then re-run make && sudo make install

DigeSegun commented 1 year ago

@dusty-nv So I uncommented the code and it works well now