Skip to content

Nanodet

Andreas Kugel edited this page Aug 8, 2023 · 3 revisions

Desktop tests

Follow https://github.com/RangiLyu/nanodet/blob/main/demo/demo-inference-with-pytorch.ipynb

Use checkpoint file nanodet_m.chkp (version 0.40 or 0.42) instead of .pth file.

Should work, can use plain Python if using cv2.imshow instead of Jupyter function. Note cv2.imshow requires window name as first parameter!

UnitV2 test

Setup

Notebook homedir is: /home/notebook

Model training

nanodet models can be trained as per instructions at https://github.com/RangiLyu/nanodet

E.g. for Yolo style training data use command like

python tools/train.py config/nanodet-plus-m_416-yolo-kiwi2.yml

Edit yml-File for location of training data, epochs and previous model

GPU recommendet!!!

Model conversion

NCNN

Training step results in Pytorch ckpt file. Convert to onnx format with nanodet tool like:

python tools/export_onnx.py --cfg_path config/nanodet-plus-m-1.5x_416.yml --model_path /home/kugel/Downloads/nanodet-plus-m-1.5x_416_checkpoint.ckpt

Then convert to ncnn format with ncnn tool like:

/tools/onnx/onnx2ncnn nanodet-m1_5x.onnx nanodet-plus_m_1.5x_416.param nanodet-plus_m_1.5x_416.bin

Clone this wiki locally