Skip to content

Change Detection Implementation using DL (PyTorch) and Classical ML approaches

Notifications You must be signed in to change notification settings

Senior-year-second-semester-CMP2024/change-detection-SI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Change Detection

Problem Statement

The objective is to detect changes between two images in a time series. Both input images share the same dimensions and represent the same location. The desired output is a binary image highlighting the areas of change, which could entail the introduction of new objects, the absence of previously present objects, or alterations in object positions.

Deep Learning Approach

Prerequisites

  • Python 3
  • PyTorch
  • torchsummary
  • tqdm
  • OpenCV
  • scikit-learn
  • NumPy
  • Matplotlib
  • torchvision
  • Jupyter Notebook

Setup with Conda

conda create -n change-detection python=3.8
conda activate change-detection
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -y
conda install tqdm numpy matplotlib scikit-learn jupyter -y
pip install opencv-python -y
pip install torchsummary -y

Models

  • Basic Unet (takes the difference between the two images -- before and after -- as input)
  • Diff UNet (with Diffence Between input before and after)
  • Siamese Nested UNet (UNet++)

Dataset

Our dataset consists of 4868 samples captured from Egyptian lands before and after a certain period. We partitioned the dataset into 80% for training and 20% for validation purposes.

Hyper Parameters

  • Learning Rate: 0.001
  • Learning Rate: StepLR with step size 10 and gamma 0.2
  • Batch Size: 16
  • Epochs: 50
  • Optimizer: Adam
  • Loss Function: BCEWithLogitsLoss

Results Comparison

Model Training Jaccard Score Validation Jaccard Score
Basic UNet 0.85 0.77
Diff UNet 0.86 0.79
Siamese Nested UNet (UNet++) 0.88 0.81
Siamese Nested UNet (UNet++) with all dataset 0.92 -

Testing

To test any model, use Predict.ipynb notebook and modify the following :

  1. Change the model path
  2. Import the model from models directory
  3. Change the testset path (if needed)
  4. Run the notebook

Collaborators 🤝

bemoierian EngPeterAtef markyasser karimmahmoud22
Bemoi Erian Peter Atef Mark Yasser Karim Mahmoud