A machine learning project that classifies parking spaces as Empty or Occupied using image classification and a Support Vector Machine (SVM).
The project demonstrates a complete machine learning workflow, including image preprocessing, dataset preparation, model training, hyperparameter tuning with GridSearchCV, model evaluation, and model serialization.
- Binary image classification
- Parking space occupancy prediction
- Image preprocessing and resizing
- Feature extraction using flattened image vectors
- Support Vector Machine (SVM) classifier
- Hyperparameter tuning with GridSearchCV
- Model evaluation using accuracy score
- Trained model serialization with Pickle
| Category | Technology |
|---|---|
| Language | Python |
| Machine Learning | Scikit-learn |
| Image Processing | scikit-image |
| Numerical Computing | NumPy |
| Model | Support Vector Machine (SVM) |
| Hyperparameter Optimization | GridSearchCV |
| Model Serialization | Pickle |
parking-space-occupancy-classification/
│
├── clf-data/
│ ├── empty/
│ └── not_empty/
│
├── main.py
├── model.p
├── requirements.txt
├── .gitignore
└── README.md
Dataset
│
▼
Load Images
│
▼
Resize Images (15 × 15)
│
▼
Flatten Images
│
▼
Train/Test Split
│
▼
GridSearchCV
│
▼
Train SVM Classifier
│
▼
Evaluate Accuracy
│
▼
Save Trained Model
The dataset contains two classes:
- 🟢 Empty
- 🚗 Not Empty
Each image is resized to 15 × 15 pixels before being converted into a one-dimensional feature vector for training.
Clone the repository:
git clone https://github.com/MoustafaSerag/parking-space-occupancy-detection.git
cd parking-space-occupancy-detectionInstall dependencies:
pip install -r requirements.txtRun the training script:
python main.pyThe script will:
- Load the dataset
- Train an SVM classifier
- Search for the best hyperparameters using GridSearchCV
- Evaluate model accuracy
- Save the trained model as
model.p
The model is evaluated using:
- Accuracy Score
- Deep Learning implementation with PyTorch
- Convolutional Neural Networks (CNNs)
- Real-time parking occupancy detection
- Webcam or CCTV integration
- Web dashboard for monitoring parking availability
- Multi-class parking analysis
Moustafa Serag
GitHub: https://github.com/MoustafaSerag