ml_dl.YOLOBuildingDetector
ml_dl.YOLOBuildingDetector(
cities,
*,
yolo_root,
project_dir,
tile_px=512,
pixel_size_m=1.0,
class_names=('building',),
min_box_px=6,
train_stride=None,
)One-stop wrapper for the notebook-03 workflow.
Given a dict of cities -> (scene_path, aoi_bbox_ll, polygons_utm) triples and a role per city ("train" / "val" / "test"), this class will build the YOLO dataset, write data.yaml, train a detector, validate on the held-out splits, and report metrics – each step a single method call.
The notebook can use this when it wants the cleanest possible presentation, or call the module-level functions directly when it wants to walk a beginner through each step explicitly. They produce bit-identical outputs.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| cities | dict | Mapping city_name -> dict(scene_path=..., aoi_bbox_ll=..., polygons_utm=..., role=...) where role is one of "train", "val", "test". |
required |
| yolo_root | path - like | Directory under which images/{train,val,test} and labels/{train,val,test} are created. |
required |
| project_dir | path - like | Where Ultralytics writes runs/<run_name>/ (checkpoints + curves). |
required |
| tile_px | see | :func:polygons_to_yolo_tiles. |
512 |
| pixel_size_m | see | :func:polygons_to_yolo_tiles. |
512 |
| class_names | see | :func:polygons_to_yolo_tiles. |
512 |
| min_box_px | see | :func:polygons_to_yolo_tiles. |
512 |
| train_stride | int | Stride for the training split only (sliding-window augmentation). Defaults to tile_px // 2. The val/test splits always use non-overlapping stride for clean metrics. |
None |
Methods
| Name | Description |
|---|---|
| build_dataset | Write the YOLO dataset under self.yolo_root and the data.yaml. |
| train | Train the detector. Forwards kwargs to :func:train_yolo_detector. |
| validate | Validate on split. Returns the 4-metric stats dict. |
build_dataset
ml_dl.YOLOBuildingDetector.build_dataset()Write the YOLO dataset under self.yolo_root and the data.yaml.
train
ml_dl.YOLOBuildingDetector.train(**kwargs)Train the detector. Forwards kwargs to :func:train_yolo_detector.
Returns the trained ultralytics.YOLO model.
validate
ml_dl.YOLOBuildingDetector.validate(split, *, run_name=None, **kwargs)Validate on split. Returns the 4-metric stats dict.