n_stories#
Story-count detector using the BRAILS++ EfficientDet-D4 model.
Ports the BRAILS++ floor-detector runtime into openplaces,
replacing cv2 with PIL and removing the brails package import. All
post-processing (threshold tuning, nested-box removal, stack grouping,
middle-region selection) is reproduced verbatim from the BRAILS++ source.
The EfficientDet inference engine is self-contained in efficientdet_lib.infer.Infer. Model weights are downloaded from Zenodo on first use and cached under cfg.models_dir / ‘external’ / ‘brails’.
Classes#
Detect the number of stories in buildings from street-view images. |
Module Contents#
- class openplaces.io.enricher.detectors.n_stories.NStoriesDetector(model_path: str | pathlib.Path | None = None)#
Detect the number of stories in buildings from street-view images.
Uses the BRAILS++ EfficientDet-D4 model (downloaded from Zenodo on first use) plus the original BRAILS++ post-processing pipeline. The inference engine is bundled with openplaces.
- Parameters:
model_path – Path to the pre-trained .pth weights file. When None, the pretrained model is cached under cfg.models_dir / ‘external’ / ‘brails’. Existing files in the two previous external-data locations are still used.
- predict(images: openplaces.io.scrapers.types.ImageSet, checkpoint: openplaces.io.enricher.detectors.checkpoint.PredictionCheckpoint | None = None) dict#
Predict the number of stories for each image in images.
- Parameters:
images – Collection of street-view images to analyse.
checkpoint – When given, previously checkpointed predictions are reused, new ones are persisted periodically, and an interrupted run resumes where it left off.
- Returns:
Mapping from the same keys as
images.imagesto an integer story count, orNonewhen the image file does not exist.- Return type:
dict