"""Auto-generated stub for module: detection."""
from typing import Any, Optional, Tuple

# Functions
def box_iou(boxes1: Any.Any, boxes2: Any.Any) -> Any.Any:
    """
    Compute IoU matrix for ``xyxy`` boxes.
    
        Args:
            boxes1: First box tensor with shape ``[N, 4]``.
            boxes2: Second box tensor with shape ``[M, 4]``.
    
        Returns:
            IoU matrix tensor with shape ``[N, M]``.
    """
    ...
def compute_map_metrics(outputs: Any[Any[str, Any]], targets: Any[Any[str, Any]], num_classes: int, iou_thresholds: Any[float] = (0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95), background_class: int | None = 0) -> tuple[float, float, dict[int, float]]:
    """
    Compute ``mAP@50``, ``mAP@50-95``, and per-class ``AP@50``.
    
        Args:
            outputs: Iterable of model output dictionaries.
            targets: Iterable of target annotation dictionaries.
            num_classes: Total number of classes in evaluation.
            iou_thresholds: Sequence of IoU thresholds for mAP computation.
            background_class: Optional class id to exclude from evaluation.
    
        Returns:
            Tuple ``(map50, map50_95, per_class_ap_50)``.
    """
    ...
def compute_metrics(outputs: Any[Any[str, Any]], targets: Any[Any[str, Any]], num_classes: int, iou_threshold: float = 0.5, background_class: int | None = 0) -> tuple[Any.Any, Any.Any, Any.Any]:
    """
    Compute per-class precision, recall, and F1-score for detections.
    
        Args:
            outputs: Iterable of model output dictionaries.
            targets: Iterable of target annotation dictionaries.
            num_classes: Total number of classes in evaluation.
            iou_threshold: IoU threshold used for matching.
            background_class: Optional class id to exclude from evaluation.
    
        Returns:
            Tuple of tensors ``(precision, recall, f1_score)`` per class.
    """
    ...
def epoch_metrics(data_loader: Any[tuple[Any[Any.Any], Any[Any[str, Any]]]], model: Any.Any.Any, device: Any.Any, num_classes: int, iou_threshold: float = 0.5, background_class: int | None = 0) -> Any[str, float]:
    """
    Run model inference for one epoch and aggregate detection metrics.
    
        Args:
            data_loader: Iterable yielding ``(images, targets)`` mini-batches.
            model: Detection model used for inference.
            device: Device where inference should execute.
            num_classes: Total number of classes in evaluation.
            iou_threshold: IoU threshold used for matching in core metrics.
            background_class: Optional class id to exclude from evaluation.
    
        Returns:
            Mapping containing aggregate precision, recall, F1, and mAP metrics.
    """
    ...
