Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
27a4736e
Unverified
提交
27a4736e
authored
9月 16, 2021
作者:
Glenn Jocher
提交者:
GitHub
9月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix val.py study plot (#4831)
* Fix val.py study plot * call plot_val_study * Rename plot_study_txt to plot_val_study
上级
3beb871b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
6 行删除
+9
-6
plots.py
utils/plots.py
+7
-4
val.py
val.py
+2
-2
没有找到文件。
utils/plots.py
浏览文件 @
27a4736e
...
@@ -247,15 +247,16 @@ def plot_targets_txt(): # from utils.plots import *; plot_targets_txt()
...
@@ -247,15 +247,16 @@ def plot_targets_txt(): # from utils.plots import *; plot_targets_txt()
plt
.
savefig
(
'targets.jpg'
,
dpi
=
200
)
plt
.
savefig
(
'targets.jpg'
,
dpi
=
200
)
def
plot_study_txt
(
path
=
''
,
x
=
None
):
# from utils.plots import *; plot_study_txt()
def
plot_val_study
(
file
=
''
,
dir
=
''
,
x
=
None
):
# from utils.plots import *; plot_val_study()
# Plot study.txt generated by val.py
# Plot file=study.txt generated by val.py (or plot all study*.txt in dir)
save_dir
=
Path
(
file
)
.
parent
if
file
else
Path
(
dir
)
plot2
=
False
# plot additional results
plot2
=
False
# plot additional results
if
plot2
:
if
plot2
:
ax
=
plt
.
subplots
(
2
,
4
,
figsize
=
(
10
,
6
),
tight_layout
=
True
)[
1
]
.
ravel
()
ax
=
plt
.
subplots
(
2
,
4
,
figsize
=
(
10
,
6
),
tight_layout
=
True
)[
1
]
.
ravel
()
fig2
,
ax2
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
8
,
4
),
tight_layout
=
True
)
fig2
,
ax2
=
plt
.
subplots
(
1
,
1
,
figsize
=
(
8
,
4
),
tight_layout
=
True
)
# for f in [Path(path) / f'study_coco_{x}.txt' for x in ['yolov5s6', 'yolov5m6', 'yolov5l6', 'yolov5x6']]:
# for f in [Path(path) / f'study_coco_{x}.txt' for x in ['yolov5s6', 'yolov5m6', 'yolov5l6', 'yolov5x6']]:
for
f
in
sorted
(
Path
(
path
)
.
glob
(
'study*.txt'
)):
for
f
in
sorted
(
save_dir
.
glob
(
'study*.txt'
)):
y
=
np
.
loadtxt
(
f
,
dtype
=
np
.
float32
,
usecols
=
[
0
,
1
,
2
,
3
,
7
,
8
,
9
],
ndmin
=
2
)
.
T
y
=
np
.
loadtxt
(
f
,
dtype
=
np
.
float32
,
usecols
=
[
0
,
1
,
2
,
3
,
7
,
8
,
9
],
ndmin
=
2
)
.
T
x
=
np
.
arange
(
y
.
shape
[
1
])
if
x
is
None
else
np
.
array
(
x
)
x
=
np
.
arange
(
y
.
shape
[
1
])
if
x
is
None
else
np
.
array
(
x
)
if
plot2
:
if
plot2
:
...
@@ -278,7 +279,9 @@ def plot_study_txt(path='', x=None): # from utils.plots import *; plot_study_tx
...
@@ -278,7 +279,9 @@ def plot_study_txt(path='', x=None): # from utils.plots import *; plot_study_tx
ax2
.
set_xlabel
(
'GPU Speed (ms/img)'
)
ax2
.
set_xlabel
(
'GPU Speed (ms/img)'
)
ax2
.
set_ylabel
(
'COCO AP val'
)
ax2
.
set_ylabel
(
'COCO AP val'
)
ax2
.
legend
(
loc
=
'lower right'
)
ax2
.
legend
(
loc
=
'lower right'
)
plt
.
savefig
(
str
(
Path
(
path
)
.
name
)
+
'.png'
,
dpi
=
300
)
f
=
save_dir
/
'study.png'
print
(
f
'Saving {f}...'
)
plt
.
savefig
(
f
,
dpi
=
300
)
def
plot_labels
(
labels
,
names
=
(),
save_dir
=
Path
(
''
)):
def
plot_labels
(
labels
,
names
=
(),
save_dir
=
Path
(
''
)):
...
...
val.py
浏览文件 @
27a4736e
...
@@ -26,7 +26,7 @@ from utils.general import coco80_to_coco91_class, check_dataset, check_img_size,
...
@@ -26,7 +26,7 @@ from utils.general import coco80_to_coco91_class, check_dataset, check_img_size,
check_suffix
,
check_yaml
,
box_iou
,
non_max_suppression
,
scale_coords
,
xyxy2xywh
,
xywh2xyxy
,
set_logging
,
\
check_suffix
,
check_yaml
,
box_iou
,
non_max_suppression
,
scale_coords
,
xyxy2xywh
,
xywh2xyxy
,
set_logging
,
\
increment_path
,
colorstr
increment_path
,
colorstr
from
utils.metrics
import
ap_per_class
,
ConfusionMatrix
from
utils.metrics
import
ap_per_class
,
ConfusionMatrix
from
utils.plots
import
plot_images
,
output_to_target
,
plot_study_txt
from
utils.plots
import
output_to_target
,
plot_images
,
plot_val_study
from
utils.torch_utils
import
select_device
,
time_sync
from
utils.torch_utils
import
select_device
,
time_sync
from
utils.callbacks
import
Callbacks
from
utils.callbacks
import
Callbacks
...
@@ -348,7 +348,7 @@ def main(opt):
...
@@ -348,7 +348,7 @@ def main(opt):
y
.
append
(
r
+
t
)
# results and times
y
.
append
(
r
+
t
)
# results and times
np
.
savetxt
(
f
,
y
,
fmt
=
'
%10.4
g'
)
# save
np
.
savetxt
(
f
,
y
,
fmt
=
'
%10.4
g'
)
# save
os
.
system
(
'zip -r study.zip study_*.txt'
)
os
.
system
(
'zip -r study.zip study_*.txt'
)
plot_
study_txt
(
x
=
x
)
# plot
plot_
val_study
(
x
=
x
)
# plot
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论