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=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.
- text_prompts
A list of text prompts used for damage classification.
- Type:
list[str]
- classes
A list of class labels representing the damage states.
- Type:
list[str]
- predict(images)
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.
- Parameters:
images (ImageSet) – An object containing the images to classify.
- Returns:
A dictionary mapping image keys to their predicted damage state (‘Damaged’ or ‘Not damaged’).
- Return type:
dict[str, str]
- Raises:
TypeError or ValueError – If the conditions on classes and text_prompts are not met in the parent method.