A deep learning approach to semantic segmentation of aerial drone imagery using U-Net architecture
This project implements semantic segmentation on drone imagery using the classic U-Net architecture. The U-Net model excels at image segmentation tasks, particularly in scenarios with limited training data, making it ideal for pixel-level classification of aerial photographs.
The implementation includes a complete pipeline from data preprocessing to model training and visualization of results. The project was developed to demonstrate practical applications of computer vision in aerial imagery analysis.
The project uses the Semantic Segmentation Drone Dataset from Kaggle. This dataset contains high-resolution drone imagery with pixel-level annotations across multiple semantic classes, providing a challenging testbed for segmentation algorithms.
Dataset Characteristics:
- High-resolution aerial imagery
- Diverse urban and natural scenes
- Pixel-level semantic annotations
- Multiple object classes
U-Net/
├── simple_multi_unet_model.py # U-Net architecture implementation
├── bol.py # Image preprocessing and tiling script
├── Segmentasyon.ipynb # Main training notebook
└── README.md # Project documentation
pip install tensorflow opencv-python numpy matplotlib1. Data Preprocessing
The bol.py script handles the preprocessing pipeline:
- Resizes images to the nearest multiple of 256
- Splits large images into 256×256 tiles
- Maintains label-image correspondence
- Prepares data for efficient training
# Configure input/output paths in bol.py
segmentation_folder = 'path/to/label_images_semantic'
original_images_folder = 'path/to/original_images'
output_folder_seg = 'path/to/output/segmentation'
output_folder_img = 'path/to/output/images'2. Model Training
The U-Net architecture is defined in simple_multi_unet_model.py with:
- Encoder Path: 5 levels with increasing feature maps (16→32→64→128→256)
- Decoder Path: Symmetric expansion with skip connections
- Dropout Layers: Regularization to prevent overfitting
- Softmax Activation: Multi-class pixel classification
3. Training in Google Colab
The Segmentasyon.ipynb notebook contains the complete training pipeline:
- Mount Google Drive and load preprocessed data
- Configure model parameters
- Train with appropriate loss function (categorical crossentropy)
- Visualize predictions and evaluate performance
The U-Net follows the classic encoder-decoder structure:
- Contracting Path: Captures context through successive convolutions and pooling
- Expanding Path: Enables precise localization through upsampling
- Skip Connections: Combines low-level and high-level features
- Bottleneck: 256 filters at the deepest layer
The model successfully segments drone imagery into multiple semantic classes. Below is an example of the segmentation output:
Bu proje, klasik U-Net mimarisi kullanarak dron görüntüleri üzerinde semantik segmentasyon gerçekleştirmektedir. U-Net modeli, özellikle sınırlı eğitim verisi olan senaryolarda görüntü segmentasyonu görevlerinde mükemmel performans gösterir ve bu da onu hava fotoğraflarının piksel düzeyinde sınıflandırılması için ideal hale getirir.
Uygulama, veri ön işlemeden model eğitimine ve sonuçların görselleştirilmesine kadar eksiksiz bir iş akışı içermektedir. Proje, bilgisayarlı görünün hava görüntüsü analizindeki pratik uygulamalarını göstermek amacıyla geliştirilmiştir.
Proje, Kaggle'dan Semantic Segmentation Drone Dataset veri setini kullanmaktadır. Bu veri seti, birden fazla semantik sınıf üzerinde piksel düzeyinde etiketlemeye sahip yüksek çözünürlüklü dron görüntüleri içerir ve segmentasyon algoritmaları için zorlu bir test ortamı sağlar.
Veri Seti Özellikleri:
- Yüksek çözünürlüklü hava görüntüleri
- Çeşitli kentsel ve doğal sahneler
- Piksel düzeyinde semantik etiketleme
- Birden fazla nesne sınıfı
U-Net/
├── simple_multi_unet_model.py # U-Net mimarisi implementasyonu
├── bol.py # Görüntü ön işleme ve bölme betiği
├── Segmentasyon.ipynb # Ana eğitim notebook'u
└── README.md # Proje dokümantasyonu
pip install tensorflow opencv-python numpy matplotlib1. Veri Ön İşleme
bol.py betiği ön işleme sürecini yönetir:
- Görüntüleri 256'nın en yakın katına yeniden boyutlandırır
- Büyük görüntüleri 256×256 boyutunda parçalara ayırır
- Etiket-görüntü uyumunu korur
- Verileri verimli eğitim için hazırlar
# bol.py dosyasında giriş/çıkış yollarını yapılandırın
segmentation_folder = 'etiket_goruntuleri_yolu'
original_images_folder = 'orijinal_goruntular_yolu'
output_folder_seg = 'cikti/segmentasyon_yolu'
output_folder_img = 'cikti/goruntular_yolu'2. Model Eğitimi
U-Net mimarisi simple_multi_unet_model.py dosyasında tanımlanmıştır:
- Kodlayıcı Yolu: Artan özellik haritalarıyla 5 seviye (16→32→64→128→256)
- Kod Çözücü Yolu: Atlama bağlantılarıyla simetrik genişleme
- Dropout Katmanları: Aşırı öğrenmeyi önlemek için düzenlileştirme
- Softmax Aktivasyonu: Çok sınıflı piksel sınıflandırması
3. Google Colab'da Eğitim
Segmentasyon.ipynb notebook'u eksiksiz eğitim akışını içerir:
- Google Drive'ı bağla ve ön işlenmiş veriyi yükle
- Model parametrelerini yapılandır
- Uygun kayıp fonksiyonu ile eğit (categorical crossentropy)
- Tahminleri görselleştir ve performansı değerlendir
U-Net, klasik kodlayıcı-kod çözücü yapısını takip eder:
- Daraltma Yolu: Ardışık konvolüsyon ve havuzlama ile bağlamı yakalar
- Genişleme Yolu: Yukarı örnekleme ile hassas lokalizasyon sağlar
- Atlama Bağlantıları: Düşük seviye ve yüksek seviye özellikleri birleştirir
- Darboğaz: En derin katmanda 256 filtre
Model, dron görüntülerini başarılı bir şekilde birden fazla semantik sınıfa ayırır. Aşağıda segmentasyon çıktısına bir örnek verilmiştir:
