title: Butterfly Classification Using CNN
emoji: π
colorFrom: gray
colorTo: blue
sdk: gradio
sdk_version: 4.15.0
app_file: app.py
pinned: false
license: mit
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Butterfly Classification using CNN
- Author: Kamelia Zaman Moon
- Project link: https://huggingface.co/spaces/KameliaZaman/Butterfly-Classification-using-CNN
- Language(s): Python
- License: MIT
- Contact: [email protected]
Table of Contents
1. Introduction
This project focuses on classifying butterfly images using a Convolutional Neural Network (CNN). The dataset includes images of butterflies and moths, with the goal of training a model to accurately predict the species of a given butterfly image.
2. Model Architecture
The CNN model used for this project is based on the ResNet50V2 architecture. The model is trained on a dataset consisting of training, validation, and test sets. The key components of the model architecture include convolutional layers, dropout for regularization, global average pooling, and fully connected layers. The model is compiled using the Adam optimizer and sparse categorical crossentropy loss.
ββ model_checkpoint_manual_effnet.h5 - generated model.
ββ Butterfly classification with CNN.ipynb - preprocesses input, trains, saves and evaluates the model.
ββ app.py - this module starts the app interface.
ββ README.md - readme file of this project.
ββ requirements.txt - list of required packages.
3. How-to Guide
3.1. Data Preparation
- The dataset is loaded from a CSV file containing information about the butterflies and moths.
- Image paths are constructed based on the dataset information.
- The dataset is split into training, validation, and test sets.
3.2. Exploratory Data Analysis (EDA)
- Visualizations are created to explore the distribution of labels in the dataset.
3.3. Image Data Generation
- Image data generators are used to augment the training data.
- Training and validation data generators are created.
3.4. Model Training
- The ResNet50V2-based model is constructed and compiled.
- The model is trained on the augmented training data, and its performance is monitored using validation data.
- Callbacks for reducing learning rate and early stopping are employed during training.
3.5. Model Evaluation
- The trained model is evaluated on the test set to measure its accuracy.
3.6. Deployment
- Gradio is utilized for deploying the trained model.
- Users can input an image, and the model will predict the butterfly species.
# clone project
git clone https://huggingface.co/spaces/KameliaZaman/Butterfly-Classification-using-CNN/tree/main
# go inside the project directory
cd Butterfly-Classification-using-CNN
# install the required packages
pip install -r requirements.txt
# run the gradio app
python app.py
4. License
This project is licensed under the MIT License.
5. Contributors
- Kamelia Zaman Moon - [email protected]