This project implements a deep learning pipeline to classify 17 different species of flowers using TensorFlow and Keras. The project evolved from a custom-built Convolutional Neural Network (CNN) to a high-performance Transfer Learning model using the Xception architecture.
- Source: Flower Datasets (Kaggle)
- Classes: 17 flower categories.
- Preprocessing:
- Images resized to 180x180 pixels.
- Data split into Training (80%), Validation (10%), and Test (10%) sets.
- Applied Xception-specific scaling and preprocessing.
Initially, a 5-layer CNN with Dropout was implemented. While it achieved decent training accuracy, it struggled with generalization on the validation set.
To improve performance, we utilized the Xception model pre-trained on ImageNet as a feature extractor. We replaced the top layers with Global Average Pooling and a Softmax output layer tailored for 17 classes.
- Data Augmentation: Random flips, rotations, and zooms to increase dataset diversity.
- Regularization: Dropout (0.5) to prevent overfitting.
- Early Stopping: Monitored
val_losswith a patience of 5 epochs to restore the best weights. - Model Checkpointing: Automatically saved the best-performing model file (
transfer_learning_flower_model.keras).
- Test Accuracy: ~94.118%
- Test Loss: ~0.272
- The Xception model significantly outperformed the initial CNN, demonstrating the power of pre-trained weights for feature extraction.
To run the training pipeline:
- Ensure
kaggle.jsonis uploaded for dataset download. - Execute the notebook cells sequentially to unzip the data, define the model, and begin training.
- The final model is saved as
transfer_learning_flower_model.keras.