brails.processors.street_level_damage_detection.street_level_damage_detection module
Class object to predict building damage from street imagery using CLIP.
- class brails.processors.street_level_damage_detection.street_level_damage_detection.DamageDetection_StreetLevel(input_dict: dict | None = None)
Bases:
CLIPClassifier
A classifier that determines if a building is damaged using CLIP.
This class initializes the classifier with text prompts and predefined damage-related classes to make predictions from street-level imagery.
- Attributes:
- text_prompts (list[str]):
A list of text prompts used for damage classification.
- classes (list[str]):
A list of class labels representing the damage states.
- predict(images: ImageSet)
Predicts whether buildings in the given images are damaged using CLIP.
This method sets predefined damage classification classes and their corresponding text prompts before calling the parent class’ predict method.
- Args:
- images (ImageSet):
An object containing the images to classify.
- Returns:
- dict[str, str]:
A dictionary mapping image keys to their predicted damage state (‘Damaged’ or ‘Not damaged’).
- Raises:
- TypeError or ValueError:
If the conditions on classes and text_prompts are not met in the parent method.