Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
0430c07c
Commit
0430c07c
authored
Jun 04, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FasterRCNN] revert the padding change to be consistent with pretrained models
parent
a2b17c97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
examples/FasterRCNN/basemodel.py
examples/FasterRCNN/basemodel.py
+5
-5
No files found.
examples/FasterRCNN/basemodel.py
View file @
0430c07c
...
@@ -73,7 +73,7 @@ def resnet_bottleneck(l, ch_out, stride):
...
@@ -73,7 +73,7 @@ def resnet_bottleneck(l, ch_out, stride):
l
,
shortcut
=
l
,
l
l
,
shortcut
=
l
,
l
l
=
Conv2D
(
'conv1'
,
l
,
ch_out
,
1
,
activation
=
BNReLU
)
l
=
Conv2D
(
'conv1'
,
l
,
ch_out
,
1
,
activation
=
BNReLU
)
if
stride
==
2
:
if
stride
==
2
:
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
1
,
0
],
[
1
,
0
]])
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
0
,
1
],
[
0
,
1
]])
l
=
Conv2D
(
'conv2'
,
l
,
ch_out
,
3
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
l
=
Conv2D
(
'conv2'
,
l
,
ch_out
,
3
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
else
:
else
:
l
=
Conv2D
(
'conv2'
,
l
,
ch_out
,
3
,
strides
=
stride
,
activation
=
BNReLU
)
l
=
Conv2D
(
'conv2'
,
l
,
ch_out
,
3
,
strides
=
stride
,
activation
=
BNReLU
)
...
@@ -95,9 +95,9 @@ def resnet_group(name, l, block_func, features, count, stride):
...
@@ -95,9 +95,9 @@ def resnet_group(name, l, block_func, features, count, stride):
def
resnet_c4_backbone
(
image
,
num_blocks
,
freeze_c2
=
True
):
def
resnet_c4_backbone
(
image
,
num_blocks
,
freeze_c2
=
True
):
assert
len
(
num_blocks
)
==
3
assert
len
(
num_blocks
)
==
3
with
resnet_argscope
():
with
resnet_argscope
():
l
=
tf
.
pad
(
image
,
[[
0
,
0
],
[
0
,
0
],
[
3
,
2
],
[
3
,
2
]])
l
=
tf
.
pad
(
image
,
[[
0
,
0
],
[
0
,
0
],
[
2
,
3
],
[
2
,
3
]])
l
=
Conv2D
(
'conv0'
,
l
,
64
,
7
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
l
=
Conv2D
(
'conv0'
,
l
,
64
,
7
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
1
,
0
],
[
1
,
0
]])
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
0
,
1
],
[
0
,
1
]])
l
=
MaxPooling
(
'pool0'
,
l
,
3
,
strides
=
2
,
padding
=
'VALID'
)
l
=
MaxPooling
(
'pool0'
,
l
,
3
,
strides
=
2
,
padding
=
'VALID'
)
c2
=
resnet_group
(
'group0'
,
l
,
resnet_bottleneck
,
64
,
num_blocks
[
0
],
1
)
c2
=
resnet_group
(
'group0'
,
l
,
resnet_bottleneck
,
64
,
num_blocks
[
0
],
1
)
# TODO replace var by const to enable optimization
# TODO replace var by const to enable optimization
...
@@ -125,10 +125,10 @@ def resnet_fpn_backbone(image, num_blocks, freeze_c2=True):
...
@@ -125,10 +125,10 @@ def resnet_fpn_backbone(image, num_blocks, freeze_c2=True):
with
resnet_argscope
():
with
resnet_argscope
():
chan
=
image
.
shape
[
1
]
chan
=
image
.
shape
[
1
]
l
=
tf
.
pad
(
image
,
tf
.
stack
(
l
=
tf
.
pad
(
image
,
tf
.
stack
(
[[
0
,
0
],
[
0
,
0
],
[
3
,
2
+
pad_shape2d
[
0
]],
[
3
,
2
+
pad_shape2d
[
1
]]]))
[[
0
,
0
],
[
0
,
0
],
[
2
,
3
+
pad_shape2d
[
0
]],
[
2
,
3
+
pad_shape2d
[
1
]]]))
l
.
set_shape
([
None
,
chan
,
None
,
None
])
l
.
set_shape
([
None
,
chan
,
None
,
None
])
l
=
Conv2D
(
'conv0'
,
l
,
64
,
7
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
l
=
Conv2D
(
'conv0'
,
l
,
64
,
7
,
strides
=
2
,
activation
=
BNReLU
,
padding
=
'VALID'
)
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
1
,
0
],
[
1
,
0
]])
l
=
tf
.
pad
(
l
,
[[
0
,
0
],
[
0
,
0
],
[
0
,
1
],
[
0
,
1
]])
l
=
MaxPooling
(
'pool0'
,
l
,
3
,
strides
=
2
,
padding
=
'VALID'
)
l
=
MaxPooling
(
'pool0'
,
l
,
3
,
strides
=
2
,
padding
=
'VALID'
)
c2
=
resnet_group
(
'group0'
,
l
,
resnet_bottleneck
,
64
,
num_blocks
[
0
],
1
)
c2
=
resnet_group
(
'group0'
,
l
,
resnet_bottleneck
,
64
,
num_blocks
[
0
],
1
)
if
freeze_c2
:
if
freeze_c2
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment