github下载yolov7,并解压
下载yolov7.pt
配置好需要的python环境
测试下
python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source yourvideo.mp4
笔记本GeForce RTX 3050 Mobile环境下,大概35fps
https://github.com/haroonshakeel/yolov7-object-tracking
下载代码并解压到yolov7-main目录下
运行测试
python detect_or_track.py --weights yolov7.pt --source video1.mp4 --view-img --track --show-fps
Pytorch to tenrrt
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt
python export.py --weights ./yolov7-tiny.pt --grid --end2end --simplify --topk-all 100 --iou-thres 0.65 --conf-thres 0.35 --img-size 640 640
git clone https://github.com/Linaom1214/tensorrt-python.git
python ./tensorrt-python/export.py -o yolov7-tiny.onnx -e yolov7-tiny-nms.trt -p fp16
运行起来大概100fps,需要安装tensorrt环境
注意,生成 engine 模型的过程必须在做推理的设备上运行。
python trt.py -e yolov7-tiny-nms.trt -o result.mp4 -v video1.mp4 --end2end