Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This project demonstrates flower classification using Convolutional Neural Networks (CNN) with TensorFlow and Keras. It involves encoding and splitting the data into training and test sets, building a CNN model, and evaluating its performance.

knuII/FlowerRecog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Flower Classification using Convolutional Neural Networks (CNN)

Introduction

This project demonstrates flower classification using Convolutional Neural Networks (CNN) with TensorFlow and Keras. It involves encoding and splitting the data into training and test sets, building a CNN model, and evaluating its performance.

Dataset

The dataset used for this project contains images of various types of flowers. The images are stored in folders based on their categories.

Setup

  1. Clone the repository or download the code.

  2. Ensure you have the required libraries installed, including NumPy, OpenCV, Matplotlib, Scikit-learn, TensorFlow, and Keras.

  3. Set the folder_dir variable to the directory where your flower dataset is stored.

  4. Adjust the SIZE variable to define the dimensions to which the images will be cropped (e.g., 128x128 pixels).

Data Preprocessing

  • The images are loaded, resized, and normalized to values between 0 and 1.

  • Labels are encoded using one-hot encoding.

  • The dataset is split into training and testing sets using a specified test size.

Convolutional Neural Network (CNN) Model

  • The CNN model is created using the Sequential API from Keras.

  • It consists of convolutional layers, max-pooling layers, and fully connected layers.

  • Data augmentation techniques are applied to improve model generalization. These include rotation, zoom, and shift range, along with horizontal and vertical flips.

  • The model is compiled using the Adam optimizer and categorical cross-entropy loss.

  • Training parameters such as batch size and number of epochs can be adjusted as needed.

Model Training

  • The model is trained using the model.fit_generator method with data generated by the ImageDataGenerator.

  • Training progress is displayed with loss and accuracy metrics.

Evaluation

  • The trained model is evaluated using a randomly selected set of test images.

  • Predicted categories are compared with the ground truth labels.

  • Images are displayed with green labels for correct predictions and red labels for incorrect predictions.

Usage

  1. Make sure you have installed all the required libraries.

  2. Set the folder_dir variable to your dataset directory and adjust the SIZE variable if necessary.

  3. Run the code.

  4. Monitor training progress and evaluate model performance on test images.

Feel free to experiment with different hyperparameters and data augmentation techniques to improve model accuracy.

Happy flower classification!

About

This project demonstrates flower classification using Convolutional Neural Networks (CNN) with TensorFlow and Keras. It involves encoding and splitting the data into training and test sets, building a CNN model, and evaluating its performance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages