yasenh / libtorch-yolov5

A LibTorch inference implementation of the yolov5
MIT License
376 stars 114 forks source link

How to debug? #43

Closed Jelly123456 closed 6 months ago

Jelly123456 commented 3 years ago

Hi, thanks for much for creating this repo and it is really awesome.

My question is how to debug with libtorch? Now I face the problem of "segmentation fault(core dumped)" after running the warm-up.

image

I tried to debug with VSCode, but I could not go deep into libtorch library.

Is it compulsory to use debug version of libtorch?

zhiqwang commented 3 years ago

Hi @Jelly123456

LibTorch is a subset of Python, if you only have some bugs in LibTorch backend, I think that one option is through the Python environment. Check here for more details.

If there is hard-to-debug error in one of your TorchScript models, you can use this flag to force everything to run using native Python. Since TorchScript (scripting and tracing) is disabled with this flag, you can use tools like pdb to debug the model code.