Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
46daa7b7
Unverified
提交
46daa7b7
authored
11月 20, 2021
作者:
Glenn Jocher
提交者:
GitHub
11月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `.autoshape()` method (#5694)
上级
36d12a50
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
6 行增加
和
14 行删除
+6
-14
hubconf.py
hubconf.py
+2
-1
common.py
models/common.py
+3
-5
yolo.py
models/yolo.py
+1
-8
没有找到文件。
hubconf.py
浏览文件 @
46daa7b7
...
...
@@ -27,6 +27,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
"""
from
pathlib
import
Path
from
models.common
import
AutoShape
from
models.experimental
import
attempt_load
from
models.yolo
import
Model
from
utils.downloads
import
attempt_download
...
...
@@ -55,7 +56,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
if
len
(
ckpt
[
'model'
]
.
names
)
==
classes
:
model
.
names
=
ckpt
[
'model'
]
.
names
# set class names attribute
if
autoshape
:
model
=
model
.
autoshape
(
)
# for file/URI/PIL/cv2/np inputs and NMS
model
=
AutoShape
(
model
)
# for file/URI/PIL/cv2/np inputs and NMS
return
model
.
to
(
device
)
except
Exception
as
e
:
...
...
models/common.py
浏览文件 @
46daa7b7
...
...
@@ -23,7 +23,7 @@ from utils.datasets import exif_transpose, letterbox
from
utils.general
import
(
LOGGER
,
check_requirements
,
check_suffix
,
colorstr
,
increment_path
,
make_divisible
,
non_max_suppression
,
scale_coords
,
xywh2xyxy
,
xyxy2xywh
)
from
utils.plots
import
Annotator
,
colors
,
save_one_box
from
utils.torch_utils
import
time_sync
from
utils.torch_utils
import
copy_attr
,
time_sync
def
autopad
(
k
,
p
=
None
):
# kernel, padding
...
...
@@ -405,12 +405,10 @@ class AutoShape(nn.Module):
def
__init__
(
self
,
model
):
super
()
.
__init__
()
LOGGER
.
info
(
'Adding AutoShape... '
)
copy_attr
(
self
,
model
,
include
=
(
'yaml'
,
'nc'
,
'hyp'
,
'names'
,
'stride'
,
'abc'
),
exclude
=
())
# copy attributes
self
.
model
=
model
.
eval
()
def
autoshape
(
self
):
LOGGER
.
info
(
'AutoShape already enabled, skipping... '
)
# model already converted to model.autoshape()
return
self
def
_apply
(
self
,
fn
):
# Apply to(), cpu(), cuda(), half() to model tensors that are not parameters or registered buffers
self
=
super
()
.
_apply
(
fn
)
...
...
models/yolo.py
浏览文件 @
46daa7b7
...
...
@@ -22,8 +22,7 @@ from models.experimental import *
from
utils.autoanchor
import
check_anchor_order
from
utils.general
import
LOGGER
,
check_version
,
check_yaml
,
make_divisible
,
print_args
from
utils.plots
import
feature_visualization
from
utils.torch_utils
import
(
copy_attr
,
fuse_conv_and_bn
,
initialize_weights
,
model_info
,
scale_img
,
select_device
,
time_sync
)
from
utils.torch_utils
import
fuse_conv_and_bn
,
initialize_weights
,
model_info
,
scale_img
,
select_device
,
time_sync
try
:
import
thop
# for FLOPs computation
...
...
@@ -226,12 +225,6 @@ class Model(nn.Module):
self
.
info
()
return
self
def
autoshape
(
self
):
# add AutoShape module
LOGGER
.
info
(
'Adding AutoShape... '
)
m
=
AutoShape
(
self
)
# wrap model
copy_attr
(
m
,
self
,
include
=
(
'yaml'
,
'nc'
,
'hyp'
,
'names'
,
'stride'
),
exclude
=
())
# copy attributes
return
m
def
info
(
self
,
verbose
=
False
,
img_size
=
640
):
# print model information
model_info
(
self
,
verbose
,
img_size
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论