Skip to content

Latest commit

 

History

History

yolov7

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

yolov7 PyTorch=>ONNX=>TensorRT

1.Reference

For more information, please refer this blog: https://blog.csdn.net/linghu8812/article/details/125741951?spm=1001.2014.3001.5501

2.Export ONNX Model

Use the following command to export onnx model: first download yolov7 models to folder weights,

git clone https://github.com/linghu8812/yolov7.git
cd yolov7
python export.py --weights ./weights/yolov7.pt --simplify --grid 

if you want to export onnx model with 1280 image size add --img-size in command:

python export.py --weights ./weights/yolov7-w6.pt --simplify --grid --img-size 1280

3.Build yolov7_trt Project

cd ../  # in project directory
mkdir build && cd build
cmake ..
make -j

4.Run yolov7_trt

  • inference with yolov7
cd ../../bin/
./tensorrt_inference yolov7 ../configs/yolov7/config.yaml ../samples/detection_segmentation

for model such as yolov7-w6 the config file is like this:

yolov7:
    onnx_file:     "../weights/yolov7-w6.onnx"
    engine_file:   "../weights/yolov7-w6.trt"
    labels_file:   "../configs/labels/coco.names"
    BATCH_SIZE:    1
    INPUT_CHANNEL: 3
    IMAGE_WIDTH:   1280
    IMAGE_HEIGHT:  1280
    obj_threshold: 0.4
    nms_threshold: 0.45
    agnostic:      False
    strides:       [8, 16, 32, 64]
    num_anchors:   [3,  3,  3,  3]

5.Results: