ibrahimdaud commited on
Commit
d689bd7
·
verified ·
1 Parent(s): 8c27bc9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +207 -26
README.md CHANGED
@@ -1,26 +1,207 @@
1
- ---
2
- dataset_info:
3
- features:
4
- - name: image
5
- dtype: image
6
- - name: label
7
- dtype: string
8
- - name: label_id
9
- dtype: int64
10
- splits:
11
- - name: train
12
- num_bytes: 2555398176
13
- num_examples: 10004
14
- - name: validation
15
- num_bytes: 702886155
16
- num_examples: 2501
17
- download_size: 3096220931
18
- dataset_size: 3258284331
19
- configs:
20
- - config_name: default
21
- data_files:
22
- - split: train
23
- path: data/train-*
24
- - split: validation
25
- path: data/validation-*
26
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - image-classification
5
+ tags:
6
+ - food
7
+ - vegetables
8
+ - fruits
9
+ - recognition
10
+ - classification
11
+ - raw-food
12
+ - educational
13
+ size_categories:
14
+ - 10K<n<100K
15
+ ---
16
+
17
+ # Merged Raw Food Recognition Dataset
18
+
19
+ ## Dataset Description
20
+
21
+ This dataset is a comprehensive compilation of three publicly available food recognition datasets, merged and curated for raw food recognition tasks. The dataset contains images of various raw food items including fruits, vegetables, dairy products, and beverages, intended for educational purposes and the development of image recognition models.
22
+
23
+ ### Purpose
24
+
25
+ This dataset is created for **educational purposes only** to support research and learning in computer vision and food recognition applications.
26
+
27
+ ## Dataset Statistics
28
+
29
+ - **Total Classes**: 90+ food categories
30
+ - **Total Images**: ~15,000+ images
31
+ - **Train/Validation Split**: 80/20 ratio
32
+ - **Image Format**: JPEG/PNG
33
+ - **Image Resolution**: Variable (typically 224x224 or higher)
34
+
35
+ ## Dataset Structure
36
+
37
+ The dataset is organized into train and validation splits:
38
+
39
+ - **train**: 80% of the data (~12,000 images)
40
+ - **validation**: 20% of the data (~3,000 images)
41
+
42
+ Each sample contains:
43
+ - `image`: PIL Image object of the food item
44
+ - `label`: String label indicating the food category (e.g., "apple", "banana", "carrot")
45
+ - `label_id`: Integer ID corresponding to the label (0 to num_classes-1)
46
+
47
+ ## Source Datasets
48
+
49
+ This merged dataset combines images from the following three sources:
50
+
51
+ ### 1. Food and Vegetables Dataset
52
+ - **Source**: [SunnyAgarwal4274/Food_and_Vegetables](https://huggingface.co/datasets/SunnyAgarwal4274/Food_and_Vegetables)
53
+ - **Description**: A collection of food and vegetable images for classification tasks
54
+ - **License**: Please refer to the original dataset repository
55
+
56
+ ### 2. Fruit and Vegetable Image Recognition Dataset
57
+ - **Source**: [Nattakarn/fruit-and-vegetable-image-recognition](https://huggingface.co/datasets/Nattakarn/fruit-and-vegetable-image-recognition)
58
+ - **Description**: A dataset focused on fruit and vegetable recognition
59
+ - **License**: Please refer to the original dataset repository
60
+
61
+ ### 3. Grocery Store Dataset
62
+ - **Source**: [Kaggle - Grocery Store Dataset](https://www.kaggle.com/datasets/validmodel/grocery-store-dataset/data)
63
+ - **Description**: A comprehensive grocery store product dataset including various food items
64
+ - **License**: Please refer to the original Kaggle dataset license
65
+
66
+ ## Merging Process
67
+
68
+ The datasets were merged using the following methodology:
69
+
70
+ 1. **Data Collection**: Images from all three source datasets were collected and organized by food category
71
+ 2. **Label Standardization**: Food categories were standardized across datasets (e.g., "yogurt" and "yoghurt" variants were preserved as separate classes to maintain dataset diversity)
72
+ 3. **Deduplication**: Duplicate images were identified and removed where possible
73
+ 4. **Class Consolidation**: Similar food items were grouped into consistent categories
74
+ 5. **Stratified Splitting**: The merged dataset was split into training (80%) and validation (20%) sets using stratified sampling to maintain class distribution
75
+ 6. **Format Conversion**: Images were converted to a unified format suitable for HuggingFace Datasets and saved in Parquet format for efficient storage and access
76
+
77
+ ## Food Categories
78
+
79
+ The dataset includes the following categories (sample):
80
+
81
+ - **Fruits**: apple, banana, orange, strawberry, grapes, mango, kiwi, watermelon, etc.
82
+ - **Vegetables**: carrot, tomato, potato, onion, broccoli, cauliflower, spinach, etc.
83
+ - **Dairy Products**: milk, yogurt (various flavors), sour cream, etc.
84
+ - **Beverages**: apple juice, orange juice, grapefruit juice, soy milk, oat milk, etc.
85
+ - **Specialty Items**: Various gourds (bottle gourd, bitter gourd, ridge gourd), exotic fruits (dragon fruit, passion fruit), etc.
86
+
87
+ For a complete list of all 90+ categories, please refer to the dataset's class mapping file.
88
+
89
+ ## Usage
90
+
91
+ ### Loading the Dataset
92
+
93
+ ```python
94
+ from datasets import load_dataset
95
+
96
+ # Load the dataset
97
+ dataset = load_dataset("your-username/dataset-name")
98
+
99
+ # Access train and validation splits
100
+ train_dataset = dataset['train']
101
+ val_dataset = dataset['validation']
102
+
103
+ # Example: Get a sample
104
+ sample = train_dataset[0]
105
+ image = sample['image']
106
+ label = sample['label']
107
+ label_id = sample['label_id']
108
+ ```
109
+
110
+ ### Using with PyTorch
111
+
112
+ ```python
113
+ from datasets import load_dataset
114
+ from torch.utils.data import DataLoader
115
+ import torchvision.transforms as transforms
116
+
117
+ # Load dataset
118
+ dataset = load_dataset("your-username/dataset-name")
119
+
120
+ # Define transforms
121
+ transform = transforms.Compose([
122
+ transforms.Resize((224, 224)),
123
+ transforms.ToTensor(),
124
+ transforms.Normalize(mean=[0.485, 0.456, 0.406],
125
+ std=[0.229, 0.224, 0.225])
126
+ ])
127
+
128
+ # Apply transforms
129
+ def transform_image(examples):
130
+ examples['image'] = [transform(img.convert('RGB')) for img in examples['image']]
131
+ return examples
132
+
133
+ train_dataset = dataset['train'].with_transform(transform_image)
134
+ val_dataset = dataset['validation'].with_transform(transform_image)
135
+
136
+ # Create data loaders
137
+ train_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)
138
+ val_loader = DataLoader(val_dataset, batch_size=32, shuffle=False)
139
+ ```
140
+
141
+ ### Using with TensorFlow/Keras
142
+
143
+ ```python
144
+ from datasets import load_dataset
145
+ import tensorflow as tf
146
+
147
+ # Load dataset
148
+ dataset = load_dataset("your-username/dataset-name")
149
+
150
+ # Convert to TensorFlow format
151
+ train_tf = dataset['train'].to_tf_dataset(
152
+ columns=['image'],
153
+ label_cols=['label_id'],
154
+ batch_size=32,
155
+ shuffle=True
156
+ )
157
+ ```
158
+
159
+ ## Dataset Characteristics
160
+
161
+ - **Diversity**: Images from multiple sources ensure diversity in lighting, backgrounds, and image quality
162
+ - **Class Balance**: Stratified splitting maintains class distribution across train/validation splits
163
+ - **Real-world Variability**: Includes natural variations in food appearance, ripeness, and presentation
164
+ - **Educational Focus**: Curated specifically for learning and research purposes
165
+ - **Parquet Format**: Data is stored in Parquet format for efficient storage and fast loading
166
+
167
+ ## Limitations and Considerations
168
+
169
+ 1. **Class Imbalance**: Some food categories may have more samples than others
170
+ 2. **Image Quality**: Images come from different sources with varying quality and resolution
171
+ 3. **Label Variants**: Some food items have multiple label variants (e.g., "yogurt" vs "yoghurt") preserved for dataset diversity
172
+ 4. **Educational Purpose**: This dataset is intended for educational use only
173
+
174
+ ## Citation
175
+
176
+ If you use this dataset in your research or educational projects, please cite the original source datasets:
177
+
178
+ ```bibtex
179
+ @dataset{food_recognition_merged,
180
+ title={Merged Raw Food Recognition Dataset},
181
+ author={Your Name},
182
+ year={2024},
183
+ note={Combined from: SunnyAgarwal4274/Food_and_Vegetables,
184
+ Nattakarn/fruit-and-vegetable-image-recognition,
185
+ and Kaggle Grocery Store Dataset}
186
+ }
187
+ ```
188
+
189
+ ## License
190
+
191
+ This dataset is provided for **educational purposes only**. Please refer to the original source datasets for their respective licenses and terms of use.
192
+
193
+ ## Acknowledgments
194
+
195
+ We gratefully acknowledge the creators and contributors of the source datasets:
196
+ - SunnyAgarwal4274 for the Food and Vegetables dataset
197
+ - Nattakarn for the Fruit and Vegetable Image Recognition dataset
198
+ - The Kaggle community for the Grocery Store Dataset
199
+
200
+ ## Contact
201
+
202
+ For questions or issues regarding this dataset, please open an issue in the repository.
203
+
204
+ ## Updates
205
+
206
+ - **2024**: Initial release with 90+ food categories and 80/20 train/validation split in Parquet format
207
+