https://github.com/fpt-thaituan/using-deep-learning-to-classify-fruits-using-the-vgg16-model
Classify 8 types of fruit using the VGG16 model with accuracy up to 90%
https://github.com/fpt-thaituan/using-deep-learning-to-classify-fruits-using-the-vgg16-model
classification cnn computer-vision deep-learning fruits-classification fruits-vgg16 vgg16
Last synced: about 2 months ago
JSON representation
Classify 8 types of fruit using the VGG16 model with accuracy up to 90%
- Host: GitHub
- URL: https://github.com/fpt-thaituan/using-deep-learning-to-classify-fruits-using-the-vgg16-model
- Owner: FPT-ThaiTuan
- Created: 2024-03-21T15:22:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-21T17:24:57.000Z (over 1 year ago)
- Last Synced: 2025-07-26T03:34:31.297Z (2 months ago)
- Topics: classification, cnn, computer-vision, deep-learning, fruits-classification, fruits-vgg16, vgg16
- Language: Jupyter Notebook
- Homepage:
- Size: 68.6 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using deep learning to classify fruits using the VGG16 model
## A. Data preprocessing
Collect data from kaggle [Dataset](https://www.kaggle.com/datasets/karimabdulnabi/fruit-classification10-class)Create training, validation, and test data sets
Reshape the size
Mix photos
Normalize the data to [0,1] and the label converts to One-hot encoding
## B. Build model VGG16
Before you proceed to build the model, you should learn about the VGG16 structure.
The model I built includes:
4 layers Conv2D Layer: This is a convolutional layer, where each unit performs a convolution on the input to extract features. In this code, we use 2 Conv2D layers with 32 and 64 filters of size (3,3) and ReLU activation function.4 layers BatchNormalization Layer: This layer performs normalization of the outputs of previous layers, helping to ensure that the values passed into the next layer are normalized. This improves learning speed and model stability.
2 layers MaxPool2D Layer: This layer performs local pooling on spatial regions of input data, reducing the size of the output and helping to reduce computational costs. In this code, we use MaxPool2D with pool_size=(2,2) and strides=(2,2).
Flatten Layer: This layer flattens data from a 2D matrix into a 1D vector, to prepare for connection with Fully Connected layers.
Dense Layer: This is a Fully Connected layer, in which each unit connects to all units in the previous layer. In this code, we use 2 Dense layers with 512 and 8 units, and the ReLU and softmax activation functions.
## C. Visualize model parameters
The loss of training and validation.
The accuracy of training and validation.

Confusion matrix with data testing.

Classification report.

## D. Save the model and reuse it
## E. Result

### **Hope this article can help you.**
### **If you have any questions please contact me for help!**
### **Gmail: tuanddt.ai.work@gmail.com**### ***Thanks everyone!***