Skip to content

convert pytorch trained yolo model to ncnn for Flexible deployment

License

Notifications You must be signed in to change notification settings

abeardear/ncnn-yolo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ncnn-yolo

convert pytorch trained yolo model to ncnn for Flexible deployment

Introduction

We use pytorch_0.2 to train our model, it's advantages are very flexible. Then we use PytorchConvert convert our model to ncnn.

ncnn is a high-performance neural network inference computing framework optimized for mobile platforms. With it, we can easily deploy deep learning algorithm models to the mobile platform.

workflow

  1. train yolov1 model, we use this reposity pytorch-YOLO-v1, attention, we must use ceil_mode=True when pooling is used.

  2. Convert model

  3. check the output is correct or not, write decoder in c/c++

how to

step1

cd pytorch-yolo-v1
python train.py

best.pth will produced in /pytorch-yolo-v1

step2

cd pytorchConvert/code
python run.py

converted model will in /pytorchConvert/ModelFiles/ResNet/

our model name is ResNet, because we use resnet50 as backbone, and I forget change class name, anyway, rename it to yolo1.param and yolo1.bin

step3

cd ncnn
mkdir build
cd build
cmake ..
make -j4

uncomment add_subdirectory(examples) in ncnn/CMakeLists.txt

cd build
cmake ..
make -j4

copy yolo1.param yolo1.bin to build/examples

cd build
cd examples
./xiong_yolo1 person.jpg

Hopeful results

About

convert pytorch trained yolo model to ncnn for Flexible deployment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published