Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
e77c77f5
Unverified
提交
e77c77f5
authored
1月 07, 2021
作者:
Glenn Jocher
提交者:
GitHub
1月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check_requirements() (#1853)
* Add check_requirements() * add import * parameterize filename * add to detect, test
上级
135ec5c5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
16 行增加
和
5 行删除
+16
-5
detect.py
detect.py
+3
-2
test.py
test.py
+3
-2
train.py
train.py
+2
-1
general.py
utils/general.py
+8
-0
没有找到文件。
detect.py
浏览文件 @
e77c77f5
...
@@ -9,8 +9,8 @@ from numpy import random
...
@@ -9,8 +9,8 @@ from numpy import random
from
models.experimental
import
attempt_load
from
models.experimental
import
attempt_load
from
utils.datasets
import
LoadStreams
,
LoadImages
from
utils.datasets
import
LoadStreams
,
LoadImages
from
utils.general
import
check_img_size
,
non_max_suppression
,
apply_classifier
,
scale_coords
,
xyxy2xywh
,
\
from
utils.general
import
check_img_size
,
check_requirements
,
non_max_suppression
,
apply_classifier
,
scale_coords
,
\
strip_optimizer
,
set_logging
,
increment_path
xyxy2xywh
,
strip_optimizer
,
set_logging
,
increment_path
from
utils.plots
import
plot_one_box
from
utils.plots
import
plot_one_box
from
utils.torch_utils
import
select_device
,
load_classifier
,
time_synchronized
from
utils.torch_utils
import
select_device
,
load_classifier
,
time_synchronized
...
@@ -162,6 +162,7 @@ if __name__ == '__main__':
...
@@ -162,6 +162,7 @@ if __name__ == '__main__':
parser
.
add_argument
(
'--exist-ok'
,
action
=
'store_true'
,
help
=
'existing project/name ok, do not increment'
)
parser
.
add_argument
(
'--exist-ok'
,
action
=
'store_true'
,
help
=
'existing project/name ok, do not increment'
)
opt
=
parser
.
parse_args
()
opt
=
parser
.
parse_args
()
print
(
opt
)
print
(
opt
)
check_requirements
()
with
torch
.
no_grad
():
with
torch
.
no_grad
():
if
opt
.
update
:
# update all models (to fix SourceChangeWarning)
if
opt
.
update
:
# update all models (to fix SourceChangeWarning)
...
...
test.py
浏览文件 @
e77c77f5
...
@@ -11,8 +11,8 @@ from tqdm import tqdm
...
@@ -11,8 +11,8 @@ from tqdm import tqdm
from
models.experimental
import
attempt_load
from
models.experimental
import
attempt_load
from
utils.datasets
import
create_dataloader
from
utils.datasets
import
create_dataloader
from
utils.general
import
coco80_to_coco91_class
,
check_dataset
,
check_file
,
check_img_size
,
box_iou
,
\
from
utils.general
import
coco80_to_coco91_class
,
check_dataset
,
check_file
,
check_img_size
,
check_requirements
,
\
non_max_suppression
,
scale_coords
,
xyxy2xywh
,
xywh2xyxy
,
set_logging
,
increment_path
box_iou
,
non_max_suppression
,
scale_coords
,
xyxy2xywh
,
xywh2xyxy
,
set_logging
,
increment_path
from
utils.loss
import
compute_loss
from
utils.loss
import
compute_loss
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
plot_images
,
output_to_target
,
plot_study_txt
...
@@ -302,6 +302,7 @@ if __name__ == '__main__':
...
@@ -302,6 +302,7 @@ if __name__ == '__main__':
opt
.
save_json
|=
opt
.
data
.
endswith
(
'coco.yaml'
)
opt
.
save_json
|=
opt
.
data
.
endswith
(
'coco.yaml'
)
opt
.
data
=
check_file
(
opt
.
data
)
# check file
opt
.
data
=
check_file
(
opt
.
data
)
# check file
print
(
opt
)
print
(
opt
)
check_requirements
()
if
opt
.
task
in
[
'val'
,
'test'
]:
# run normally
if
opt
.
task
in
[
'val'
,
'test'
]:
# run normally
test
(
opt
.
data
,
test
(
opt
.
data
,
...
...
train.py
浏览文件 @
e77c77f5
...
@@ -28,7 +28,7 @@ from utils.autoanchor import check_anchors
...
@@ -28,7 +28,7 @@ from utils.autoanchor import check_anchors
from
utils.datasets
import
create_dataloader
from
utils.datasets
import
create_dataloader
from
utils.general
import
labels_to_class_weights
,
increment_path
,
labels_to_image_weights
,
init_seeds
,
\
from
utils.general
import
labels_to_class_weights
,
increment_path
,
labels_to_image_weights
,
init_seeds
,
\
fitness
,
strip_optimizer
,
get_latest_run
,
check_dataset
,
check_file
,
check_git_status
,
check_img_size
,
\
fitness
,
strip_optimizer
,
get_latest_run
,
check_dataset
,
check_file
,
check_git_status
,
check_img_size
,
\
print_mutation
,
set_logging
,
one_cycle
check_requirements
,
print_mutation
,
set_logging
,
one_cycle
from
utils.google_utils
import
attempt_download
from
utils.google_utils
import
attempt_download
from
utils.loss
import
compute_loss
from
utils.loss
import
compute_loss
from
utils.plots
import
plot_images
,
plot_labels
,
plot_results
,
plot_evolution
from
utils.plots
import
plot_images
,
plot_labels
,
plot_results
,
plot_evolution
...
@@ -472,6 +472,7 @@ if __name__ == '__main__':
...
@@ -472,6 +472,7 @@ if __name__ == '__main__':
set_logging
(
opt
.
global_rank
)
set_logging
(
opt
.
global_rank
)
if
opt
.
global_rank
in
[
-
1
,
0
]:
if
opt
.
global_rank
in
[
-
1
,
0
]:
check_git_status
()
check_git_status
()
check_requirements
()
# Resume
# Resume
if
opt
.
resume
:
# resume an interrupted run
if
opt
.
resume
:
# resume an interrupted run
...
...
utils/general.py
浏览文件 @
e77c77f5
...
@@ -53,6 +53,14 @@ def check_git_status():
...
@@ -53,6 +53,14 @@ def check_git_status():
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_requirements
(
file
=
'requirements.txt'
):
# Check installed dependencies meet requirements
import
pkg_resources
requirements
=
pkg_resources
.
parse_requirements
(
Path
(
file
)
.
open
())
requirements
=
[
x
.
name
+
''
.
join
(
*
x
.
specs
)
if
len
(
x
.
specs
)
else
x
.
name
for
x
in
requirements
]
pkg_resources
.
require
(
requirements
)
# DistributionNotFound or VersionConflict exception if requirements not met
def
check_img_size
(
img_size
,
s
=
32
):
def
check_img_size
(
img_size
,
s
=
32
):
# Verify img_size is a multiple of stride s
# Verify img_size is a multiple of stride s
new_size
=
make_divisible
(
img_size
,
int
(
s
))
# ceil gs-multiple
new_size
=
make_divisible
(
img_size
,
int
(
s
))
# ceil gs-multiple
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论