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
fd232c2c
Commit
fd232c2c
authored
Jun 30, 2022
by
Rui Qian
Committed by
A. Unique TensorFlower
Jun 30, 2022
Browse files
Internal change
PiperOrigin-RevId: 458358467
parent
0f091a60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
official/projects/yt8m/eval_utils/eval_util.py
official/projects/yt8m/eval_utils/eval_util.py
+4
-0
No files found.
official/projects/yt8m/eval_utils/eval_util.py
View file @
fd232c2c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
# limitations under the License.
# limitations under the License.
"""Provides functions to help with evaluating models."""
"""Provides functions to help with evaluating models."""
import
logging
import
numpy
as
np
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
from
official.projects.yt8m.eval_utils
import
average_precision_calculator
as
ap_calculator
from
official.projects.yt8m.eval_utils
import
average_precision_calculator
as
ap_calculator
...
@@ -57,6 +58,9 @@ def calculate_precision_at_equal_recall_rate(predictions, actuals):
...
@@ -57,6 +58,9 @@ def calculate_precision_at_equal_recall_rate(predictions, actuals):
"""
"""
aggregated_precision
=
0.0
aggregated_precision
=
0.0
num_videos
=
actuals
.
shape
[
0
]
num_videos
=
actuals
.
shape
[
0
]
if
num_videos
==
0
:
logging
.
warning
(
"Num_videos is 0, returning 0.0 aggregated_precision."
)
return
aggregated_precision
for
row
in
np
.
arange
(
num_videos
):
for
row
in
np
.
arange
(
num_videos
):
num_labels
=
int
(
np
.
sum
(
actuals
[
row
]))
num_labels
=
int
(
np
.
sum
(
actuals
[
row
]))
top_indices
=
np
.
argpartition
(
predictions
[
row
],
-
num_labels
)[
-
num_labels
:]
top_indices
=
np
.
argpartition
(
predictions
[
row
],
-
num_labels
)[
-
num_labels
:]
...
...
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