Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update documents #119

Merged
merged 3 commits into from
Jan 10, 2024
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: 1 addition & 1 deletion perception_eval/perception_eval/metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
26 changes: 11 additions & 15 deletions perception_eval/perception_eval/metrics/classification/accuracy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,22 +26,10 @@


class ClassificationAccuracy:
"""[summary]
Class to calculate classification accuracy.

Attributes:
target_labels (List[LabelType]): Target labels list.
num_ground_truth (int): Number of ground truths.
objects_results_num (int): Number of object results.
num_tp (int): Number of TP results.
num_fp (int): Number of FP results.
accuracy (float): Accuracy score. When `num_ground_truth+objects_results_num-num_tp=0`, this is float('inf').
precision (float): Precision score. When `num_tp+num_fp=0`, this is float('inf').
recall (float): Recall score. When `num_ground_truth=0`, this is float('inf').
f1score (float): F1 score. When `precision+recall=0`, this is float('inf').
results (Dict[str, float]): Dict that items are scores mapped by score names.
"""Class to calculate classification accuracy.

Args:
-----
object_results (List[PerceptionObjectResult]): Object results list.
num_ground_truth (int): Number of ground truths.
target_labels (List[LabelType]): Target labels list.
Expand Down Expand Up @@ -83,9 +71,11 @@ def calculate_tp_fp(self, object_results: List[PerceptionObjectResult]) -> Tuple
"""Calculate accuracy score.

Args:
-----
object_results (List[PerceptionObjectResult]): Object results list.

Returns:
--------
num_tp (int): Number of TP results.
num_fp (int): Number of FP results.
"""
Expand All @@ -104,9 +94,11 @@ def calculate_accuracy(self, num_tp: int) -> float:
Accuracy = (TP + TN) / (TP + TN + FP + FN)

Args:
-----
num_tp (int): Number of TP results.

Returns:
--------
float: Accuracy score. When `objects_results_num+num_ground_truth-num_tp=0`, returns float('inf').
"""
return (
Expand All @@ -122,9 +114,11 @@ def calculate_precision_recall(self, num_tp: int) -> Tuple[float, float]:
Recall = TP / (TP + FN)

Args:
-----
num_tp (int): Number of TP results.

Returns:
--------
precision (float): Precision score. When `self.object_results_num=0`, returns float('inf').
recall (float): Recall score. When `self.num_ground_truth=0`, returns float('inf').
"""
Expand All @@ -138,11 +132,13 @@ def calculate_f1score(self, precision: float, recall: float, beta: float = 1.0)
F score = (1 + beta**2) * precision * recall / (beta**2 * precision + recall)

Args:
-----
precision (float): Precision score.
recall (float): Recall score.
beta (float): Defaults 1.0.

Returns:
--------
f1score (float): F1 score. When `precision+recall=0`, returns float('inf').
"""
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
class ClassificationMetricsScore:
"""Metrics score class for classification evaluation.

Attributes:
self.accuracies (List[ClassificationAccuracy]): List of ClassificationAccuracy instances.

Args:
-----
object_results_dict (Dict[LabelType, List[List[PerceptionObjectResult]]]):
Dict that are list of PerceptionObjectResult mapped by their labels.
num_ground_truth_dict (Dict[LabelType, int]): Dict that are number of PerceptionObjectResult
Expand Down Expand Up @@ -62,6 +60,7 @@ def _summarize(self) -> Tuple[float, float, float, float]:
"""Summarize all ClassificationAccuracy.

Returns:
--------
accuracy (float): Accuracy score. When `num_est+num_gt-num_tp=0`, this is float('inf').
precision (float): Precision score. When `num_gt+num_fp=0`, this is float('inf').
recall (float): Recall score. When `num_gt=0`, this is float('inf').
Expand Down
2 changes: 1 addition & 1 deletion perception_eval/perception_eval/metrics/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,6 +35,7 @@ class _MetricsConfigBase(ABC):
Then, threshold for car objects is 1.0. threshold for bike objects is 0.5. threshold for pedestrian object is 0.5.

Args:
-----
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[List[float]]):
Thresholds List of center distance. Defaults to None.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,15 +29,8 @@
class ClassificationMetricsConfig(_MetricsConfigBase):
"""Configuration class for classification evaluation metrics.

Attributes:
evaluation_task (EvaluationTask.CLASSIFICATION)
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
iou_2d_thresholds (List[float]): Thresholds list of 2d iou matching.
iou_3d_thresholds (List[float]): Thresholds list of 3d iou matching.

Args:
-----
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,14 +29,6 @@
class DetectionMetricsConfig(_MetricsConfigBase):
"""Configuration class for detection evaluation metrics.

Attributes:
evaluation_task (EvaluationTask.DETECTION)
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
iou_2d_thresholds (List[float]): Thresholds list of 2d iou matching.
iou_3d_thresholds (List[float]): Thresholds list of 3d iou matching.

Args:
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,15 +28,8 @@
class PredictionMetricsConfig(_MetricsConfigBase):
"""Configuration class for prediction evaluation metrics.

Attributes:
evaluation_task (EvaluationTask.PREDICTION)
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
iou_2d_thresholds (List[float]): Thresholds list of 2d iou matching.
iou_3d_thresholds (List[float]): Thresholds list of 3d iou matching.

Args:
-----
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,15 +28,8 @@
class TrackingMetricsConfig(_MetricsConfigBase):
"""Configuration class for tracking evaluation metrics.

Attributes:
evaluation_task (EvaluationTask.TRACKING)
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
iou_2d_thresholds (List[float]): Thresholds list of 2d iou matching.
iou_3d_thresholds (List[float]): Thresholds list of 3d iou matching.

Args:
-----
target_labels (List[LabelType]): Target labels list.
center_distance_thresholds (List[float]): Thresholds list of center distance matching.
plane_distance_thresholds (List[float]): Threshold list of plane distance matching.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 TIER IV, Inc.
# Copyright 2022-2024 TIER IV, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading
Loading