AttiqAhmadAfsarMLAssignment3Flask
AttiqAhmadAfsarMLAssignment3Flask
Submitted To:
Dr .Abid Ali
Submitted By:
Course Title:
Deadline:
Dec 7, 2024
Semester:
7th
Report on Flower Species Classification Web Application
Table of Contents
1. Introduction
3. Evaluation
4. Conclusion
5. References
1. Introduction
The goal of this project is to develop a web application using Flask that classifies flowers into species
based on images uploaded by users. The system leverages machine learning algorithms, specifically
Random Forest, trained on the Iris dataset, to predict the species of a flower. The web interface allows
users to upload images, which are then processed and classified by the model. This report provides an
overview of the key steps in implementing this system, including data preprocessing, model training, and
user interface design.
1. Handling Missing Data: Missing values in the dataset are handled using the
`SimpleImputer` class from `sklearn`, replacing missing values with the mean of the column.
2. Normalization: The feature values are normalized using the `StandardScaler` to ensure that all
features are on the same scale, improving the performance of machine learning algorithms.
3. Train-Test Split: The data is divided into training and testing subsets (70% training, 30% testing)
to evaluate model performance effectively.
1. The model was trained on the normalized training data (features and corresponding species
labels).
2. The model was evaluated on the testing set, where its performance was measured using accuracy,
confusion matrix, and other classification metrics.
1. Homepage: The homepage (`index.html`) provides a button for users to upload flower images.
2. File Upload: The file is uploaded via the `upload_file` route, where the image is saved to the
server. The image is processed to extract features, and the model predicts the species based on the
extracted features.
3. Result Display: After classification, the predicted species is displayed on the result page
(`result.html`). Users can upload another image for classification.
1. Accuracy: The accuracy of the model is calculated to measure the proportion of correct
predictions out of the total predictions.
2. Confusion Matrix: The confusion matrix is used to visualize the model’s performance, indicating
how well the model distinguishes between different classes.
3. Classification Report: Precision, recall, and F1-score are calculated for each class to provide
deeper insights into the model’s performance.
3. Evaluation
The system performs reasonably well in predicting flower species. The Random Forest model was chosen
for its ability to handle complex classification tasks with high accuracy. The preprocessing steps ensure
that the dataset is clean and normalized, while the feature extraction from images captures the key
characteristics of the flowers.
1. Accuracy: The model achieved a high classification rate on the test set.
2. Confusion Matrix: The confusion matrix revealed that the model performs equally well in
distinguishing all three flower species.
3. User Experience: The user interface is intuitive and responsive, allowing users to upload images
and receive instant predictions.
4. Screen Shots Of project
Test No:2
File and Folder Structure:
5. Conclusion
This project demonstrates the integration of machine learning with a web-based interface to solve a real-
world classification problem. The use of the Iris dataset, along with Random Forest for classification,
provides an effective solution for predicting flower species based on image features. The system is
userfriendly, robust, and provides accurate results, making it a useful tool for flower species
classification.
6. References
1. Scikit-learn Documentation: [https://scikit-learn.org/](https://scikit-learn.org/)
2. OpenCV Documentation: [https://opencv.org/](https://opencv.org/)