Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
acqpriwny1
Yolov5_PyTorch
Commits
8912bd9d
Commit
8912bd9d
authored
Jul 24, 2023
by
acqpriwny1
Browse files
Update README.md
parent
601eb81c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
README.md
README.md
+20
-5
No files found.
README.md
View file @
8912bd9d
# YOLOV5测试
## 1.模型介绍
...
...
@@ -80,7 +79,7 @@ python3 -m torch.distributed.run --nproc_per_node 4 train.py --batch 128 --data
其中--nproc_per_node参数代表卡的个数,--batch参数代表global batchsize的大小

## 推理测试
```
python detect.py --source 0 # webcam
...
...
@@ -97,15 +96,31 @@ detect.py 在各种来源上运行 YOLOv5 推论,从最新的 YOLOv5 版本中
python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/
Image(filename='runs/detect/exp/zidane.jpg', width=600)
```

将训练好的pt文件导入weight参数中即可,推理代码如下:
```
python3 val.py --data data/coco-v5.yaml --weights runs/train/exp12/weights/best.pt --device 0
```
##ONNX模型单张图片推理并导出
在export.py 中的 def parse_opt()函数修改:
```
修改 default=12
parser.add_argument('--simplify', action='store_true', help='ONNX: simplify model')
parser.add_argument('--opset', type=int, default=12, help='ONNX: opset version')
```
在yolov5目录下执行模型导出脚本
```
python export.py --weights yolov5s.pt --include onnx
```
用准备好的模型推理代码进行推理,并将结果输出为res.jpg:
```
#输入图片修改output, or_img = model.inference('Image00003.jpg')
## 准确率数据
python yolov5_detection.py
```

## 准确率
| 模型 | size(pixels) | map0.5:0.95 | map0.5 |
| :-----: | :------: | :---------: | :----: |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment