This project is a part of the Udacity AI Programming with Python Nanodegree. The goal of this project is to train an image classifier using a deep learning model to recognize different species of flowers. The trained classifier can be integrated into applications, such as a smartphone app that identifies flowers through the device's camera.
To get started with this project, you need to follow the steps outlined below.
Before running the code, make sure you have the following dependencies installed:
Python PyTorch NumPy Matplotlib Seaborn Pandas PIL tqdm Installation Clone the repository to your local machine: bash Copy code git clone https://github.com/your-username/flower-image-classifier.git cd flower-image-classifier Install the required Python packages: bash Copy code pip install -r requirements.txt Project Structure The project is structured as follows:
assets: Contains assets such as images or diagrams. data: Holds the dataset, split into training, validation, and testing sets. Image Classifier Project.ipynb: Jupyter notebook with the main project code. predict.py: Python script for making predictions using the trained model. train.py: Python script for training the image classifier. README.md: The documentation you are currently reading. Usage Follow the steps below to run the image classifier:
Open the Jupyter notebook Image Classifier Project.ipynb. Execute each cell in the notebook to train the image classifier and evaluate its performance. Once trained, you can use the predict.py script to make predictions on new images.
The project is divided into the following main steps:
Load and preprocess the image dataset: The dataset consists of 102 flower categories. Images are loaded and preprocessed using torchvision transformations.
Build and train the classifier: A pre-trained VGG16 network is used as the base, and a new classifier is defined and trained on the flower dataset.
Validate the model: The model's performance is evaluated on a validation set to ensure its effectiveness.
Test the network: The final step involves testing the trained network on a separate test set to measure its accuracy on new, unseen images.
Save the checkpoint: The trained model, along with necessary information like class-to-index mapping, is saved as a checkpoint for future use.
Inference for classification: A function is provided to make predictions on new images using the trained model.
This project is part of the Udacity AI Programming with Python Nanodegree. The flower dataset used in this project consists of 102 categories and can be found here.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to adapt this template based on your specific project details and requirements.