satellit_sam.workflows.label.weak

Auto-generated from satellit_sam/src/satellit_sam/workflows/label/weak.py by satellit_sam/scripts/generate_api_docs.py.

Generate weak tree labels per tile from forest inventory data.

The resulting CSV file has the form:

tile_id,tree_id,x_pixel,y_pixel,crown_radius,bbox_x1,bbox_y1,bbox_x2,bbox_y2,x_long_wgs84,y_lat_wgs84,dbh_cm

The same rows are also exported as a point shapefile (labels_tiles.shp).

Back to API index

Functions

make_weak_labels

def make_weak_labels(
    output_dir: Path,
    image_tif: Path | None = None,
    tile_size: int = 1024,
    tile_overlap: int = 128,
    min_dbh_cm: float = 0.0,
    max_dbh_cm: float = 0.0,
    crown_model: CrownModel = "linear",
    export_visualizations: bool = False,
    inventory_csv: Path | None = None,
    inventory_shp: Path | None = None,
    x_field: str = "PX",
    y_field: str = "PY",
    tree_id_field: str = "TreeID",
    species_field: str = "Latin",
    status_field: str = "Status",
    status_filter: str = "alive",
    dbh_field: str = "DBH",
    dbh_unit: DbhUnit = "mm",
    deduplicate_tree_id: bool = True,
    default_crown_radius_m: float = 2.5,
    linear_factor_m_per_cm: float = 0.08,
    linear_intercept_m: float = 0.0,
    power_a: float = 0.15,
    power_b: float = 0.8,
    min_crown_radius_m: float = 0.5,
    max_crown_radius_m: float = 15.0,
    bbox_padding_px: float = 4.0,
    command: str | None = None,
) -> None:

Generate tile-wise weak labels and write them to labels_tiles.csv.

The function is intended to be configured via its explicit keyword
arguments, e.g. when called from a CLI wrapper or other Python code.

write_csv

def write_csv(tiles: list[dict[str, Any]], csv_path: Path) -> None:

Write weak labels as flat CSV rows.

write_shapefile

def write_shapefile(tiles: list[dict[str, Any]], shp_path: Path) -> None:

Write weak labels as WGS84 point shapefile.

export_visualizations_opencv

def export_visualizations_opencv(
    image_tif: Path,
    output_dir: Path,
    tiles: list[dict[str, Any]],
    crown_stroke_width: int = 1,
    center_radius: int = 2,
) -> dict[str, str]:

Render weak-label overlays and store one visualization per labeled tile.

TIFF inputs are streamed tile-by-tile via GDAL windows to avoid full-image
reads in memory.

Classes

No public classes.