Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
9b7386f6
提交
9b7386f6
authored
6月 17, 2020
作者:
Alex Stoken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add save_dir arg to test.test, use arg as location for saving batch jpgs
上级
945307be
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
5 行删除
+7
-5
test.py
test.py
+5
-4
train.py
train.py
+2
-1
没有找到文件。
test.py
浏览文件 @
9b7386f6
...
@@ -20,7 +20,8 @@ def test(data,
...
@@ -20,7 +20,8 @@ def test(data,
model
=
None
,
model
=
None
,
dataloader
=
None
,
dataloader
=
None
,
fast
=
False
,
fast
=
False
,
verbose
=
False
):
verbose
=
False
,
save_dir
=
'.'
):
# Initialize/load model and set device
# Initialize/load model and set device
if
model
is
None
:
if
model
is
None
:
training
=
False
training
=
False
...
@@ -28,7 +29,7 @@ def test(data,
...
@@ -28,7 +29,7 @@ def test(data,
half
=
device
.
type
!=
'cpu'
# half precision only supported on CUDA
half
=
device
.
type
!=
'cpu'
# half precision only supported on CUDA
# Remove previous
# Remove previous
for
f
in
glob
.
glob
(
'
test_batch*.jpg'
):
for
f
in
glob
.
glob
(
f
'{save_dir}/
test_batch*.jpg'
):
os
.
remove
(
f
)
os
.
remove
(
f
)
# Load model
# Load model
...
@@ -177,9 +178,9 @@ def test(data,
...
@@ -177,9 +178,9 @@ def test(data,
# Plot images
# Plot images
if
batch_i
<
1
:
if
batch_i
<
1
:
f
=
'test_batch
%
g_gt.jpg'
%
batch_i
# filename
f
=
os
.
path
.
join
(
save_dir
,
'test_batch
%
g_gt.jpg'
%
batch_i
)
# filename
plot_images
(
img
,
targets
,
paths
,
f
,
names
)
# ground truth
plot_images
(
img
,
targets
,
paths
,
f
,
names
)
# ground truth
f
=
'test_batch
%
g_pred.jpg'
%
batch_i
f
=
os
.
path
.
join
(
save_dir
,
'test_batch
%
g_pred.jpg'
%
batch_i
)
plot_images
(
img
,
output_to_target
(
output
,
width
,
height
),
paths
,
f
,
names
)
# predictions
plot_images
(
img
,
output_to_target
(
output
,
width
,
height
),
paths
,
f
,
names
)
# predictions
# Compute statistics
# Compute statistics
...
...
train.py
浏览文件 @
9b7386f6
...
@@ -303,7 +303,8 @@ def train(hyp):
...
@@ -303,7 +303,8 @@ def train(hyp):
model
=
ema
.
ema
,
model
=
ema
.
ema
,
single_cls
=
opt
.
single_cls
,
single_cls
=
opt
.
single_cls
,
dataloader
=
testloader
,
dataloader
=
testloader
,
fast
=
epoch
<
epochs
/
2
)
fast
=
epoch
<
epochs
/
2
save_dir
=
log_dir
)
# Write
# Write
with
open
(
results_file
,
'a'
)
as
f
:
with
open
(
results_file
,
'a'
)
as
f
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论