Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pysot
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kristýna Janků
pysot
Commits
15ba130f
There was an error fetching the commit references. Please try again later.
Commit
15ba130f
authored
5 years ago
by
StrangerZhang
Browse files
Options
Downloads
Patches
Plain Diff
fix mobile_v2 single output and neck hard coding
parent
b5da3c98
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pysot/models/backbone/mobile_v2.py
+2
-0
2 additions, 0 deletions
pysot/models/backbone/mobile_v2.py
pysot/models/neck/neck.py
+11
-6
11 additions, 6 deletions
pysot/models/neck/neck.py
with
13 additions
and
6 deletions
pysot/models/backbone/mobile_v2.py
+
2
−
0
View file @
15ba130f
...
...
@@ -128,6 +128,8 @@ class MobileNetV2(nn.Sequential):
outputs
.
append
(
x
)
p0
,
p1
,
p2
,
p3
,
p4
=
[
outputs
[
i
]
for
i
in
[
1
,
2
,
3
,
5
,
7
]]
out
=
[
outputs
[
i
]
for
i
in
self
.
used_layers
]
if
len
(
out
)
==
1
:
return
out
[
0
]
return
out
...
...
This diff is collapsed.
Click to expand it.
pysot/models/neck/neck.py
+
11
−
6
View file @
15ba130f
...
...
@@ -9,32 +9,37 @@ import torch.nn as nn
class
AdjustLayer
(
nn
.
Module
):
def
__init__
(
self
,
in_channels
,
out_channels
):
def
__init__
(
self
,
in_channels
,
out_channels
,
center_size
=
7
):
super
(
AdjustLayer
,
self
).
__init__
()
self
.
downsample
=
nn
.
Sequential
(
nn
.
Conv2d
(
in_channels
,
out_channels
,
kernel_size
=
1
,
bias
=
False
),
nn
.
BatchNorm2d
(
out_channels
),
)
self
.
center_size
=
center_size
def
forward
(
self
,
x
):
x
=
self
.
downsample
(
x
)
if
x
.
size
(
3
)
<
20
:
l
=
4
r
=
l
+
7
l
=
(
x
.
size
(
3
)
-
self
.
center_size
)
//
2
r
=
l
+
self
.
center_size
x
=
x
[:,
:,
l
:
r
,
l
:
r
]
return
x
class
AdjustAllLayer
(
nn
.
Module
):
def
__init__
(
self
,
in_channels
,
out_channels
):
def
__init__
(
self
,
in_channels
,
out_channels
,
center_size
=
7
):
super
(
AdjustAllLayer
,
self
).
__init__
()
self
.
num
=
len
(
out_channels
)
if
self
.
num
==
1
:
self
.
downsample
=
AdjustLayer
(
in_channels
[
0
],
out_channels
[
0
])
self
.
downsample
=
AdjustLayer
(
in_channels
[
0
],
out_channels
[
0
],
center_size
)
else
:
for
i
in
range
(
self
.
num
):
self
.
add_module
(
'
downsample
'
+
str
(
i
+
2
),
AdjustLayer
(
in_channels
[
i
],
out_channels
[
i
]))
AdjustLayer
(
in_channels
[
i
],
out_channels
[
i
],
center_size
))
def
forward
(
self
,
features
):
if
self
.
num
==
1
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment