python ./deploy/NCNN/export_torchscript.py \
--weights yolov6lite_s.pt \
--img 320 320 \
--batch 1
--weights
: The path of yolov6 model weights.--img
: Image size of model inputs.--batch
: Batch size of model inputs.--device
: Export device. Cuda device : 0 or 0,1,2,3 ... , CPU : cpu .
-
Download tools from PNNX
-
Unzip the
pnnx-YYYYMMDD-PLANTFORM.zip
and add thepnnx
to yourPATH
.Then run the following command to export ncnn model :
mkdir -p work_dir mv yolov6lite_s.torchscript work_dir cd work_dir pnnx yolov6lite_s.torchscript inputshape=[1,3,320,320]f32
You will get
yolov6lite_s.ncnn.bin
andyolov6lite_s.ncnn.param
inwork_dir
.If you want to try int8 quantization, you can get more information from here .
python3 deploy/NCNN/infer-ncnn-model.py \
data/images/image1.jpg \
work_dir/yolov6lite_s.ncnn.param \
work_dir/yolov6lite_s.ncnn.bin \
--img-size 320 320 \
--max-stride 64 \
--show
img
: The path of image you want to detect.param
: The NCNN param path.bin
: The NCNN bin path.--show
: Whether to show detection resulut.--out-dir
: The output path to save detection result.--img-size
: The image height and width for model input.--max-stride
: The yolov6 lite model max stride.
Notice!
If you want to try norm yolov6 model such as yolov6n/s/m/l
, you should add --max-stride 32
flags .