prune_unwitnessed#
- rapidtools.processing.street_tracking.prune_unwitnessed(estimates: Sequence[ObjectEstimate], frames: Sequence[CameraFrame], frame_sightings: Mapping[str, Sequence[Observation]], project: Callable[[float, float], tuple[float, float]], witness_radius_m: float = 12.0, min_witnesses: int = 2, object_size_m: float = 4.5, min_distance_m: float = 1.5, bearing_margin_deg: float = 3.0, weak_only: bool = True) tuple[list[ObjectEstimate], int][source]#
Drop estimates that nearby frames should have seen but did not.
An object’s position is otherwise built only from the frames in which the detector fired. The frames in which it did not fire are evidence too: if a camera passed within
witness_radius_mof the estimated position on the same survey day, with that position in its field of view, and that frame holds no detection of the class anywhere near the predicted bearing, the object is not there. A far single-view estimate is typically metres off along its ray, and this is what catches it when the survey happened to drive past the spot it was placed on.A frame counts as a positive witness when any detection of the class lies within the object’s angular size of the predicted bearing (an object parked in front of it counts too, since it could hide the estimate). Votes are tallied per survey day, and an estimate is dropped only when, on every day that has witnesses, at least
min_witnessesnegative ones exist and they outnumber the positive ones; a vehicle seen up close on one day is reported even if it had gone by a later survey day. The frames the estimate was built from count as positive witnesses when they lie within the radius, so an object seen up close in one pass survives a later pass that day in which it had gone. Frames from other days (the vehicle may have left) and frames closer thanmin_distance_mare not witnesses.- Parameters:
estimates – Candidates after merging.
frames – Every frame of the survey, including those with no sighting.
frame_sightings – Sightings of the class per image ID.
project – Local metre projection shared by the caller.
witness_radius_m – Farthest a camera can be and still count; at this distance a vehicle is unmissable for the detector.
min_witnesses – Negative frames required.
object_size_m – Object footprint, for the bearing tolerance.
min_distance_m – Closest a witness may be (nearer ones are on the path).
bearing_margin_deg – Extra bearing tolerance for pose error.
weak_only – Judge only estimates whose position is not trustworthy on its own (see
is_weak_estimate()). A car triangulated from a close pass is real whatever a later pass shows: driveway cars are routinely hidden from the next pass by a hedge or a car in front, and the detector itself misses some.
- Returns:
tuple[list[ObjectEstimate], int] – The kept estimates and the number dropped.