suppress_duplicate_sightings

suppress_duplicate_sightings#

rapidtools.processing.street_tracking.suppress_duplicate_sightings(observations: Sequence[Observation], overlap_fraction: float = 0.6) → tuple[list[Observation], int][source]#

Drop a detector’s duplicate outlines within each frame.

Mapillary sometimes returns one object twice: a second outline nested in the first (a wheel, a window, the part of a car visible past a tree), or the two halves of a panorama’s seam. Each would start a separate track that could never merge (two detections in one frame are normally two objects), so they are resolved here:

  • an outline whose box lies mostly (overlap_fraction) inside another of the same class is dropped, keeping the larger one;

  • on a panorama, an outline touching the left edge and one touching the right edge at the same height are one object cut by the seam: the smaller piece is dropped.

Adjacent pieces are deliberately not joined: two cars parked side by side, or one behind another, look exactly like a split outline, and are far more common than one.

Returns:

tuple[list[Observation], int] – The cleaned sightings and how many were removed.