An intelligent system for automated tree species classification using leaf images. This project leverages deep learning (ResNet34) for feature extraction and ensemble methods (StackingClassifier, RandomForest, and ...) for classification.
- Introduction
- Features
- Dataset
- Methodology
- Results
- Usage
- System Architecture
- Technologies Used
- Contributors
The goal of this project is to simplify and automate the classification of tree species based on leaf images. This system can aid:
- Ecologists in biodiversity monitoring.
- Farmers in tree species identification for better care.
- Tourists in learning about native trees.
- Feature Extraction: Pretrained ResNet34 used to extract 512 features from images.
- Ensemble Classification: Combines SVM and Random Forest using a stacking approach.
- Custom Dataset: Includes manually collected and preprocessed images of 28 tree species.
- User Interface: Simple web interface for users to upload leaf images and get predictions.
- Sources:
- Manually collected leaf images.
- Crawled from the web using a custom scraper.
- Frame extractions from leaf videos.
- Data Stats: ~32,000 images representing over 30 tree species.
- Preprocessing: Images normalized using mean
[0.485, 0.456, 0.406]and std[0.229, 0.224, 0.225].
- Data Collection and Preprocessing:
- Crawling images from the web.
- Manual video frame extraction.
- Dataset splitting into training and testing sets.
- Feature Extraction:
- Using ResNet34 pretrained on ImageNet.
- Classification:
- Classifier models: SVM, Random Forest, and Naive Bayes.
- Stacking method for the final classification.
- Evaluation:
- Metrics used: Accuracy, Precision, Recall, F1-Score.
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| SVM | 93.41% | 92.5% | 91.8% | 92.1% |
| Random Forest | 83.61% | 84.3% | 83.6% | 83.9% |
| StackingClassifier | 94.98% | 93.5% | 92.9% | 93.2% |
Confusion matrices and detailed metrics are available in the repository.
-
Clone the repository:
git clone https://github.com/A-Darvish/Tree-Species-Identification.git cd Tree-Species-Identification -
Run the web interface:
python app.py
-
Access the interface: Open http://127.0.0.1:5000 in your browser.
-
Upload a leaf image and get predictions.
Data Collection -> Preprocessing -> Feature Extraction -> Classification -> Web Interface
- Feature Extraction: ResNet34.
- Classification Models: SVM, Random Forest, StackingClassifier.
- Web Framework: Flask.
- UI: HTML + CSS for a simple user interface.
- Python Libraries: PyTorch, scikit-learn, Flask, NumPy, Pandas, Matplotlib.
- Deep Learning Model: ResNet34 pretrained on ImageNet.
- Web Framework: Flask.
- Arvand Darvish: Developed the project as part of a BSc thesis.
- Supervisor: Dr. Ahmad Nickabadi.