Skip to content

nyorojames/UrbanAnalysisProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Urban Analysis Project

This is a learning project for image processing and semantic segmentation. It explores how satellite screenshots can be segmented into built-up areas and green spaces, then used to estimate simple urban land-cover ratios.

The project is intentionally lightweight. It is not structured as a packaged application or production pipeline.

Project Layout

.
├── Dataset/                 # Roboflow export: original images, COCO annotations, masks
├── Dataset_tiled/           # 384px tiles generated with stride 192
├── Dataset_tiled_2/         # 384px tiles generated with stride 128
├── docs/                    # Presentation/explanation material
├── models/                  # Saved Keras .h5 model checkpoints
├── prototypes/              # Early OpenCV experiments
├── samples/                 # Sample images used for testing/visual checks
└── scripts/
    ├── preprocessing/       # Mask generation and tiling scripts
    ├── training/            # Main training script
    └── experiments/         # Training variants from earlier experiments

Workflow

This project focuses on automating the analysis of urban environments by quantifying the proportions of Built-up Areas versus Green Spaces. Motivated by the rapid urban development in Samsun, Turkey, the study investigates how much land is occupied by constructed surfaces compared to vegetation.

Using deep learning-based semantic segmentation, the system processes satellite imagery to distinguish between these land cover types, offering a feasibility demonstration for automated urban planning analysis.

  1. Convert Roboflow COCO annotations into class masks:

    python scripts/preprocessing/mask.py
  • Architecture: U-Net
  • Backbone: ResNet-34 (pretrained on ImageNet)
  • Framework: TensorFlow (tf.keras)
  • Data Source: Google Earth satellite screenshots (approx. 100 images of Samsun).
  • Annotation: Manually annotated using Roboflow.
  • Class Definitions: * Built-up: Merged class containing buildings and roads. * Green: Merged class containing trees and grass
  1. Merge detailed classes into the final simplified classes:

    python scripts/preprocessing/mask_tier1.py

The dataset was manually annotated and processed using Roboflow.

Final mask values:

  • 0: background
  • 1: built_up, from building + road
  • 2: green, from tree + grass
  1. Optionally tile images and masks:
  • Dataset Tiling: Large screenshots were split into smaller tiles using a custom Python script to increase sample count and preserve spatial detail.

  • Stride Optimization: A stride of 192 pixels was found to offer the best balance between numerical IoU and visual coherence.

    python scripts/preprocessing/tiling.py
    python scripts/preprocessing/tiling_2.py
  1. Train the main U-Net model:

The model was evaluated using both the Mean Intersection over Union (IoU) metric and visual overlay inspection.

python scripts/training/segmentation.py

The main model checkpoint is written to:

  • Built-up IoU: 0.45

  • Green IoU: 0.60

  • Mean IoU: 0.52 (excluding background)

    models/best_unet_resnet34.h5
    

Model

Visual overlays confirmed that major built-up areas and road networks were detected reliably. While a smaller stride of 128 produced a higher numerical IoU (0.66), it resulted in noisier predictions, leading to the selection of the 192-stride model.

  • Architecture: U-Net
  • Encoder/backbone: ResNet34
  • Framework: TensorFlow / Keras
  • Library: segmentation_models
  • Classes: background, built_up, green
  • Main metric: mean IoU excluding background

Experiment Notes

The scripts/experiments/ folder keeps older training variants:

  • segmentation_2.py: similar to the main training script, with a different saved checkpoint name.
  • segmentation_3.py: trains on Dataset_tiled/.
  • segmentation_4.py: trains on Dataset_tiled_2/.

The final model successfully estimated land-cover ratios from test images. For example:

  • Image 1: 85.27% Built-up | 14.73% Green
  • Image 2: 99.97% Built-up | 0.03% Green
  • Image 3: 0.00% Built-up | 100.00% Green
image

The prototypes/mvp_color_threshold.py script is an early HSV thresholding experiment. It is useful as a basic image-processing baseline, but it is separate from the deep learning workflow.

Dependencies

  • Ratio-Based Analysis: Moving beyond simple segmentation masks to actionable urban metrics.
  • Empirical Refinement: Iteratively merging fine-grained classes (e.g., combining "road" and "building") to improve segmentation stability.
  • Visual-First Evaluation: Prioritizing visual coherence over raw IoU scores to ensure practical usability.

Install the Python packages listed in requirements.txt. TensorFlow and segmentation_models can be version-sensitive, so use a virtual environment.

pip install -r requirements.txt

Dataset

The dataset was exported from Roboflow in COCO Segmentation format. See:

  • Dataset/README.dataset.txt

  • Dataset/README.roboflow.txt

  • Dataset Expansion: Incorporating additional satellite imagery to improve robustness.

  • Multi-City Testing: quantitatively evaluating the model on cities beyond Samsun.

About

Deep learning system that automatically quantifies Built-up Area vs. Green Space ratios from satellite imagery, motivated by rapid urban development in Samsun.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages