This project is part of the AI Programming with Python Nanodegree at Udacity. The goal is to build an image classifier that can identify flower species from the 102 Category Flower Dataset using deep learning techniques.
You can also test the model by visiting the website http://127.0.0.1:5000 after running app.py
.
The classifier uses a pre-trained VGG16 model from PyTorch's torchvision library to classify flower images into one of 102 flower categories. The model was trained on the ImageNet dataset, and further fine-tuned using the flower dataset to make predictions.
- Dataset: The project is based on the 102 Category Flower Dataset. Images are organized into directories named after their class labels.
- Preprocessing: We resize all images to 224x224 pixels to ensure they are compatible with the VGG16 model.
- Model: We use a Convolutional Neural Network (CNN) architecture, specifically VGG16, which is pre-trained on ImageNet and fine-tuned to predict the 102 flower categories.
- Training: The model is trained for 10 epochs with the following metrics:
- Training Accuracy: ~88%
- Validation Accuracy: ~93%
- Python
- PyTorch
- Flask (for web deployment)
- Matplotlib (for visualizing results)
- Torchvision (for pre-trained models)
-
Clone the repository to your local machine:
git clone https://github.com/AstroTech-666/image_classifier.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Train the Model:
Run one of the following Jupyter notebooks to train the model and generate thevgg16_bn_checkpoint.pth
file:image_classifier_project.ipynb
(for CPU)image_classifier_project_GPU.ipynb
(for GPU)
-
Run the app:
python app.py
-
Open your browser and go to
http://127.0.0.1:5000/
to interact with the web app and classify flower images.
- Training Accuracy: 94.23%
- Validation Accuracy: 95.31%
- Test Accuracy: 92.67%
The model performs really well, achieving over 90% accuracy on both the validation and test datasets!
- Input: Upload an image of a flower.
- Output: The classifier will predict the flower species and display the result with confidence.
- The app provides a visual interface for users to upload images.
- Live prediction of flower types based on trained model.
- Increase the model's accuracy by fine-tuning the hyperparameters.
- Implement a more complex neural network architecture to enhance performance.
This project is licensed under the MIT License - see the LICENSE file for details.