ceccocats / tkDNN

Deep neural network library and toolkit to do high performace inference on NVIDIA jetson platforms
GNU General Public License v2.0
718 stars 209 forks source link

how export weight for custom model (pytorch) #150

Closed xn1997 closed 3 years ago

xn1997 commented 3 years ago

I have successfully obtained the debug and layers folders for darknet according to the readme.md but how should I export the weight for pytorch? Is there a tutorial or example?

mive93 commented 3 years ago

Hi @xn1997 what do you mean? The weights are for tkDNN (which is in C++), not for pytorch.

xn1997 commented 3 years ago

Hi @xn1997 what do you mean? The weights are for tkDNN (which is in C++), not for pytorch.

sorry, I know how to translate the weight to .rt for tkDNN, but I don't know how to export the weights from pytorch. is there any example on how to get the weight (debug and layers folders) from pytorch model?

mive93 commented 3 years ago

Oh I get it now. Yeah, you can find 3 examples:

As you can see it's almost the same code, but it's a bit adapted to the type of layers of the net. Unfortunately we have not written yet a general exporter from PyTorch, but those examples should help.

xn1997 commented 3 years ago

Oh I get it now. Yeah, you can find 3 examples:

* for centernet here: https://github.com/sapienzadavide/CenterNet/blob/master/src/lib/models/exporter.py

* for mobilenet here: https://github.com/mive93/pytorch-ssd/blob/master/run_ssd_live_demo.py

* for shelfnet here: https://git.hipert.unimore.it/mverucchi/shelfnet/blob/citys_lw/ShelfNet18_realtime/export.py

As you can see it's almost the same code, but it's a bit adapted to the type of layers of the net. Unfortunately we have not written yet a general exporter from PyTorch, but those examples should help.

Thank you! : )

mive93 commented 3 years ago

Closing for now, feel free to reopen.