Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -41,17 +41,70 @@ We investigate domain adaptation of MLLMs through post-training, focusing on dat
|
|
41 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/650801ced5578ef7e20b33d4/-Jp7pAsCR2Tj4WwfwsbCo.png" width="600">
|
42 |
</p>
|
43 |
|
44 |
-
## How to
|
45 |
|
|
|
|
|
46 |
```python
|
47 |
from datasets import load_dataset
|
48 |
|
49 |
# Choose the task name from the list of available tasks
|
50 |
-
task_name = 'FoodSeg103'
|
51 |
|
52 |
# Load the dataset for the chosen task
|
53 |
data = load_dataset('AdaptLLM/food-VQA-benchmark', task_name, split='test')
|
54 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
## Citation
|
57 |
If you find our work helpful, please cite us.
|
|
|
41 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/650801ced5578ef7e20b33d4/-Jp7pAsCR2Tj4WwfwsbCo.png" width="600">
|
42 |
</p>
|
43 |
|
44 |
+
## How to Use
|
45 |
|
46 |
+
### Loading Data
|
47 |
+
You can load datasets using the `datasets` library:
|
48 |
```python
|
49 |
from datasets import load_dataset
|
50 |
|
51 |
# Choose the task name from the list of available tasks
|
52 |
+
task_name = 'FoodSeg103' # Options: 'Food101', 'FoodSeg103', 'Nutrition5K', 'Recipe1M'
|
53 |
|
54 |
# Load the dataset for the chosen task
|
55 |
data = load_dataset('AdaptLLM/food-VQA-benchmark', task_name, split='test')
|
56 |
+
```
|
57 |
+
|
58 |
+
### Mapping Categories to Indices
|
59 |
+
The mapping between category names and indices for `Food101`, `FoodSeg103`, and `Nutrition5K` datasets is provided in the following files:
|
60 |
+
- **Food101**: `food101_name_to_label_map.json`
|
61 |
+
- **FoodSeg103**: `foodSeg103_id2label.json`
|
62 |
+
- **Nutrition5K**: `nutrition5k_ingredients.py`
|
63 |
+
|
64 |
+
### Examples of Usage
|
65 |
+
|
66 |
+
#### Food101
|
67 |
+
```python
|
68 |
+
import json
|
69 |
+
|
70 |
+
# Load the mapping file
|
71 |
+
map_path = 'food101_name_to_label_map.json'
|
72 |
+
name_to_label_map = json.load(open(map_path))
|
73 |
+
|
74 |
+
# Reverse mapping: label to name
|
75 |
+
label_to_name_map = {value: key.replace('_', ' ') for key, value in name_to_label_map.items()}
|
76 |
+
```
|
77 |
+
|
78 |
+
#### FoodSeg103
|
79 |
+
```python
|
80 |
+
import json
|
81 |
+
|
82 |
+
# Load the mapping file
|
83 |
+
map_path = 'foodSeg103_id2label.json'
|
84 |
+
id2name_map = json.load(open(map_path))
|
85 |
+
|
86 |
+
# Remove background and irrelevant labels
|
87 |
+
id2name_map.pop("0") # Background
|
88 |
+
id2name_map.pop("103") # Other ingredients
|
89 |
+
|
90 |
+
# Convert keys to integers
|
91 |
+
id2name_map = {int(key): value for key, value in id2name_map.items()}
|
92 |
+
|
93 |
+
# Create reverse mapping: name to ID
|
94 |
+
name2id_map = {value: key for key, value in id2name_map.items()}
|
95 |
+
```
|
96 |
+
|
97 |
+
#### Nutrition5K
|
98 |
+
```python
|
99 |
+
from nutrition5k_ingredients import all_ingredients
|
100 |
+
|
101 |
+
# Create mappings
|
102 |
+
id2name_map = dict(zip(range(0, len(all_ingredients)), all_ingredients))
|
103 |
+
name2id_map = {value: key for key, value in id2name_map.items()}
|
104 |
+
```
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
|
109 |
## Citation
|
110 |
If you find our work helpful, please cite us.
|