brails.processors.facade_parser.facade_parser module

Class object to parse building facade images to get metric attributes.

class brails.processors.facade_parser.facade_parser.FacadeParser(input_data: dict)

Bases: ImageProcessor

A class to parse facade images of buildings and predict metric attributes.

Attributes:
cam_elevs (list[float]):

Camera elevation angles.

depthmaps (List[Tuple[str, Tuple[int, int], List[float]]]):

Depth maps for building images.

footprints (list[list[float, float]]):

Building footprints.

model_path (str):

Path to the trained model.

street_images (list[str]):

Paths to the street images.

predictions (pd.DataFrame):

DataFrame to store predictions.

predict(images: ImageSet) dict

Predict building metric attributes from street-level imagery.

Args:
images (ImageSet):

An object that contains camera elevations, depth maps, footprints, and street images. It should have the following attributes:

  • images: A dictionary containing image data with keys as

image identifiers. - dir_path: The directory path where the images are stored. - properties: A dictionary of properties for each image, including ‘depthMap’ and ‘camElev’.

Returns:
dict:

A dictionary containing predictions for each image. Each entry includes:

  • ‘roofEaveHeight’: The predicted roof eave height in feet, rounded to one decimal place.

  • ‘buildingHeight’: The predicted building height in feet, rounded to the nearest integer.

  • ‘roofPitch’: The predicted roof pitch, rounded to two decimal places.

Raises:
FileNotFoundError:

If the model path does not exist.

ValueError:

If the required data for predictions is missing or invalid.

Notes:
  • Ensure that the input images contains valid image paths and properties.

  • The prediction process may be computationally expensive and time-consuming.

  • The method utilizes the GPU if available, and the model is unloaded from the GPU after inference.