Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
099e6f5e
提交
099e6f5e
authored
6月 13, 2020
作者:
Glenn Jocher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--img-size stride-multiple verification
上级
4ba47b1b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
11 行增加
和
4 行删除
+11
-4
detect.py
detect.py
+1
-0
test.py
test.py
+1
-0
train.py
train.py
+1
-3
utils.py
utils/utils.py
+8
-1
没有找到文件。
detect.py
浏览文件 @
099e6f5e
...
@@ -156,6 +156,7 @@ if __name__ == '__main__':
...
@@ -156,6 +156,7 @@ if __name__ == '__main__':
parser
.
add_argument
(
'--agnostic-nms'
,
action
=
'store_true'
,
help
=
'class-agnostic NMS'
)
parser
.
add_argument
(
'--agnostic-nms'
,
action
=
'store_true'
,
help
=
'class-agnostic NMS'
)
parser
.
add_argument
(
'--augment'
,
action
=
'store_true'
,
help
=
'augmented inference'
)
parser
.
add_argument
(
'--augment'
,
action
=
'store_true'
,
help
=
'augmented inference'
)
opt
=
parser
.
parse_args
()
opt
=
parser
.
parse_args
()
opt
.
img_size
=
check_img_size
(
opt
.
img_size
)
print
(
opt
)
print
(
opt
)
with
torch
.
no_grad
():
with
torch
.
no_grad
():
...
...
test.py
浏览文件 @
099e6f5e
...
@@ -245,6 +245,7 @@ if __name__ == '__main__':
...
@@ -245,6 +245,7 @@ if __name__ == '__main__':
parser
.
add_argument
(
'--augment'
,
action
=
'store_true'
,
help
=
'augmented inference'
)
parser
.
add_argument
(
'--augment'
,
action
=
'store_true'
,
help
=
'augmented inference'
)
parser
.
add_argument
(
'--verbose'
,
action
=
'store_true'
,
help
=
'report mAP by class'
)
parser
.
add_argument
(
'--verbose'
,
action
=
'store_true'
,
help
=
'report mAP by class'
)
opt
=
parser
.
parse_args
()
opt
=
parser
.
parse_args
()
opt
.
img_size
=
check_img_size
(
opt
.
img_size
)
opt
.
save_json
=
opt
.
save_json
or
opt
.
data
.
endswith
(
'coco.yaml'
)
opt
.
save_json
=
opt
.
save_json
or
opt
.
data
.
endswith
(
'coco.yaml'
)
opt
.
data
=
glob
.
glob
(
'./**/'
+
opt
.
data
,
recursive
=
True
)[
0
]
# find file
opt
.
data
=
glob
.
glob
(
'./**/'
+
opt
.
data
,
recursive
=
True
)[
0
]
# find file
print
(
opt
)
print
(
opt
)
...
...
train.py
浏览文件 @
099e6f5e
...
@@ -80,9 +80,7 @@ def train(hyp):
...
@@ -80,9 +80,7 @@ def train(hyp):
# Image sizes
# Image sizes
gs
=
int
(
max
(
model
.
stride
))
# grid size (max stride)
gs
=
int
(
max
(
model
.
stride
))
# grid size (max stride)
if
any
(
x
%
gs
!=
0
for
x
in
opt
.
img_size
):
imgsz
,
imgsz_test
=
[
check_img_size
(
x
,
gs
)
for
x
in
opt
.
img_size
]
# verify imgsz are gs-multiples
print
(
'WARNING: --img-size
%
g,
%
g must be multiple of
%
s max stride
%
g'
%
(
*
opt
.
img_size
,
opt
.
cfg
,
gs
))
imgsz
,
imgsz_test
=
[
make_divisible
(
x
,
gs
)
for
x
in
opt
.
img_size
]
# image sizes (train, test)
# Optimizer
# Optimizer
nbs
=
64
# nominal batch size
nbs
=
64
# nominal batch size
...
...
utils/utils.py
浏览文件 @
099e6f5e
...
@@ -37,13 +37,20 @@ def init_seeds(seed=0):
...
@@ -37,13 +37,20 @@ def init_seeds(seed=0):
def
check_git_status
():
def
check_git_status
():
# Suggest 'git pull' if repo is out of date
if
platform
in
[
'linux'
,
'darwin'
]:
if
platform
in
[
'linux'
,
'darwin'
]:
# Suggest 'git pull' if repo is out of date
s
=
subprocess
.
check_output
(
'if [ -d .git ]; then git fetch && git status -uno; fi'
,
shell
=
True
)
.
decode
(
'utf-8'
)
s
=
subprocess
.
check_output
(
'if [ -d .git ]; then git fetch && git status -uno; fi'
,
shell
=
True
)
.
decode
(
'utf-8'
)
if
'Your branch is behind'
in
s
:
if
'Your branch is behind'
in
s
:
print
(
s
[
s
.
find
(
'Your branch is behind'
):
s
.
find
(
'
\n\n
'
)]
+
'
\n
'
)
print
(
s
[
s
.
find
(
'Your branch is behind'
):
s
.
find
(
'
\n\n
'
)]
+
'
\n
'
)
def
check_img_size
(
img_size
,
s
=
32
):
# Verify img_size is a multiple of stride s
if
img_size
%
s
!=
0
:
print
(
'WARNING: --img-size
%
g must be multiple of max stride
%
g'
%
(
img_size
,
s
))
return
make_divisible
(
img_size
,
s
)
# nearest gs-multiple
def
make_divisible
(
x
,
divisor
):
def
make_divisible
(
x
,
divisor
):
# Returns x evenly divisble by divisor
# Returns x evenly divisble by divisor
return
math
.
ceil
(
x
/
divisor
)
*
divisor
return
math
.
ceil
(
x
/
divisor
)
*
divisor
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论