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
07fcdcc1
Commit
07fcdcc1
authored
Mar 31, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FasterRCNN] pad roi
parent
ace39425
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
examples/FasterRCNN/basemodel.py
examples/FasterRCNN/basemodel.py
+1
-1
examples/FasterRCNN/data.py
examples/FasterRCNN/data.py
+1
-1
examples/FasterRCNN/model.py
examples/FasterRCNN/model.py
+4
-2
No files found.
examples/FasterRCNN/basemodel.py
View file @
07fcdcc1
...
@@ -26,7 +26,7 @@ def maybe_freeze_affine(getter, *args, **kwargs):
...
@@ -26,7 +26,7 @@ def maybe_freeze_affine(getter, *args, **kwargs):
def
resnet_argscope
():
def
resnet_argscope
():
with
argscope
([
Conv2D
,
MaxPooling
,
BatchNorm
],
data_format
=
'channels_first'
),
\
with
argscope
([
Conv2D
,
MaxPooling
,
BatchNorm
],
data_format
=
'channels_first'
),
\
argscope
(
Conv2D
,
use_bias
=
False
),
\
argscope
(
Conv2D
,
use_bias
=
False
),
\
argscope
(
BatchNorm
,
training
=
False
),
\
argscope
(
BatchNorm
,
training
=
False
,
epsilon
=
0
),
\
custom_getter_scope
(
maybe_freeze_affine
):
custom_getter_scope
(
maybe_freeze_affine
):
yield
yield
...
...
examples/FasterRCNN/data.py
View file @
07fcdcc1
...
@@ -270,7 +270,7 @@ def get_train_dataflow(add_mask=False):
...
@@ -270,7 +270,7 @@ def get_train_dataflow(add_mask=False):
return
ret
return
ret
ds
=
MapData
(
ds
,
preprocess
)
ds
=
MapData
(
ds
,
preprocess
)
ds
=
PrefetchDataZMQ
(
ds
,
3
)
ds
=
PrefetchDataZMQ
(
ds
,
1
)
return
ds
return
ds
...
...
examples/FasterRCNN/model.py
View file @
07fcdcc1
...
@@ -312,6 +312,10 @@ def crop_and_resize(image, boxes, box_ind, crop_size):
...
@@ -312,6 +312,10 @@ def crop_and_resize(image, boxes, box_ind, crop_size):
"""
"""
assert
isinstance
(
crop_size
,
int
),
crop_size
assert
isinstance
(
crop_size
,
int
),
crop_size
# TF's crop_and_resize fails on border
image
=
tf
.
pad
(
image
,
[[
0
,
0
],
[
0
,
0
],
[
1
,
1
],
[
1
,
1
]])
boxes
=
boxes
+
1
@
under_name_scope
()
@
under_name_scope
()
def
transform_fpcoor_for_tf
(
boxes
,
image_shape
,
crop_shape
):
def
transform_fpcoor_for_tf
(
boxes
,
image_shape
,
crop_shape
):
"""
"""
...
@@ -570,8 +574,6 @@ if __name__ == '__main__':
...
@@ -570,8 +574,6 @@ if __name__ == '__main__':
7 7.5 8 8.5
7 7.5 8 8.5
9.5 10 10.5 11
9.5 10 10.5 11
12 12.5 13 13.5
12 12.5 13 13.5
Our implementation is not perfect either. When boxes are on the border of
images, TF pads zeros instead of border values. But this rarely happens so it's fine.
You cannot easily get the above results with tf.image.crop_and_resize.
You cannot easily get the above results with tf.image.crop_and_resize.
Try out yourself here:
Try out yourself here:
...
...
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