Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
50a98286
Unverified
提交
50a98286
authored
8月 30, 2021
作者:
Glenn Jocher
提交者:
GitHub
8月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DDP `torch.jit.trace()` `--sync-bn` fix (#4615)
* Remove assert * debug0 * trace=not opt.sync * sync to sync_bn fix * Cleanup
上级
bb5ebc29
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
6 行删除
+6
-6
train.py
train.py
+1
-2
__init__.py
utils/loggers/__init__.py
+5
-4
没有找到文件。
train.py
浏览文件 @
50a98286
...
...
@@ -333,7 +333,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
mem
=
f
'{torch.cuda.memory_reserved() / 1E9 if torch.cuda.is_available() else 0:.3g}G'
# (GB)
pbar
.
set_description
((
'
%10
s'
*
2
+
'
%10.4
g'
*
5
)
%
(
f
'{epoch}/{epochs - 1}'
,
mem
,
*
mloss
,
targets
.
shape
[
0
],
imgs
.
shape
[
-
1
]))
callbacks
.
on_train_batch_end
(
ni
,
model
,
imgs
,
targets
,
paths
,
plots
)
callbacks
.
on_train_batch_end
(
ni
,
model
,
imgs
,
targets
,
paths
,
plots
,
opt
.
sync_bn
)
# end batch ------------------------------------------------------------------------------------------------
# Scheduler
...
...
@@ -499,7 +499,6 @@ def main(opt):
assert
opt
.
batch_size
%
WORLD_SIZE
==
0
,
'--batch-size must be multiple of CUDA device count'
assert
not
opt
.
image_weights
,
'--image-weights argument is not compatible with DDP training'
assert
not
opt
.
evolve
,
'--evolve argument is not compatible with DDP training'
assert
not
opt
.
sync_bn
,
'--sync-bn known training issue, see https://github.com/ultralytics/yolov5/issues/3998'
torch
.
cuda
.
set_device
(
LOCAL_RANK
)
device
=
torch
.
device
(
'cuda'
,
LOCAL_RANK
)
dist
.
init_process_group
(
backend
=
"nccl"
if
dist
.
is_nccl_available
()
else
"gloo"
)
...
...
utils/loggers/__init__.py
浏览文件 @
50a98286
...
...
@@ -69,13 +69,14 @@ class Loggers():
if
self
.
wandb
:
self
.
wandb
.
log
({
"Labels"
:
[
wandb
.
Image
(
str
(
x
),
caption
=
x
.
name
)
for
x
in
paths
]})
def
on_train_batch_end
(
self
,
ni
,
model
,
imgs
,
targets
,
paths
,
plots
):
def
on_train_batch_end
(
self
,
ni
,
model
,
imgs
,
targets
,
paths
,
plots
,
sync_bn
):
# Callback runs on train batch end
if
plots
:
if
ni
==
0
:
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
'ignore'
)
# suppress jit trace warning
self
.
tb
.
add_graph
(
torch
.
jit
.
trace
(
de_parallel
(
model
),
imgs
[
0
:
1
],
strict
=
False
),
[])
if
not
sync_bn
:
# tb.add_graph() --sync known issue https://github.com/ultralytics/yolov5/issues/3754
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
'ignore'
)
# suppress jit trace warning
self
.
tb
.
add_graph
(
torch
.
jit
.
trace
(
de_parallel
(
model
),
imgs
[
0
:
1
],
strict
=
False
),
[])
if
ni
<
3
:
f
=
self
.
save_dir
/
f
'train_batch{ni}.jpg'
# filename
Thread
(
target
=
plot_images
,
args
=
(
imgs
,
targets
,
paths
,
f
),
daemon
=
True
)
.
start
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论