Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
30bc089c
Unverified
提交
30bc089c
authored
11月 10, 2021
作者:
Glenn Jocher
提交者:
GitHub
11月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update val.py `speed` and `study` tasks (#5608)
Accepts all arguments now by default resolving
https://github.com/ultralytics/yolov5/issues/5600
上级
61c50199
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
20 行删除
+21
-20
val.py
val.py
+21
-20
没有找到文件。
val.py
浏览文件 @
30bc089c
...
...
@@ -339,26 +339,27 @@ def main(opt):
LOGGER
.
info
(
f
'WARNING: confidence threshold {opt.conf_thres} >> 0.001 will produce invalid mAP values.'
)
run
(
**
vars
(
opt
))
elif
opt
.
task
==
'speed'
:
# speed benchmarks
# python val.py --task speed --data coco.yaml --batch 1 --weights yolov5n.pt yolov5s.pt...
for
w
in
opt
.
weights
if
isinstance
(
opt
.
weights
,
list
)
else
[
opt
.
weights
]:
run
(
opt
.
data
,
weights
=
w
,
batch_size
=
opt
.
batch_size
,
imgsz
=
opt
.
imgsz
,
conf_thres
=.
25
,
iou_thres
=.
45
,
device
=
opt
.
device
,
save_json
=
False
,
plots
=
False
)
elif
opt
.
task
==
'study'
:
# run over a range of settings and save/plot
# python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n.pt yolov5s.pt...
x
=
list
(
range
(
256
,
1536
+
128
,
128
))
# x axis (image sizes)
for
w
in
opt
.
weights
if
isinstance
(
opt
.
weights
,
list
)
else
[
opt
.
weights
]:
f
=
f
'study_{Path(opt.data).stem}_{Path(w).stem}.txt'
# filename to save to
y
=
[]
# y axis
for
i
in
x
:
# img-size
LOGGER
.
info
(
f
'
\n
Running {f} point {i}...'
)
r
,
_
,
t
=
run
(
opt
.
data
,
weights
=
w
,
batch_size
=
opt
.
batch_size
,
imgsz
=
i
,
conf_thres
=
opt
.
conf_thres
,
iou_thres
=
opt
.
iou_thres
,
device
=
opt
.
device
,
save_json
=
opt
.
save_json
,
plots
=
False
)
y
.
append
(
r
+
t
)
# results and times
np
.
savetxt
(
f
,
y
,
fmt
=
'
%10.4
g'
)
# save
os
.
system
(
'zip -r study.zip study_*.txt'
)
plot_val_study
(
x
=
x
)
# plot
else
:
weights
=
opt
.
weights
if
isinstance
(
opt
.
weights
,
list
)
else
[
opt
.
weights
]
opt
.
half
=
True
# FP16 for fastest results
if
opt
.
task
==
'speed'
:
# speed benchmarks
# python val.py --task speed --data coco.yaml --batch 1 --weights yolov5n.pt yolov5s.pt...
opt
.
conf_thres
,
opt
.
iou_thres
,
opt
.
save_json
=
0.25
,
0.45
,
False
for
opt
.
weights
in
weights
:
run
(
**
vars
(
opt
),
plots
=
False
)
elif
opt
.
task
==
'study'
:
# speed vs mAP benchmarks
# python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5n.pt yolov5s.pt...
for
opt
.
weights
in
weights
:
f
=
f
'study_{Path(opt.data).stem}_{Path(opt.weights).stem}.txt'
# filename to save to
x
,
y
=
list
(
range
(
256
,
1536
+
128
,
128
)),
[]
# x axis (image sizes), y axis
for
opt
.
imgsz
in
x
:
# img-size
LOGGER
.
info
(
f
'
\n
Running {f} --imgsz {opt.imgsz}...'
)
r
,
_
,
t
=
run
(
**
vars
(
opt
),
plots
=
False
)
y
.
append
(
r
+
t
)
# results and times
np
.
savetxt
(
f
,
y
,
fmt
=
'
%10.4
g'
)
# save
os
.
system
(
'zip -r study.zip study_*.txt'
)
plot_val_study
(
x
=
x
)
# plot
if
__name__
==
"__main__"
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论