Semantic and Instance Segmentation of Aerial Drone Imagery
A custom CNN model inspired by ResNet-18 that can perform Semantics on footage obtained from drones.
Github Link to the project - Link
Accurate Semantic and Instance segmentation is critical for autonomous drone navigation, especially when maneuvering through obstacles like racing windows. Deep Learning models such as a simple U-Net can be trained for executing segmentation tasks. Further, models like Mask R-CNNs can be used for further tasks like Object detection and Instance Segmentation.
Project Overview
This project explores Semantic and Instance segmentation for drone perception tasks. It follows three key stages:
- Dataset Generation:
- Use Blender to create images with various lighting, backgrounds, and occlusions.
- Generate segmentation masks for training.
- Semantic Segmentation:
- Implement U-Net with a MobileNet encoder for object segmentation.
- Instance Segmentation:
- Apply connected component analysis to distinguish multiple objects.
Dataset Generation
Since manually collecting data is impractical, we generated images using Blender with domain randomization to create realistic training data.
- Different Object Orientations
- Lighting & Background Variations
- Occlusion Handling
Each generated image includes a corresponding ground truth segmentation mask for training.
Data Augmentation
To improve generalization, data augmentation techniques were applied:
Augmentations were implemented using PyTorch’s torchvision.transforms.
Semantic Segmentation Model
We trained a U-Net-based model with a MobileNet encoder for semantic segmentation.
Architecture Overview
- Encoder: Uses a ResNet-like structure with convolutional layers and skip connections.
- Decoder: Upsamples features using transposed convolutions.
- Final Layer: Produces a binary segmentation mask.
Loss Function
The Binary Cross-Entropy (BCE) Loss was used for pixel-wise classification:
\[L_{BCE} = - \frac{1}{N} \sum_{i=1}^{N} [ y_i \log(p_i) + (1 - y_i) \log(1 - p_i) ]\]where:
- (y_i) is the ground truth label (0 or 1).
- (p_i) is the predicted probability.
Instance Segmentation
Instance segmentation aims to distinguish multiple overlapping objects. We used the Connected Components Algorithm to assign unique labels to each object.
Algorithm Steps
- Input: Binary segmentation mask.
- Identify Connected Regions: Assign unique labels to each cluster.
- Use 4-connectivity or 8-connectivity to group pixels into objects.
Experiments & Results
Training Hyperparameters
| Hyperparameter | Value | |—————|——| | Epochs | 100 | | Batch Size | 32 | | Total Images | 40,000 | | Learning Rate | 1e-4 | | Optimizer | ADAM |
Failure Cases
- Tilted Windows
- The model struggled to segment windows when heavily tilted, likely due to a lack of diverse training data.
- Small Windows on Dark Backgrounds
- Objects with low contrast were harder to segment accurately.
- Windows close to each other
- Watershed segmentation fails when there is a significant overlap between the windows and it identifies it as a single entity.