deepin-ocr/3rdparty/ncnn/tools/darknet
wangzhengyang 718c41634f feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试
2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程
3.重整权利声明文件,重整代码工程,确保最小化侵权风险

Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake
Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
2022-05-10 10:22:11 +08:00
..
CMakeLists.txt feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake 2022-05-10 10:22:11 +08:00
darknet2ncnn.cpp feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake 2022-05-10 10:22:11 +08:00
output.jpg feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake 2022-05-10 10:22:11 +08:00
README.md feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake 2022-05-10 10:22:11 +08:00

Darknet To NCNN Conversion Tools

This is a standalone darknet2ncnn converter without additional dependency.

Support yolov4, yolov4-tiny, yolov3, yolov3-tiny and enet-coco.cfg (EfficientNetB0-Yolov3).

Another conversion tool based on darknet can be found at: darknet2ncnn

Usage

Usage: darknet2ncnn [darknetcfg] [darknetweights] [ncnnparam] [ncnnbin] [merge_output]
        [darknetcfg]     .cfg file of input darknet model.
        [darknetweights] .weights file of input darknet model.
        [cnnparam]       .param file of output ncnn model.
        [ncnnbin]        .bin file of output ncnn model.
        [merge_output]   merge all output yolo layers into one, enabled by default.

Example

1. Convert yolov4-tiny cfg and weights

Download pre-trained yolov4-tiny.cfg and yolov4-tiny.weights or with your own trained weight.

Convert cfg and weights:

./darknet2ncnn yolov4-tiny.cfg yolov4-tiny.weights yolov4-tiny.param yolov4-tiny.bin 1

If succeeded, the output would be:

Loading cfg...
WARNING: The ignore_thresh=0.700000 of yolo0 is too high. An alternative value 0.25 is written instead.
WARNING: The ignore_thresh=0.700000 of yolo1 is too high. An alternative value 0.25 is written instead.
Loading weights...
Converting model...
83 layers, 91 blobs generated.
NOTE: The input of darknet uses: mean_vals=0 and norm_vals=1/255.f.
NOTE: Remember to use ncnnoptimize for better performance.

2. Optimize graphic

./ncnnoptimize yolov4-tiny.param yolov4-tiny.bin yolov4-tiny-opt.param yolov4-tiny-opt.bin 0

3. Test

build examples/yolov4.cpp and test with:

./yolov4 dog.jpg

The result will be:

How to run with benchncnn

Set 2=0.3 for Yolov3DetectionOutput layer.