brails.processors.roof_shape_classifier.roof_shape_classifier module

Class object to use and retrain the roof type classifier model.

class brails.processors.roof_shape_classifier.roof_shape_classifier.RoofShapeClassifier(input_data: dict | None = None)

Bases: ImageClassifier

RoofShapeClassifier predicts roof shapes from aerial imagery.

This classifier serves as a wrapper around the ImageClassifier class, setting up the necessary inputs for roof type classification.

Attributes__

model_path (str): Path to the model file. classes (List[str]): List of roof type classes that will be predicted.

Methods__
predict(images: ImageSet) -> Dict[str, str]:

Returns predictions for the set of images provided.

retrain(data_dir, batch_size=8, nepochs=100, plot_loss=True)

Retrains the roof type classifier model with the provided data.

predict(images: ImageSet) dict

Predict the roof shape for the given images.

Args__
images (ImageSet): The set of images for which predictions are

required.

Returns__
dict: A dictionary mapping image keys to their predicted roof

shapes. The keys correspond to the same keys used in ImageSet.images, and the values are the predicted roof shape (Flat, Gable, or Hip).

retrain(data_dir, batch_size=8, nepochs=100, plot_loss=True)

Retrains the roof type classifier model with the provided data.

Args__

data_dir (str): The directory containing training data. batch_size (int): The number of samples per batch. Default is 8. nepochs (int): The number of epochs for training. Default is 100. plot_loss (bool): Whether to plot the loss during training. Default

is True.