mrdbourke commited on
Commit
13bcdb1
1 Parent(s): 02308ca

manually add class names to script

Browse files
Files changed (1) hide show
  1. food_vision_199_classes.py +207 -6
food_vision_199_classes.py CHANGED
@@ -19,12 +19,213 @@ _LICENSE = "TODO"
19
  _CITATION = "TODO"
20
  _DESCRIPTION = "Images of 199 food classes from the Nutrify app."
21
 
22
- # Download class_names.txt and read it
23
- url = "https://huggingface.co/datasets/mrdbourke/food_vision_199_classes/blob/main/class_names.txt"
24
- r = requests.get(url, allow_redirects=True)
25
- open("class_names.txt", "wb").write(r.content)
26
- with open("class_names.txt", "r") as f:
27
- _NAMES = f.read().splitlines()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  # Create Food199 class
30
  class Food199(datasets.GeneratorBasedBuilder):
 
19
  _CITATION = "TODO"
20
  _DESCRIPTION = "Images of 199 food classes from the Nutrify app."
21
 
22
+ # # Download class_names.txt and read it
23
+ # url = "https://huggingface.co/datasets/mrdbourke/food_vision_199_classes/blob/main/class_names.txt"
24
+ # r = requests.get(url, allow_redirects=True)
25
+ # open("class_names.txt", "wb").write(r.content)
26
+ # with open("class_names.txt", "r") as f:
27
+ # _NAMES = f.read().splitlines()
28
+
29
+ # Create list of class names
30
+ _NAMES = ['almond_butter',
31
+ 'almonds',
32
+ 'apple',
33
+ 'apricot',
34
+ 'asparagus',
35
+ 'avocado',
36
+ 'bacon',
37
+ 'bacon_and_egg_burger',
38
+ 'bagel',
39
+ 'baklava',
40
+ 'banana',
41
+ 'banana_bread',
42
+ 'barbecue_sauce',
43
+ 'beans',
44
+ 'beef',
45
+ 'beef_curry',
46
+ 'beef_mince',
47
+ 'beef_stir_fry',
48
+ 'beer',
49
+ 'beetroot',
50
+ 'biltong',
51
+ 'blackberries',
52
+ 'blueberries',
53
+ 'bok_choy',
54
+ 'bread',
55
+ 'broccoli',
56
+ 'broccolini',
57
+ 'brownie',
58
+ 'brussel_sprouts',
59
+ 'burrito',
60
+ 'butter',
61
+ 'cabbage',
62
+ 'calamari',
63
+ 'candy',
64
+ 'capsicum',
65
+ 'carrot',
66
+ 'cashews',
67
+ 'cauliflower',
68
+ 'celery',
69
+ 'cheese',
70
+ 'cheeseburger',
71
+ 'cherries',
72
+ 'chicken_breast',
73
+ 'chicken_thighs',
74
+ 'chicken_wings',
75
+ 'chilli',
76
+ 'chimichurri',
77
+ 'chocolate',
78
+ 'chocolate_cake',
79
+ 'coconut',
80
+ 'coffee',
81
+ 'coleslaw',
82
+ 'cookies',
83
+ 'coriander',
84
+ 'corn',
85
+ 'corn_chips',
86
+ 'cream',
87
+ 'croissant',
88
+ 'crumbed_chicken',
89
+ 'cucumber',
90
+ 'cupcake',
91
+ 'daikon_radish',
92
+ 'dates',
93
+ 'donuts',
94
+ 'dragonfruit',
95
+ 'eggplant',
96
+ 'eggs',
97
+ 'enoki_mushroom',
98
+ 'fennel',
99
+ 'figs',
100
+ 'french_toast',
101
+ 'fried_rice',
102
+ 'fries',
103
+ 'fruit_juice',
104
+ 'garlic',
105
+ 'garlic_bread',
106
+ 'ginger',
107
+ 'goji_berries',
108
+ 'granola',
109
+ 'grapefruit',
110
+ 'grapes',
111
+ 'green_beans',
112
+ 'green_onion',
113
+ 'guacamole',
114
+ 'guava',
115
+ 'gyoza',
116
+ 'ham',
117
+ 'honey',
118
+ 'hot_chocolate',
119
+ 'ice_coffee',
120
+ 'ice_cream',
121
+ 'iceberg_lettuce',
122
+ 'jerusalem_artichoke',
123
+ 'kale',
124
+ 'karaage_chicken',
125
+ 'kimchi',
126
+ 'kiwi_fruit',
127
+ 'lamb_chops',
128
+ 'leek',
129
+ 'lemon',
130
+ 'lentils',
131
+ 'lettuce',
132
+ 'lime',
133
+ 'mandarin',
134
+ 'mango',
135
+ 'maple_syrup',
136
+ 'mashed_potato',
137
+ 'mayonnaise',
138
+ 'milk',
139
+ 'miso_soup',
140
+ 'mushrooms',
141
+ 'nectarines',
142
+ 'noodles',
143
+ 'nuts',
144
+ 'olive_oil',
145
+ 'olives',
146
+ 'omelette',
147
+ 'onion',
148
+ 'orange',
149
+ 'orange_juice',
150
+ 'oysters',
151
+ 'pain_au_chocolat',
152
+ 'pancakes',
153
+ 'papaya',
154
+ 'parsley',
155
+ 'parsnips',
156
+ 'passionfruit',
157
+ 'pasta',
158
+ 'pawpaw',
159
+ 'peach',
160
+ 'pear',
161
+ 'peas',
162
+ 'pickles',
163
+ 'pineapple',
164
+ 'pizza',
165
+ 'plum',
166
+ 'pomegranate',
167
+ 'popcorn',
168
+ 'pork_belly',
169
+ 'pork_chop',
170
+ 'pork_loins',
171
+ 'porridge',
172
+ 'potato_bake',
173
+ 'potato_chips',
174
+ 'potato_scallop',
175
+ 'potatoes',
176
+ 'prawns',
177
+ 'pumpkin',
178
+ 'radish',
179
+ 'ramen',
180
+ 'raspberries',
181
+ 'red_onion',
182
+ 'red_wine',
183
+ 'rhubarb',
184
+ 'rice',
185
+ 'roast_beef',
186
+ 'roast_pork',
187
+ 'roast_potatoes',
188
+ 'rockmelon',
189
+ 'rosemary',
190
+ 'salad',
191
+ 'salami',
192
+ 'salmon',
193
+ 'salsa',
194
+ 'salt',
195
+ 'sandwich',
196
+ 'sardines',
197
+ 'sausage_roll',
198
+ 'sausages',
199
+ 'scrambled_eggs',
200
+ 'seaweed',
201
+ 'shallots',
202
+ 'snow_peas',
203
+ 'soda',
204
+ 'soy_sauce',
205
+ 'spaghetti_bolognese',
206
+ 'spinach',
207
+ 'sports_drink',
208
+ 'squash',
209
+ 'starfruit',
210
+ 'steak',
211
+ 'strawberries',
212
+ 'sushi',
213
+ 'sweet_potato',
214
+ 'tacos',
215
+ 'tamarillo',
216
+ 'taro',
217
+ 'tea',
218
+ 'toast',
219
+ 'tofu',
220
+ 'tomato',
221
+ 'tomato_chutney',
222
+ 'tomato_sauce',
223
+ 'turnip',
224
+ 'watermelon',
225
+ 'white_onion',
226
+ 'white_wine',
227
+ 'yoghurt',
228
+ 'zucchini']
229
 
230
  # Create Food199 class
231
  class Food199(datasets.GeneratorBasedBuilder):