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
571880ce
Commit
571880ce
authored
Oct 09, 2020
by
Vivek Rathod
Committed by
TF Object Detection Team
Oct 09, 2020
Browse files
Filter our unrecognized `image_classes_field` entries (i.e -1s)
PiperOrigin-RevId: 336321500
parent
17f2f812
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
research/object_detection/inputs.py
research/object_detection/inputs.py
+4
-1
No files found.
research/object_detection/inputs.py
View file @
571880ce
...
...
@@ -88,7 +88,8 @@ def _convert_labeled_classes_to_k_hot(groundtruth_labeled_classes, num_classes):
def
_remove_unrecognized_classes
(
class_ids
,
unrecognized_label
):
"""Returns class ids with unrecognized classes filtered out."""
recognized_indices
=
tf
.
where
(
tf
.
greater
(
class_ids
,
unrecognized_label
))
recognized_indices
=
tf
.
squeeze
(
tf
.
where
(
tf
.
greater
(
class_ids
,
unrecognized_label
)),
-
1
)
return
tf
.
gather
(
class_ids
,
recognized_indices
)
...
...
@@ -213,6 +214,8 @@ def transform_input_data(tensor_dict,
out_tensor_dict
[
labeled_classes_field
],
num_classes
)
if
image_classes_field
in
out_tensor_dict
:
out_tensor_dict
[
image_classes_field
]
=
_remove_unrecognized_classes
(
out_tensor_dict
[
image_classes_field
],
unrecognized_label
=-
1
)
out_tensor_dict
[
labeled_classes_field
]
=
_convert_labeled_classes_to_k_hot
(
out_tensor_dict
[
image_classes_field
],
num_classes
)
...
...
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