"""Run several detectors over a frame and merge their detections. Used for the multi-model (ADetailer-style) setup: each ticked ``models/yolo//*.pt`` becomes a :class:`~.yolo.YoloDetector` (tagged with its category), and this detector concatenates all their results. Detections keep their own ``label`` (category), so the overlay/table show every model's output together — no cross-model dedup (different categories are meant to coexist). """ from __future__ import annotations from ..video.frame import Frame from .base import Detector from .types import Detection class MultiYoloDetector(Detector): def __init__(self, detectors: list[Detector]) -> None: if not detectors: raise ValueError("MultiYoloDetector requires at least one detector") self._detectors = detectors @property def name(self) -> str: return "Multi(" + " + ".join(d.name for d in self._detectors) + ")" def detect(self, frame: Frame) -> list[Detection]: out: list[Detection] = [] for d in self._detectors: out.extend(d.detect(frame)) return out