6 Star 7 Fork 8

DeepSpark/DeepSparkInference

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
majorli6 提交于 2024-05-29 16:10 . format markdown docs

YOLOv4

Description

YOLOv4 employs a two-step process, involving regression for bounding box positioning and classification for object categorization. it amalgamates past YOLO family research contributions with novel features like WRC, CSP, CmBN, SAT, Mish activation, Mosaic data augmentation, DropBlock regularization, and CIoU loss.

Setup

Install

# Install libGL
## CentOS
yum install -y mesa-libGL
## Ubuntu
apt install -y libgl1-mesa-dev

pip3 install tqdm
pip3 install onnx
pip3 install onnxsim
pip3 install pycocotools

Download

Pretrained cfg: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4.cfg Pretrained model: https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights

Dataset: http://images.cocodataset.org/zips/val2017.zip to download the validation dataset.

Model Conversion

# clone yolov4
git clone https://github.com/Tianxiaomo/pytorch-YOLOv4.git yolov4

# export onnx model
python3 export.py --cfg yolov4.cfg --weight yolov4.weights --output yolov4.onnx

# Use onnxsim optimize onnx model
onnxsim yolov4.onnx yolov4_opt.onnx

Inference

export DATASETS_DIR=/Path/to/coco/

FP16

# Accuracy
bash scripts/infer_yolov4_fp16_accuracy.sh
# Performance
bash scripts/infer_yolov4_fp16_performance.sh

INT8

# Accuracy
bash scripts/infer_yolov4_int8_accuracy.sh
# Performance
bash scripts/infer_yolov4_int8_performance.sh

Results

Model BatchSize Precision FPS MAP@0.5 MAP@0.5:0.95
yolov4 32 FP16 285.218 0.741 0.506
yolov4 32 INT8 413.320 0.721 0.463

Reference

DarkNet: https://github.com/AlexeyAB/darknet Pytorch-YOLOv4: https://github.com/Tianxiaomo/pytorch-YOLOv4

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/deep-spark/deepsparkinference.git
git@gitee.com:deep-spark/deepsparkinference.git
deep-spark
deepsparkinference
DeepSparkInference
master

搜索帮助

A270a887 8829481 3d7a4017 8829481