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
dd1d8d21
You need to sign in or sign up before continuing.
Commit
dd1d8d21
authored
Nov 09, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FasterRCNN] add arguments for rpn_head
parent
39b010ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
examples/FasterRCNN/model.py
examples/FasterRCNN/model.py
+10
-5
examples/FasterRCNN/train.py
examples/FasterRCNN/train.py
+1
-1
No files found.
examples/FasterRCNN/model.py
View file @
dd1d8d21
...
...
@@ -14,14 +14,19 @@ from utils.box_ops import pairwise_iou
import
config
def
rpn_head
(
featuremap
):
def
rpn_head
(
featuremap
,
channel
,
num_anchors
):
"""
Returns:
label_logits: fHxfWxNA
box_logits: fHxfWxNAx4
"""
with
tf
.
variable_scope
(
'rpn'
),
\
argscope
(
Conv2D
,
data_format
=
'NCHW'
,
W_init
=
tf
.
random_normal_initializer
(
stddev
=
0.01
)):
hidden
=
Conv2D
(
'conv0'
,
featuremap
,
1024
,
3
,
nl
=
tf
.
nn
.
relu
)
hidden
=
Conv2D
(
'conv0'
,
featuremap
,
channel
,
3
,
nl
=
tf
.
nn
.
relu
)
label_logits
=
Conv2D
(
'class'
,
hidden
,
config
.
NR_ANCHOR
,
1
)
box_logits
=
Conv2D
(
'box'
,
hidden
,
4
*
config
.
NR_ANCHOR
,
1
)
label_logits
=
Conv2D
(
'class'
,
hidden
,
num_anchors
,
1
)
box_logits
=
Conv2D
(
'box'
,
hidden
,
4
*
num_anchors
,
1
)
# 1, NA(*4), im/16, im/16 (NCHW)
label_logits
=
tf
.
transpose
(
label_logits
,
[
0
,
2
,
3
,
1
])
# 1xfHxfWxNA
...
...
@@ -29,7 +34,7 @@ def rpn_head(featuremap):
shp
=
tf
.
shape
(
box_logits
)
# 1x(NAx4)xfHxfW
box_logits
=
tf
.
transpose
(
box_logits
,
[
0
,
2
,
3
,
1
])
# 1xfHxfWx(NAx4)
box_logits
=
tf
.
reshape
(
box_logits
,
tf
.
stack
([
shp
[
2
],
shp
[
3
],
config
.
NR_ANCHOR
,
4
]))
# fHxfWxNAx4
box_logits
=
tf
.
reshape
(
box_logits
,
tf
.
stack
([
shp
[
2
],
shp
[
3
],
num_anchors
,
4
]))
# fHxfWxNAx4
return
label_logits
,
box_logits
...
...
examples/FasterRCNN/train.py
View file @
dd1d8d21
...
...
@@ -80,7 +80,7 @@ class Model(ModelDesc):
# resnet50
featuremap
=
pretrained_resnet_conv4
(
image
,
[
3
,
4
,
6
])
rpn_label_logits
,
rpn_box_logits
=
rpn_head
(
featuremap
)
rpn_label_logits
,
rpn_box_logits
=
rpn_head
(
featuremap
,
1024
,
config
.
NR_ANCHOR
)
rpn_label_loss
,
rpn_box_loss
=
rpn_losses
(
anchor_labels
,
anchor_boxes_encoded
,
rpn_label_logits
,
rpn_box_logits
)
...
...
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