Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tc.小浩
yolov7-obb
提交
5aba984a
Y
yolov7-obb
项目概览
Tc.小浩
/
yolov7-obb
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yolov7-obb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5aba984a
编写于
7月 08, 2022
作者:
Bubbliiiing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create code
上级
abd2999e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
11 deletion
+8
-11
nets/CSPdarknet.py
nets/CSPdarknet.py
+4
-7
nets/yolo.py
nets/yolo.py
+3
-3
yolo.py
yolo.py
+1
-1
未找到文件。
nets/CSPdarknet.py
浏览文件 @
5aba984a
...
...
@@ -15,9 +15,9 @@ class SiLU(nn.Module):
class
Conv
(
nn
.
Module
):
def
__init__
(
self
,
c1
,
c2
,
k
=
1
,
s
=
1
,
p
=
None
,
g
=
1
,
act
=
SiLU
()):
# ch_in, ch_out, kernel, stride, padding, groups
super
(
Conv
,
self
).
__init__
()
self
.
conv
=
nn
.
Conv2d
(
c1
,
c2
,
k
,
s
,
autopad
(
k
,
p
),
groups
=
g
,
bias
=
False
)
self
.
bn
=
nn
.
BatchNorm2d
(
c2
)
self
.
act
=
nn
.
LeakyReLU
(
0.1
,
inplace
=
True
)
if
act
is
True
else
(
act
if
isinstance
(
act
,
nn
.
Module
)
else
nn
.
Identity
())
self
.
conv
=
nn
.
Conv2d
(
c1
,
c2
,
k
,
s
,
autopad
(
k
,
p
),
groups
=
g
,
bias
=
False
)
self
.
bn
=
nn
.
BatchNorm2d
(
c2
,
eps
=
0.001
,
momentum
=
0.03
)
self
.
act
=
nn
.
LeakyReLU
(
0.1
,
inplace
=
True
)
if
act
is
True
else
(
act
if
isinstance
(
act
,
nn
.
Module
)
else
nn
.
Identity
())
def
forward
(
self
,
x
):
return
self
.
act
(
self
.
bn
(
self
.
conv
(
x
)))
...
...
@@ -116,10 +116,7 @@ class CSPDarknet(nn.Module):
print
(
"Load weights from "
,
url
.
split
(
'/'
)[
-
1
])
def
forward
(
self
,
x
):
x
=
self
.
stem
[
0
](
x
)
x
=
self
.
stem
[
1
](
x
)
x
=
self
.
stem
[
2
](
x
)
x
=
self
.
stem
(
x
)
x
=
self
.
dark2
(
x
)
#-----------------------------------------------#
# dark3的输出为80, 80, 256,是一个有效特征层
...
...
nets/yolo.py
浏览文件 @
5aba984a
...
...
@@ -45,14 +45,14 @@ class RepConv(nn.Module):
if
deploy
:
self
.
rbr_reparam
=
nn
.
Conv2d
(
c1
,
c2
,
k
,
s
,
autopad
(
k
,
p
),
groups
=
g
,
bias
=
True
)
else
:
self
.
rbr_identity
=
(
nn
.
BatchNorm2d
(
num_features
=
c1
)
if
c2
==
c1
and
s
==
1
else
None
)
self
.
rbr_identity
=
(
nn
.
BatchNorm2d
(
num_features
=
c1
,
eps
=
0.001
,
momentum
=
0.03
)
if
c2
==
c1
and
s
==
1
else
None
)
self
.
rbr_dense
=
nn
.
Sequential
(
nn
.
Conv2d
(
c1
,
c2
,
k
,
s
,
autopad
(
k
,
p
),
groups
=
g
,
bias
=
False
),
nn
.
BatchNorm2d
(
num_features
=
c2
),
nn
.
BatchNorm2d
(
num_features
=
c2
,
eps
=
0.001
,
momentum
=
0.03
),
)
self
.
rbr_1x1
=
nn
.
Sequential
(
nn
.
Conv2d
(
c1
,
c2
,
1
,
s
,
padding_11
,
groups
=
g
,
bias
=
False
),
nn
.
BatchNorm2d
(
num_features
=
c2
),
nn
.
BatchNorm2d
(
num_features
=
c2
,
eps
=
0.001
,
momentum
=
0.03
),
)
def
forward
(
self
,
inputs
):
...
...
yolo.py
浏览文件 @
5aba984a
...
...
@@ -100,7 +100,7 @@ class YOLO(object):
self
.
net
=
YoloBody
(
self
.
anchors_mask
,
self
.
num_classes
)
device
=
torch
.
device
(
'cuda'
if
torch
.
cuda
.
is_available
()
else
'cpu'
)
self
.
net
.
load_state_dict
(
torch
.
load
(
self
.
model_path
,
map_location
=
device
))
self
.
net
=
self
.
net
.
eval
()
self
.
net
=
self
.
net
.
fuse
().
eval
()
print
(
'{} model, and classes loaded.'
.
format
(
self
.
model_path
))
if
not
onnx
:
if
self
.
cuda
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录