fuse_observations

fuse_observations#

rapidtools.processing.street_fusion.fuse_observations(observations: Sequence[Observation], frames: Sequence[Any] | None = None, *, camera_height_m: float = 2.4, min_range_m: float = 2.0, max_range_m: float = 30.0, cell_m: float | None = None, occupancy_threshold: float = 0.6, min_views: int = 2, min_object_width_m: float | None = None, split_instances: bool = True, strong_views: int | None = None, elevation_sigma_deg: float = 0.75, range_sigma_fraction: float = 0.2, depth_factor: float = 0.5, hull_agreement: float = 0.75, bearing_sigma_deg: float = 0.75, min_parallax_deg: float = 10.0, tile_m: float = 300.0, project: Callable[[float, float], tuple[float, float]] | None = None, unproject: Callable[[float, float], tuple[float, float]] | None = None, aerial: AerialEvidence | None = None, clear_from_m: float | None = None, flat: bool = False) → tuple[list[FusedObject], dict[str, int], Callable[[float, float], tuple[float, float]]][source]#

Turn the sightings of one class into objects by occupancy fusion.

See the module docstring for the method. Each survey day is fused by itself, so a car that left between two passes is not voted away by the later one; objects of different days that stand on the same spot are joined afterward.

Parameters:
  • observations – Sightings of one class. bearing, elevation and range_m are filled in on those that end up in an object.

  • frames – Every frame of the survey (objects with image_id, lon, lat, compass_angle, is_pano, captured_at and horizontal_fov_deg, such as CameraFrame), including those without a sighting: they are the ones that say a stretch of curb is empty. The sightings’ own frames are used when omitted.

  • camera_height_m – Camera height above the ground.

  • min_range_m – Closest range anything is placed at.

  • max_range_m – Farthest range a frame votes at.

  • cell_m – Size of a ground cell. None takes a quarter of min_object_width_m, between 0.1 and 0.5 m: a quarter of a meter for vehicles, a tenth for hydrants and poles.

  • occupancy_threshold – Share of the (range-weighted) votes on a cell that must say “occupied”.

  • min_views – Frames that must agree on a cell, and that an object must have been seen in.

  • min_object_width_m – Objects whose footprint is shorter than this are dropped. None takes it from the sightings themselves: the typical width of an outline at the range of its ground contact, between 0.2 and 1 m (1 m for vehicles, 0.3 m for hydrants), so small classes need no setting of their own.

  • split_instances – Split a blob that frames keep seeing as several outlines. Turn off for classes Mapillary segments as one surface (buildings, fences, vegetation).

  • strong_views – Frames that, outlining the same cells from three or more directions, place an object there even when the vote turns it down because most frames in range show nothing (an object hidden from part of the street, or one the detector often misses). Such objects have a vote_share under occupancy_threshold. 0 keeps only what the vote accepts. None uses 5 for classes whose outlines are typically under a meter wide (hydrants, poles) and 0 for the rest: the lines of sight to a narrow object cross at a point, while those to cars parked in a row cross in many places where there is nothing.

  • elevation_sigma_deg – One-sigma error of an outline edge’s elevation.

  • range_sigma_fraction – One-sigma range error as a share of the range.

  • depth_factor – Assumed depth of an object behind a visible face, as a share of the face’s length.

  • hull_agreement – Share of an object’s sightings whose outline must cover a cell for it to count as footprint.

  • bearing_sigma_deg – One-sigma bearing error, for the position uncertainty.

  • min_parallax_deg – Objects whose sightings all look along one line (bearings spread less than this) are dropped; 0 keeps them at the center of their cells.

  • tile_m – Side of the ground tiles the survey is processed in; bounds memory, not accuracy.

  • project – Projection to local meters; one centered on the sightings is made when omitted.

  • unproject – Inverse of project.

  • aerial – Detections of the same class in an overhead image (see AerialEvidence). They are used around the street survey only: objects the image alone shows are kept within max_range_m of its frames, where no frame saw the spot empty. Objects then carry sources.

  • clear_from_m – Closest range at which a frame that shows nothing there counts as having seen the ground empty. For frames that were only searched from some distance out (tiles of a panorama’s horizon band, see street_tiles); None means from min_range_m.

  • flat – The class lies on the ground (driveways, markings). Its outlines are then read as plans seen aslant (see set_range_bands()), and a footprint follows its cells instead of being their convex outline.

Returns:

tuple[list[FusedObject], dict[str, int], Unproject] – The objects, counters describing the run, and the inverse projection that turns their coordinates back into longitude and latitude.

Example

>>> objects, counts, unproject = fuse_observations(sightings)
>>> unproject(objects[0].x, objects[0].y)
(-117.4885, 47.7165)