Semantic segmentation on the CamVid dataset using deep learning models implemented in PyTorch. This project trains and evaluates a segmentation model to label urban driving scenes.
This project performs semantic segmentation on the CamVid dataset. It leverages PyTorch and deep learning techniques to classify each pixel in urban driving scenes.
- Preprocessing and loading of CamVid images and labels
- Deep learning model (e.g., U-Net) for segmentation
- Training and validation pipeline
- Visualization of model predictions
Before running the notebook, set up a Python environment and install the dependencies listed in requirements.txt.
# Create a virtual environment
python -m venv venv
# Activate the environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Upgrade pip (recommended)
pip install --upgrade pip
# Install the required packages
pip install -r requirements.txt'# 1. Create a conda env
conda create -n camvid-env python=3.12
# 2. Activate it
conda activate camvid-env
# 3. Ensure pip is available
conda install pip
# 4. Install dependencies
pip install -r requirements.txtClone the repo
git clone https://github.com/ehsankhani/camvid-segmentation
cd camvid-segmentationUse either the venv or conda instructions above.
jupyter notebook camvid-segmentation.ipynb- Load & preprocess images
- Train the segmentation model
- Evaluate & visualize predictions
π Dataset Download the CamVid dataset from the official site and place it under a folder named data/ (or adjust paths in the notebook). -- link to the dataset : CamVid dataset
CamVid-main/
βββ CamVidColor11/
βββ CamVidGray/
βββ CamVid_Label/
βββ CamVid_RGB/
βββ SegNetanno/
βββ .gitignore
βββ best_model.pth
βββ camvid_data.py
βββ camvid_test.txt
βββ camvid_train.txt
βββ camvid_trainval.txt
βββ camvid_val.txt
βββ LICENSE
βββ camvid-segmentation.ipynb
βββ README.md
βββ requirements.txt
βββ segmentation_examples.png
βββ training_metrics.png