AerialEvidence#

class rapidtools.processing.aerial_evidence.AerialEvidence(detections: list[~shapely.geometry.base.BaseGeometry], coverage: ~shapely.geometry.base.BaseGeometry | None = None, occluders: ~shapely.geometry.base.BaseGeometry | None = None, recall: float = 0.9, false_alarm: float = 0.01, persistence: float = 1.0, offset_m: tuple[float, float] = (0.0, 0.0), scores: list[float | None] = <factory>)[source]#

Bases: object

The detections of one class in an overhead image, with what they weigh.

Variables:
  • detections (list[shapely.geometry.base.BaseGeometry]) – Outlines of the detected objects (or areas, for surface classes such as driveways) in longitude and latitude. Distinct outlines are distinct objects: fusion splits a blob that two of them share.

  • coverage (shapely.geometry.base.BaseGeometry | None) – The ground the detector looked at, in longitude and latitude (for SAM3OrthoFeatureExtractor, its scanned_area after a scan). None uses the detections as positive evidence only: the image then never says a cell is empty.

  • occluders (shapely.geometry.base.BaseGeometry | None) – Ground the overhead view cannot see for this class (tree crowns over a curb, roofs, carports), in longitude and latitude. Silence there says nothing.

  • recall (float) – Share of the objects the detector finds where it can see them.

  • false_alarm (float) – Share of empty, visible ground it marks as the class.

  • persistence (float) – Chance that a spot holds the same thing at the time of the overhead image and at the time of the street survey: 1 for objects that do not move, lower for parked cars.

  • offset_m (tuple[float, float]) – (east, north) shift in meters added to every outline to line the image up with the street survey’s camera positions (see estimate_offset()).

  • scores (list[float | None]) – Detector confidence of each outline, if known.

Example

>>> from shapely.geometry import box
>>> moved = AerialEvidence([box(0, 0, 1e-5, 1e-5)], persistence=0.5)
>>> moved.hit_log_odds, moved.miss_log_odds
(0.0, 0.0)

Methods

from_assets

Build the evidence from detected assets.

to_local

The evidence in a local meter frame, ready to be laid on grids.

classmethod from_assets(source: Any, *, coverage: Any = None, occluders: Any = None, min_confidence: float | None = None, **settings: Any) → AerialEvidence[source]#

Build the evidence from detected assets.

Parameters:
  • source – The detections: a PhysicalAssetCollection (such as the output of SAM3OrthoFeatureExtractor), the path of a GeoJSON file, or a sequence of polygons, all in longitude and latitude.

  • coverage – Ground the detector looked at, in any of the same forms or as one geometry.

  • occluders – Ground the overhead view cannot see, in any of the same forms.

  • min_confidence – Detections whose confidence attribute is below this are left out.

  • **settings – The remaining AerialEvidence fields (recall, false_alarm, persistence, offset_m).

Returns:

AerialEvidence – The evidence, with one outline per polygonal detection and its confidence in scores.

Example

>>> from shapely.geometry import box
>>> evidence = AerialEvidence.from_assets(
...     [box(0, 0, 1e-5, 1e-5)], coverage=box(-1e-4, -1e-4, 1e-4, 1e-4)
... )
>>> len(evidence.detections), evidence.coverage is not None
(1, True)
property hit_log_odds: float#

Log-odds a detection adds to a cell’s chance of being occupied.

property miss_log_odds: float#

Log-odds that visible ground without a detection adds (negative).

to_local(project: Callable[[float, float], tuple[float, float]]) → LocalAerialEvidence[source]#

The evidence in a local meter frame, ready to be laid on grids.

Parameters:

project – (lon, lat) -> (x, y) in meters, such as the first function returned by local_projection().

Returns:

LocalAerialEvidence – Outlines, coverage and occluders in meters, shifted by offset_m.