Datasets:
image
imagewidth (px) 93
7.36k
| label
stringclasses 90
values | label_id
int64 0
89
|
|---|---|---|
vanilla_yoghurt
| 85
|
|
spinach
| 74
|
|
beetroot
| 6
|
|
apple
| 1
|
|
soybean
| 72
|
|
grapes
| 29
|
|
oat_milk
| 45
|
|
tomato
| 81
|
|
beetroot
| 6
|
|
jalapeno
| 30
|
|
mandarin_juice
| 36
|
|
broccoli
| 13
|
|
radish
| 63
|
|
tomato
| 81
|
|
fig
| 24
|
|
orange
| 50
|
|
kiwi
| 31
|
|
bell_pepper
| 7
|
|
jalapeno
| 30
|
|
eggplant
| 23
|
|
garlic
| 25
|
|
carrot
| 16
|
|
pear
| 56
|
|
jalapeno
| 30
|
|
banana
| 5
|
|
apple
| 1
|
|
pomegranate
| 60
|
|
apple_juice
| 2
|
|
golden_grapefruit_juice
| 27
|
|
turnip
| 82
|
|
leek
| 32
|
|
bell_pepper
| 7
|
|
red_grapefruit_juice
| 66
|
|
lettuce
| 34
|
|
grapes
| 29
|
|
corn
| 20
|
|
cauliflower
| 17
|
|
bell_pepper
| 7
|
|
lemon
| 33
|
|
oat_milk
| 45
|
|
cauliflower
| 17
|
|
nectarine
| 44
|
|
pomegranate
| 60
|
|
lemon
| 33
|
|
mushroom
| 41
|
|
bell_pepper
| 7
|
|
spinach
| 74
|
|
dragon_fruit
| 22
|
|
sponge_gourd
| 76
|
|
chili_pepper
| 18
|
|
carrot
| 16
|
|
potato
| 61
|
|
grapefruit_juice
| 28
|
|
banana
| 5
|
|
apple
| 1
|
|
pomegranate
| 60
|
|
eggplant
| 23
|
|
sour_cream
| 69
|
|
melon
| 38
|
|
plum
| 59
|
|
pear
| 56
|
|
yoghurt
| 88
|
|
bell_pepper
| 7
|
|
bell_pepper
| 7
|
|
lemon
| 33
|
|
chili_pepper
| 18
|
|
milk
| 39
|
|
lemon
| 33
|
|
soybean
| 72
|
|
kiwi
| 31
|
|
orange_red_grapefruit_juice
| 52
|
|
spinach
| 74
|
|
pear
| 56
|
|
natural_yogurt
| 43
|
|
lemon
| 33
|
|
potato
| 61
|
|
apple
| 1
|
|
pineapple
| 58
|
|
avocado
| 4
|
|
orange
| 50
|
|
mango
| 37
|
|
eggplant
| 23
|
|
melon
| 38
|
|
ginger
| 26
|
|
mandarin_juice
| 36
|
|
radish
| 63
|
|
satsuma
| 68
|
|
bell_pepper
| 7
|
|
cucumber
| 21
|
|
eggplant
| 23
|
|
cabbage
| 14
|
|
soy_milk
| 71
|
|
orange_juice
| 51
|
|
soybean
| 72
|
|
bottle_gourd
| 12
|
|
oatghurt
| 47
|
|
bottle_gourd
| 12
|
|
apple
| 1
|
|
yoghurt
| 88
|
|
bell_pepper
| 7
|
Merged Raw Food Recognition Dataset
Dataset Description
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.
Purpose
This dataset is created for educational purposes only to support research and learning in computer vision and food recognition applications.
Dataset Statistics
- Total Classes: 90+ food categories
- Total Images: ~15,000+ images
- Train/Validation Split: 80/20 ratio
- Image Format: JPEG/PNG
- Image Resolution: Variable (typically 224x224 or higher)
Dataset Structure
The dataset is organized into train and validation splits:
- train: 80% of the data (~12,000 images)
- validation: 20% of the data (~3,000 images)
Each sample contains:
image: PIL Image object of the food itemlabel: String label indicating the food category (e.g., "apple", "banana", "carrot")label_id: Integer ID corresponding to the label (0 to num_classes-1)
Source Datasets
This merged dataset combines images from the following three sources:
1. Food and Vegetables Dataset
- Source: SunnyAgarwal4274/Food_and_Vegetables
- Description: A collection of food and vegetable images for classification tasks
- License: Please refer to the original dataset repository
2. Fruit and Vegetable Image Recognition Dataset
- Source: Nattakarn/fruit-and-vegetable-image-recognition
- Description: A dataset focused on fruit and vegetable recognition
- License: Please refer to the original dataset repository
3. Grocery Store Dataset
- Source: Kaggle - Grocery Store Dataset
- Description: A comprehensive grocery store product dataset including various food items
- License: Please refer to the original Kaggle dataset license
Merging Process
The datasets were merged using the following methodology:
- Data Collection: Images from all three source datasets were collected and organized by food category
- Label Standardization: Food categories were standardized across datasets (e.g., "yogurt" and "yoghurt" variants were preserved as separate classes to maintain dataset diversity)
- Deduplication: Duplicate images were identified and removed where possible
- Class Consolidation: Similar food items were grouped into consistent categories
- Stratified Splitting: The merged dataset was split into training (80%) and validation (20%) sets using stratified sampling to maintain class distribution
- Format Conversion: Images were converted to a unified format suitable for HuggingFace Datasets and saved in Parquet format for efficient storage and access
Food Categories
The dataset includes the following categories (sample):
- Fruits: apple, banana, orange, strawberry, grapes, mango, kiwi, watermelon, etc.
- Vegetables: carrot, tomato, potato, onion, broccoli, cauliflower, spinach, etc.
- Dairy Products: milk, yogurt (various flavors), sour cream, etc.
- Beverages: apple juice, orange juice, grapefruit juice, soy milk, oat milk, etc.
- Specialty Items: Various gourds (bottle gourd, bitter gourd, ridge gourd), exotic fruits (dragon fruit, passion fruit), etc.
For a complete list of all 90+ categories, please refer to the dataset's class mapping file.
Usage
Loading the Dataset
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("your-username/dataset-name")
# Access train and validation splits
train_dataset = dataset['train']
val_dataset = dataset['validation']
# Example: Get a sample
sample = train_dataset[0]
image = sample['image']
label = sample['label']
label_id = sample['label_id']
Using with PyTorch
from datasets import load_dataset
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
# Load dataset
dataset = load_dataset("your-username/dataset-name")
# Define transforms
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
# Apply transforms
def transform_image(examples):
examples['image'] = [transform(img.convert('RGB')) for img in examples['image']]
return examples
train_dataset = dataset['train'].with_transform(transform_image)
val_dataset = dataset['validation'].with_transform(transform_image)
# Create data loaders
train_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)
val_loader = DataLoader(val_dataset, batch_size=32, shuffle=False)
Using with TensorFlow/Keras
from datasets import load_dataset
import tensorflow as tf
# Load dataset
dataset = load_dataset("your-username/dataset-name")
# Convert to TensorFlow format
train_tf = dataset['train'].to_tf_dataset(
columns=['image'],
label_cols=['label_id'],
batch_size=32,
shuffle=True
)
Dataset Characteristics
- Diversity: Images from multiple sources ensure diversity in lighting, backgrounds, and image quality
- Class Balance: Stratified splitting maintains class distribution across train/validation splits
- Real-world Variability: Includes natural variations in food appearance, ripeness, and presentation
- Educational Focus: Curated specifically for learning and research purposes
- Parquet Format: Data is stored in Parquet format for efficient storage and fast loading
Limitations and Considerations
- Class Imbalance: Some food categories may have more samples than others
- Image Quality: Images come from different sources with varying quality and resolution
- Label Variants: Some food items have multiple label variants (e.g., "yogurt" vs "yoghurt") preserved for dataset diversity
- Educational Purpose: This dataset is intended for educational use only
Citation
If you use this dataset in your research or educational projects, please cite the original source datasets:
@dataset{food_recognition_merged,
title={Merged Raw Food Recognition Dataset},
author={Your Name},
year={2024},
note={Combined from: SunnyAgarwal4274/Food_and_Vegetables,
Nattakarn/fruit-and-vegetable-image-recognition,
and Kaggle Grocery Store Dataset}
}
License
This dataset is provided for educational purposes only. Please refer to the original source datasets for their respective licenses and terms of use.
Acknowledgments
We gratefully acknowledge the creators and contributors of the source datasets:
- SunnyAgarwal4274 for the Food and Vegetables dataset
- Nattakarn for the Fruit and Vegetable Image Recognition dataset
- The Kaggle community for the Grocery Store Dataset
Contact
For questions or issues regarding this dataset, please open an issue in the repository.
Updates
- 2024: Initial release with 90+ food categories and 80/20 train/validation split in Parquet format
- Downloads last month
- 127