Downloads · 30 days
21
6% of all-time downloads
Adriana213/vgg16-fruit-classifier
vgg16-fruit-classifier is a image classification model from Adriana213. Use it when you need a label for an image. It is set up for tf-keras. The card lists the license as mit.
This model is a fine-tuned version of the VGG16 architecture on the Fruits-360 dataset from Kaggle. VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford.…
Downloads · 30 days
21
6% of all-time downloads
All-time downloads
381
Public
Repo size
59.5 MB
Likes
2
Public
Click a slice to open those files.
.data-00000-of-0000159.1 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of the VGG16 architecture on the Fruits-360 dataset from Kaggle. VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford. The model achieves a high level of accuracy in recognizing 131 different types of fruits.
The model was trained and evaluated on the Fruits-360 dataset. This dataset contains over 70,000 images of fruits, split into training and test sets.
Each image is labeled with one of 131 fruit categories.
preprocess_input function from the VGG16 module.The model architecture consists of the VGG16 base with the top fully connected layers removed. A global average pooling layer and a dense output layer with softmax activation were added.
The model was trained for 5 epochs, achieving a validation accuracy of 97.04% and a test accuracy of 96.02%.
These metrics indicate that the model performs very well on the test set of the Fruits-360 dataset.
You can use this model with the following example code:
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.vgg16 import preprocess_input
import numpy as np
# Load the model
model = tf.keras.models.load_model('path_to_model')
# Load an image file that you want to classify
img_path = 'path_to_image'
img = image.load_img(img_path, target_size=(100, 100))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
# Predict the class of the image
predictions = model.predict(x)
predicted_class = np.argmax(predictions, axis=1)
print(f"Predicted class: {predicted_class}")