Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
fb41b048
Commit
fb41b048
authored
Jul 17, 2020
by
Kaushik Shivakumar
Browse files
make minor changes
parent
6b18b06b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
research/object_detection/meta_architectures/context_rcnn_lib_tf2.py
...ject_detection/meta_architectures/context_rcnn_lib_tf2.py
+4
-4
No files found.
research/object_detection/meta_architectures/context_rcnn_lib_tf2.py
View file @
fb41b048
...
...
@@ -71,11 +71,11 @@ class AttentionBlock(tf.keras.layers.Layer):
def
build
(
self
,
input_shapes
):
pass
def
call
(
self
,
input
_features
,
context_features
,
valid_context_size
):
def
call
(
self
,
box
_features
,
context_features
,
valid_context_size
):
"""Handles a call by performing attention."""
_
,
context_size
,
_
=
context_features
.
shape
valid_mask
=
compute_valid_mask
(
valid_context_size
,
context_size
)
channels
=
input
_features
.
shape
[
-
1
]
channels
=
box
_features
.
shape
[
-
1
]
#Build the feature projection layer
if
not
self
.
_output_dimension
:
...
...
@@ -86,11 +86,11 @@ class AttentionBlock(tf.keras.layers.Layer):
# Average pools over height and width dimension so that the shape of
# box_features becomes [batch_size, max_num_proposals, channels].
input
_features
=
tf
.
reduce_mean
(
input
_features
,
[
2
,
3
])
box
_features
=
tf
.
reduce_mean
(
box
_features
,
[
2
,
3
])
with
tf
.
name_scope
(
"AttentionBlock"
):
queries
=
project_features
(
input
_features
,
self
.
_bottleneck_dimension
,
self
.
_is_training
,
box
_features
,
self
.
_bottleneck_dimension
,
self
.
_is_training
,
self
.
_query_proj
,
normalize
=
True
)
keys
=
project_features
(
context_features
,
self
.
_bottleneck_dimension
,
self
.
_is_training
,
...
...
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