Deep learning model built with VGG16 to classify fruit images efficiently with minimal training data.
This project focuses on the development of a fruit classification system using transfer learning with the pre-trained VGG16 model. The model was fine-tuned on a custom fruit image dataset to classify different fruit categories while minimizing data and computation requirements.
The system achieves high accuracy by leveraging learned ImageNet features and retraining only the top layers. The project includes performance evaluation, accuracy visualization, and prediction testing on sample images.
Sample predictions and classification results:
from tensorflow.keras.applications import VGG16
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten
from tensorflow.keras.preprocessing.image import ImageDataGenerator
base_model = VGG16(weights='imagenet', include_top=False, input_shape=(224,224,3))
base_model.trainable = False # Freeze convolutional layers
model = Sequential([
base_model,
Flatten(),
Dense(256, activation='relu'),
Dense(5, activation='softmax') # Example: 5 fruit classes
])
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
The transfer learning model achieved strong accuracy while using a small dataset. Its ability to generalize well across fruit categories makes it suitable for educational purposes and lightweight real-world applications.