Here's the README.md
file formatted in Markdown for your repository:
# Eruption Detection: CNN vs SVM
## Project Description
This project explores binary classification for eruption detection using two distinct machine learning approaches: Convolutional Neural Networks (CNN) and Support Vector Machines (SVM). The goal is to critically compare the performance of these models on the same dataset, highlighting their strengths and weaknesses for the task.
## Features
- Binary classification of satellite imagery for eruption detection.
- CNN implementation with TensorFlow.
- SVM implementation with scikit-learn.
- Evaluation metrics: Accuracy, Precision, Recall, F1-Score, and Confusion Matrices.
- PCA visualization of the feature space.
- Examples where models fail, visualized with corresponding images.
## Folder Structure
eruption-detection-cnn-vs-svm/
├── svm_train.py # Train the SVM model
├── svm_predict.py # Predict with the trained SVM model
├── cnn_train_model.py # Train the CNN model
├── cnn_predict_model.py # Predict with the trained CNN model
├── report.pdf # Project report 3 page
├── figures/ # Visualizations (PCA plots, confusion matrices)
│ ├── pca_plot.png
│ ├── confusion_matrix_svm.png
│ └── ...
├── models/ # Saved models
│ ├── svm_model.pkl
│ └── cnn_model.h5
## Dataset
Due to size limitations, the dataset and trained models are hosted externally.
🔗 **[Download the dataset from Google Drive](https://drive.google.com/drive/folders/1sEIh3FDdhkHWCTdDeTRZDnhPHrdIPyF0?usp=sharing)**
After downloading and extracting, you should have the following folder at the root of the project:
data_and_models/
├── data_reviewed/
│ ├── training/
│ │ ├── eruption/
│ │ └── no_eruption/
│ └── validation/
│ ├── eruption/
│ └── no_eruption/
└── models/
├── cnn_model.h5
└── svm_image_model.pkl
The dataset consists of satellite imagery for eruption detection, divided into:
- `data_reviewed/training/`: Training dataset.
- `data_reviewed/validation/`: Validation dataset.
Ensure the dataset is organized into these folders before running the scripts.
## Requirements
- Python 3.10+
- Required libraries:
- TensorFlow 2.16
- NumPy
- scikit-learn
- Matplotlib
Install dependencies using:
```bash
pip install -r requirements.txt
- Clone the repository:
git clone <https://github.com/Nadjib-coder/eruption-detection-cnn-vs-svm.git>
cd eruption-detection-cnn-vs-svm
-
Prepare the dataset by placing the files in the
data/
folder as described above. -
Install dependencies using:
pip install -r requirements.txt
# Train the CNN model
python cnn/cnn_train_model.py
# Train the SVM model
python svm/svm_train.py
# Predict with the CNN model
python cnn/cnn_predict_model.py
# Predict with the SVM model
python svm/svm_predict.py
The results include:
- Evaluation metrics for CNN and SVM: Accuracy, Precision, Recall, F1-Score.
- Confusion Matrices for both models (stored in
figures/
folder). - PCA plots of the feature space.
- Visualized examples of incorrect predictions by each model.
This project is licensed under the MIT License.
- Dataset provided by [source if applicable].
- Inspired by the coursework for the Creative Computing and AI program at IADE.
Author: Nadjib Mouhoun
For inquiries, reach out via LinkedIn.
### Notes:
3. If you have a specific dataset source, replace `[source if applicable]` with the proper attribution.
4. The `requirements.txt` file should list all dependencies with versions (e.g., `tensorflow==2.16.0`). If you haven't created it yet, generate it using:
```bash
pip freeze > requirements.txt