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
27bd23e5
Unverified
Commit
27bd23e5
authored
Sep 02, 2021
by
Leandro Schelb
Committed by
GitHub
Sep 01, 2021
Browse files
Fixed deprecated tf.contrib.metrics (#9916)
* Fixed deprecated tf.flags * Fixed deprecated tf.contrib.metrics
parent
bdca62cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
research/attention_ocr/python/metrics.py
research/attention_ocr/python/metrics.py
+2
-2
No files found.
research/attention_ocr/python/metrics.py
View file @
27bd23e5
...
@@ -46,7 +46,7 @@ def char_accuracy(predictions, targets, rej_char, streaming=False):
...
@@ -46,7 +46,7 @@ def char_accuracy(predictions, targets, rej_char, streaming=False):
correct_chars
,
weights
),
axis
=
1
),
correct_chars
,
weights
),
axis
=
1
),
tf
.
reduce_sum
(
input_tensor
=
weights
,
axis
=
1
))
tf
.
reduce_sum
(
input_tensor
=
weights
,
axis
=
1
))
if
streaming
:
if
streaming
:
return
tf
.
contrib
.
metrics
.
streaming_
mean
(
accuracy_per_example
)
return
tf
.
metrics
.
mean
(
accuracy_per_example
)
else
:
else
:
return
tf
.
reduce_mean
(
input_tensor
=
accuracy_per_example
)
return
tf
.
reduce_mean
(
input_tensor
=
accuracy_per_example
)
...
@@ -87,6 +87,6 @@ def sequence_accuracy(predictions, targets, rej_char, streaming=False):
...
@@ -87,6 +87,6 @@ def sequence_accuracy(predictions, targets, rej_char, streaming=False):
accuracy_per_example
=
tf
.
cast
(
accuracy_per_example
=
tf
.
cast
(
tf
.
equal
(
correct_chars_counts
,
target_chars_counts
),
dtype
=
tf
.
float32
)
tf
.
equal
(
correct_chars_counts
,
target_chars_counts
),
dtype
=
tf
.
float32
)
if
streaming
:
if
streaming
:
return
tf
.
contrib
.
metrics
.
streaming_
mean
(
accuracy_per_example
)
return
tf
.
metrics
.
mean
(
accuracy_per_example
)
else
:
else
:
return
tf
.
reduce_mean
(
input_tensor
=
accuracy_per_example
)
return
tf
.
reduce_mean
(
input_tensor
=
accuracy_per_example
)
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