File size: 3,253 Bytes
202e9d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python3
"""
Quick script to examine the food datasets
"""

import os
from datasets import load_dataset

# Get base directory
base_dir = os.path.dirname(os.path.abspath(__file__))

print("=" * 60)
print("FOOD DATASETS EXAMINATION")
print("=" * 60)

# Check Food-102 Dataset
print("\n1. FOOD-102 DATASET")
print("-" * 60)
try:
    food102_dir = os.path.join(base_dir, 'food102', 'data')
    food102_files = []
    if os.path.exists(food102_dir):
        for f in os.listdir(food102_dir):
            if f.endswith('.parquet'):
                food102_files.append(os.path.join(food102_dir, f))
    
    if food102_files:
        # Load just one file to see structure
        ds = load_dataset('parquet', data_files=food102_files[:1])
        print(f"✅ Successfully loaded Food-102 dataset")
        print(f"   Columns: {ds['train'].column_names}")
        print(f"   Num samples (in first file): {len(ds['train'])}")
        print(f"   Total parquet files: {len(food102_files)}")
        
        # Show first sample
        sample = ds['train'][0]
        print(f"   Sample keys: {list(sample.keys())}")
        if 'label' in sample:
            print(f"   Label type: {type(sample['label'])}")
            print(f"   Sample label: {sample['label']}")
except Exception as e:
    print(f"❌ Error loading Food-102: {e}")

# Check Multi-label Food Recognition
print("\n2. MULTI-LABEL FOOD RECOGNITION DATASET")
print("-" * 60)
try:
    multi_dir = os.path.join(base_dir, 'multi-label-food-recognition', 'data')
    multi_files = []
    if os.path.exists(multi_dir):
        for f in os.listdir(multi_dir):
            if f.endswith('.parquet'):
                multi_files.append(os.path.join(multi_dir, f))
    
    if multi_files:
        # Load just one file
        ds = load_dataset('parquet', data_files=multi_files[:1])
        print(f"✅ Successfully loaded Multi-label dataset")
        print(f"   Columns: {ds['train'].column_names}")
        print(f"   Num samples (in first file): {len(ds['train'])}")
        print(f"   Total parquet files: {len(multi_files)}")
        
        # Show first sample
        sample = ds['train'][0]
        print(f"   Sample keys: {list(sample.keys())}")
        if 'labels' in sample:
            print(f"   Labels (multi): {sample['labels']}")
        if 'label_names' in sample:
            print(f"   Label names: {sample['label_names']}")
except Exception as e:
    print(f"❌ Error loading Multi-label: {e}")

# Check fooddetection directory
print("\n3. FOODDETECTION DATASET")
print("-" * 60)
try:
    fooddet_dir = os.path.join(base_dir, 'fooddetection')
    if os.path.exists(fooddet_dir):
        items = os.listdir(fooddet_dir)
        print(f"   Directory contents: {items}")
    else:
        print("   Directory not found")
except Exception as e:
    print(f"❌ Error checking fooddetection: {e}")

print("\n" + "=" * 60)
print("SUMMARY:")
print("=" * 60)
print("These datasets can be used to:")
print("1. Fine-tune the EfficientNet model on Food-102 classes")
print("2. Train multi-label detection (multiple foods in one image)")
print("3. Improve accuracy on specific food categories")
print("\nNote: Fine-tuning requires GPU and several hours of training")
print("=" * 60)