Adriana213 commited on
Commit
f3ac212
1 Parent(s): 867056b

Update Model Card

Browse files
Files changed (1) hide show
  1. README.md +88 -10
README.md CHANGED
@@ -1,16 +1,94 @@
1
-
2
  ---
 
 
 
 
 
 
 
3
  tags:
4
  - image-classification
5
- - keras
6
- - tensorflow
7
- license: apache-2.0
8
- datasets:
9
- - fruits-360
10
- metrics:
11
- - accuracy
12
  ---
13
 
14
- # VGG16 Fruit Classifier
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- This is a VGG16 model fine-tuned on the Fruits-360 dataset for image classification.
 
 
 
 
 
1
  ---
2
+ model: vgg16-fruits-classifier
3
+ base_model: VGG16
4
+ dataset: fruits-360
5
+ metrics:
6
+ - accuracy: 96.02%
7
+ - loss: 0.1585
8
+ license: mit
9
  tags:
10
  - image-classification
11
+ - food
12
+ - fruit-recognition
13
+ - transfer-learning
14
+ library_name: keras
 
 
 
15
  ---
16
 
17
+ # VGG16 Fruits Classifier
18
+
19
+ ## Model Description
20
+
21
+ 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.
22
+
23
+ ## Intended Uses & Limitations
24
+
25
+ ### Intended Uses
26
+ - **Food Recognition**: This model can be used to classify images of fruits into one of 131 categories. It is particularly useful for applications in grocery stores, dietary monitoring, and educational tools about fruits.
27
+
28
+ ### Limitations
29
+ - **Generalization**: The model is trained specifically on the Fruits-360 dataset and may not generalize well to fruits not included in this dataset or images with significantly different characteristics (e.g., different lighting, angles, or backgrounds).
30
+ - **Biases**: Performance may vary across different fruit categories due to the distribution and quality of the dataset images.
31
+
32
+ ## Training and Evaluation Data
33
+
34
+ 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.
35
+
36
+ ### Dataset Statistics
37
+ - **Training Set**: 54,190 images
38
+ - **Validation Set**: 13,502 images
39
+ - **Test Set**: 22,688 images
40
+
41
+ Each image is labeled with one of 131 fruit categories.
42
+
43
+ ## Training Procedure
44
+
45
+ ### Data Augmentation
46
+ - **Preprocessing**: All images were preprocessed using the `preprocess_input` function from the VGG16 module.
47
+ - **Augmentation**: Images were augmented with random rotations, shifts, zooms, flips, and more to improve the model's generalization.
48
+
49
+ ### Model Architecture
50
+ 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.
51
+
52
+ ### Hyperparameters
53
+ - **Optimizer**: Adam with a learning rate of 0.0001
54
+ - **Loss Function**: Categorical Crossentropy
55
+ - **Batch Size**: 64
56
+ - **Epochs**: 5
57
+
58
+ ### Training Results
59
+ The model was trained for 5 epochs, achieving a validation accuracy of 97.04% and a test accuracy of 96.02%.
60
+
61
+ ## Evaluation Metrics
62
+
63
+ - **Accuracy**: 96.02%
64
+ - **Loss**: 0.1585
65
+
66
+ These metrics indicate that the model performs very well on the test set of the Fruits-360 dataset.
67
+
68
+ ## Framework Versions
69
+ - **TensorFlow**: 2.x
70
+ - **Keras**: 2.x
71
+
72
+ ## Example Code
73
+
74
+ You can use this model with the following example code:
75
+
76
+ ```python
77
+ from tensorflow.keras.preprocessing import image
78
+ from tensorflow.keras.applications.vgg16 import preprocess_input
79
+ import numpy as np
80
+
81
+ # Load the model
82
+ model = tf.keras.models.load_model('path_to_model')
83
+
84
+ # Load an image file that you want to classify
85
+ img_path = 'path_to_image'
86
+ img = image.load_img(img_path, target_size=(100, 100))
87
+ x = image.img_to_array(img)
88
+ x = np.expand_dims(x, axis=0)
89
+ x = preprocess_input(x)
90
 
91
+ # Predict the class of the image
92
+ predictions = model.predict(x)
93
+ predicted_class = np.argmax(predictions, axis=1)
94
+ print(f"Predicted class: {predicted_class}")