This project aims to classify leaf images into different species using various machine learning techniques.
This repository contains an implementation of multiple machine learning models for leaf species classification based on the Kaggle dataset: https://www.kaggle.com/competitions/leaf-classification
leaf-classification/
│
├── data/ # Data directory
│ ├── raw/ # Original dataset files
│ └── processed/ # Processed data files
│
├── models/ # Trained model storage
│ ├── knn/
│ ├── svm/
│ ├── decision_tree/
│ ├── random_forest/
│ ├── ann/
│ └── cnn/
│
├── notebooks/ # Jupyter notebooks
│ ├── exploratory_data_analysis.ipynb
│ ├── feature_engineering.ipynb
│ └── model_training_evaluation.ipynb
│
├── src/ # Source code
│ ├── __init__.py
│ ├── data_preprocessing.py # Data preprocessing functions
│ ├── feature_extraction.py # Feature extraction utilities
│ ├── model_training.py # Model training functions
│ ├── evaluation.py # Model evaluation metrics
│ └── visualization.py # Visualization utilities
│
├── results/ # Results and comparison analysis
│ ├── metrics/ # Performance metrics
│ ├── visualizations/ # Visualization outputs
│ └── failure_analysis/ # Failure case analysis
│
├── requirements.txt # Project dependencies
└── README.md # Project documentation
- Clone this repository:
git clone https://github.com/yourusername/leaf-classification.git
cd leaf-classification
- Create and activate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the required packages:
pip install -r requirements.txt
-
Download the dataset from Kaggle: https://www.kaggle.com/competitions/leaf-classification
- Place the files in the
data/raw/directory - Make sure you have train.csv, test.csv, and the images folder
- Place the files in the
-
Run the notebooks in the
notebooks/directory or execute the main script:
python src/main.py
- K-Nearest Neighbors (KNN)
- Support Vector Machine (SVM)
- Decision Tree
- Random Forest
- Artificial Neural Network (ANN)
- Convolutional Neural Network (CNN)
The model performance comparison and analysis can be found in the results/ directory after running the code.