About run.ipynb

**bbox_per_image.yolo_labels(mask_dir='resources/Building/masks/labels_11m_75', save_dir='resources/Building/bbox_perslice/YOLO-v11m-75p')**

What does this code do?

Converts polygons to Oriented Bounding Boxes

  You can see from the image that, there is a labels.txt file for each of the slice (for building segmentation)

You can see from the image that, there is a labels.txt file for each of the slice (for building segmentation)


**bbox_combined.process_sliding_window(label_dir='resources/Building/bbox_perslice/YOLO-v11m-75p', save_dir='resources/ClassifierOutput/Building Classification/YOLO-v11m-75p', SEG_MODEL='yolo')**

What does this code do?

Combines the bounding boxes across windows. (f.e. A building may span multiple windows, merge OBBs to represent a building by a single Bounding Box) [NB: Requires HyperParam Tuning for the best result]

image.png

And a sample label format

You can see the values of the labels. It’s in full orthophoto dimension not in slice dimension.

You can see the values of the labels. It’s in full orthophoto dimension not in slice dimension.

labels.txt ⇒ Just all the buildings of the OP
labels_binclass.txt ⇒ Buildings after primary classficiation

labels.txt ⇒ Just all the buildings of the OP labels_binclass.txt ⇒ Buildings after primary classficiation

image.png


**model = 'YOLO-v11m-25p'

binary_classifier.classify(building_labels_path=f'resources/ClassifierOutput/Building Classification/{model}/labels.txt', object_labels_path=f'resources/ClassifierOutput/Object Detection/YOLO-v9c/predicted_object_labels_v9gelanc.txt', output_labels_path=f'resources/ClassifierOutput/Building Classification/{model}/labels_binclass.txt')**

What does this code do?

Primary Classification If there is at least one object within the surface area of an OBB (OR ≥ 80%) then mark that OBB (building) as Risky (class_id = 1)

Notice: Now there is a class_id for each of the OBB

Notice: Now there is a class_id for each of the OBB


Final distance-based classification

image.png

You have to use this code for the final classification

This code, does the classification along with saving the buildings labels after classfication.

This code, does the classification along with saving the buildings labels after classfication.

✅ That’s it !