Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions compressai_vision/evaluators/tf_evaluation_utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@

import numpy as np

from six.moves import range


def compute_precision_recall(scores, labels, num_gt):
"""Compute precision and recall.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@

import numpy as np

from six.moves import range

__all__ = ["BoxList"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@

import numpy as np

from six.moves import range

from ..tf_evaluation_utils import np_box_list, np_box_ops


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@

import numpy as np

from six.moves import range

from ..tf_evaluation_utils import np_box_list_ops, np_box_mask_list, np_mask_ops


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
from abc import ABCMeta, abstractmethod

import numpy as np
import six

from six.moves import range

from ..tf_evaluation_utils import per_image_evaluation
from .label_map_util import create_category_index
Expand All @@ -80,7 +77,7 @@
from .standard_fields import DetectionResultFields, InputDataFields


class DetectionEvaluator(six.with_metaclass(ABCMeta, object)):
class DetectionEvaluator(metaclass=ABCMeta):
"""Interface for object detection evalution classes.

Example usage of the Evaluator:
Expand Down Expand Up @@ -286,12 +283,10 @@ def _build_metric_names(self):
if idx + self._label_id_offset in category_index:
category_name = category_index[idx + self._label_id_offset]["name"]
try:
category_name = six.text_type(category_name, "utf-8")
category_name = str(category_name, "utf-8")
except TypeError:
pass
category_name = unicodedata.normalize("NFKD", category_name)
if six.PY2:
category_name = category_name.encode("ascii", "ignore")
self._metric_names.append(
self._metric_prefix
+ "PerformanceByCategory/AP@{}IOU/{}".format(
Expand Down Expand Up @@ -339,7 +334,7 @@ def add_single_ground_truth_image_info(self, image_id, groundtruth_dict):
# If the key is not present in the groundtruth_dict or the array is empty
# (unless there are no annotations for the groundtruth on this image)
# use values from the dictionary or insert None otherwise.
if InputDataFields.groundtruth_difficult in six.viewkeys(groundtruth_dict) and (
if InputDataFields.groundtruth_difficult in groundtruth_dict and (
groundtruth_dict[InputDataFields.groundtruth_difficult].size
or not groundtruth_classes.size
):
Expand Down Expand Up @@ -437,12 +432,10 @@ def evaluate(self):
if idx + self._label_id_offset in category_index:
category_name = category_index[idx + self._label_id_offset]["name"]
try:
category_name = six.text_type(category_name, "utf-8")
category_name = str(category_name, "utf-8")
except TypeError:
pass
category_name = unicodedata.normalize("NFKD", category_name)
if six.PY2:
category_name = category_name.encode("ascii", "ignore")
display_name = (
self._metric_prefix
+ "PerformanceByCategory/AP@{}IOU/{}".format(
Expand Down Expand Up @@ -581,7 +574,7 @@ def add_single_ground_truth_image_info(self, image_id, groundtruth_dict):
# If the key is not present in the groundtruth_dict or the array is empty
# (unless there are no annotations for the groundtruth on this image)
# use values from the dictionary or insert None otherwise.
if InputDataFields.groundtruth_group_of in six.viewkeys(groundtruth_dict) and (
if InputDataFields.groundtruth_group_of in groundtruth_dict and (
groundtruth_dict[InputDataFields.groundtruth_group_of].size
or not groundtruth_classes.size
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@

import numpy as np

from six.moves import range

from ..tf_evaluation_utils import (
np_box_list,
np_box_list_ops,
Expand Down
Loading