Bahria University, Karachi**We aren't endorsed by this school
Course
BSCS 6A
Subject
Computer Science
Date
Jan 5, 2025
Pages
16
Uploaded by CoachSnakePerson1892
1 FRUIT IMAGE CLASSIFICATION USING A FINE TUNED VGG16 MODEL Subject:ARTIFICIAL INTELLIGENCE Class:BS-CS-6A Teacher Name: Dr. Raheel Siddiqi Group Members: Name Enrollment Abdullah 02-134221-009 Muhammad Wassam Muneeb 02-134221-026 Muhammad Ehtesham Aurangzeb 02-134221-042 Ghulam Habib 02-134221-058 Bahria University Karachi Campus
2 Table of Contents 1.Dataset Expansion 2.Model Training 3.Model Evaluation & Results 4.Application Snippets 5.Code Snippets
3 1.Dataset Expansion 1.1Initial Dataset Details Initially the dataset contains 7 fruit classes: •Apple •Mango •Banana •Orange •Watermelon •Strawberry •Grape •Avocado (Class Added As per Requirement) 1.2Dataset Preprocessing Initially the dataset given is of 100x100 resolution therefore the class added i.e. avocado required transformation according to VGG16 pre-trained model. Image Resizing: All images across the training, validation, and testing sets were resized to 244x244 pixels. Mode Conversion: Images in non-RGB formats were converted to RGB to ensure compatibility with the model. 1.3Dataset Balancing If the image counting in any class is different from other classes, then to balance the dataset, the number of images in that class were made uniform by adding relevant images in class. The final dataset distribution is as follows:
4 Class Training Images Test Images Validation Images Apple 400 80 40 Mango 400 80 40 Banana 400 80 40 Orange 400 80 40 Grape 400 80 40 Avocado 400 80 40 Watermelon 400 80 40 Strawberry 400 80 40 2.Model Training Details 2.1 Architecture The model is built on the VGG16 pre-trained architecture with modifications to the top layers. The final model includes the following layers: 2.1.1VGG16 base (pre-trained on ImageNet, frozen weights) 2.1.2Flatten layer 2.1.3Dense layer with 512 neurons and Relu activation 2.1.4Dropout layer with a rate of 0.5 2.1.5Dense output layer with 8 neurons (softmax activation for the 8 classes) 2.2Hyperparameters 2.2.1Learning Rate: 0.0001 2.2.2Loss Function: Categorical 2.2.3Epochs: 20 2.3Training Curves 2.3.1The model was trained for 20 epochs.
5 Training VS Validation accuracy & loss curves:
6 3.Evaluation Result 3.1Test Set Performance 3.2Confusion Matrix
7 3.3Classification Report 4.APPLICATION SNIPPETS APPLE