@souscheflabs/ml-vision 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +274 -0
  2. package/dist/components/DetectionOverlay.d.ts +57 -0
  3. package/dist/components/DetectionOverlay.js +133 -0
  4. package/dist/components/index.d.ts +4 -0
  5. package/dist/components/index.js +9 -0
  6. package/dist/core/CacheManager.d.ts +168 -0
  7. package/dist/core/CacheManager.js +331 -0
  8. package/dist/core/MLVisionProvider.d.ts +90 -0
  9. package/dist/core/MLVisionProvider.js +188 -0
  10. package/dist/core/ServerClient.d.ts +131 -0
  11. package/dist/core/ServerClient.js +291 -0
  12. package/dist/core/index.d.ts +6 -0
  13. package/dist/core/index.js +18 -0
  14. package/dist/hooks/classLabels.d.ts +35 -0
  15. package/dist/hooks/classLabels.js +439 -0
  16. package/dist/hooks/classLabelsCoco.d.ts +43 -0
  17. package/dist/hooks/classLabelsCoco.js +103 -0
  18. package/dist/hooks/index.d.ts +8 -0
  19. package/dist/hooks/index.js +27 -0
  20. package/dist/hooks/useMultiBarcodeScanner.d.ts +34 -0
  21. package/dist/hooks/useMultiBarcodeScanner.js +290 -0
  22. package/dist/hooks/useProductDetector.d.ts +38 -0
  23. package/dist/hooks/useProductDetector.js +679 -0
  24. package/dist/hooks/useReceiptScanner.d.ts +37 -0
  25. package/dist/hooks/useReceiptScanner.js +405 -0
  26. package/dist/hooks/useVideoScanner.d.ts +118 -0
  27. package/dist/hooks/useVideoScanner.js +383 -0
  28. package/dist/index.d.ts +58 -0
  29. package/dist/index.js +130 -0
  30. package/dist/processors/detectionProcessor.d.ts +86 -0
  31. package/dist/processors/detectionProcessor.js +124 -0
  32. package/dist/processors/index.d.ts +5 -0
  33. package/dist/processors/index.js +16 -0
  34. package/dist/processors/tfliteFrameProcessor.d.ts +90 -0
  35. package/dist/processors/tfliteFrameProcessor.js +213 -0
  36. package/dist/types/barcode.d.ts +91 -0
  37. package/dist/types/barcode.js +19 -0
  38. package/dist/types/detection.d.ts +166 -0
  39. package/dist/types/detection.js +8 -0
  40. package/dist/types/index.d.ts +126 -0
  41. package/dist/types/index.js +25 -0
  42. package/dist/types/ocr.d.ts +202 -0
  43. package/dist/types/ocr.js +8 -0
  44. package/dist/utils/imagePreprocessor.d.ts +85 -0
  45. package/dist/utils/imagePreprocessor.js +304 -0
  46. package/dist/utils/yoloProcessor.d.ts +40 -0
  47. package/dist/utils/yoloProcessor.js +154 -0
  48. package/package.json +78 -0
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+ /**
3
+ * Class label mappings for the trained SousChef YOLOv8 model
4
+ *
5
+ * These labels correspond to the 233 classes in the souschef_coco_finetuned_v1 model.
6
+ * The model was fine-tuned on a dataset of food and kitchen items.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CATEGORY_CLASSES = exports.NUM_CLASSES = exports.CLASS_LABELS = void 0;
10
+ exports.getClassInfo = getClassInfo;
11
+ exports.getLabelsArray = getLabelsArray;
12
+ exports.categorizeLabel = categorizeLabel;
13
+ /**
14
+ * Categorize a food item label
15
+ */
16
+ function categorizeLabel(label) {
17
+ // Produce
18
+ const produce = [
19
+ 'acorn_squash', 'apple', 'asparagus', 'baby_carrots', 'baby_spinach',
20
+ 'banana', 'basil', 'bell_pepper', 'blackberries', 'blueberries',
21
+ 'broccoli', 'brussels_sprouts', 'butternut_squash', 'button_mushrooms',
22
+ 'carrot', 'cauliflower', 'celery', 'cherries', 'cherry_tomatoes',
23
+ 'chives', 'clementine', 'coconut', 'corn', 'cucumber', 'dill',
24
+ 'eggplant', 'english_cucumber', 'fuji_apple', 'garlic', 'ginger',
25
+ 'grapes', 'green_bell_pepper', 'green_onion', 'honeydew_melon',
26
+ 'jalapeno', 'kiwi', 'lemon', 'lettuce', 'lime', 'mango', 'mixed_greens',
27
+ 'mushrooms', 'napa_cabbage', 'onion', 'orange', 'pomegranate', 'potato',
28
+ 'raspberries', 'red_cabbage', 'red_onion', 'roma_tomato', 'romaine_lettuce',
29
+ 'rosemary', 'sage', 'shallot', 'spinach', 'spaghetti_squash',
30
+ 'strawberries', 'sweet_potato', 'tomatillo', 'tomato', 'white_onion',
31
+ 'yellow_onion', 'yellow_squash', 'yukon_gold_potato', 'zucchini',
32
+ 'd_anjou_p_r', 'd_anjou_p_rs_2_pound', 'p_es', 'p_rs', 'pe_s', 'chillies'
33
+ ];
34
+ // Meat & Seafood
35
+ const meat = [
36
+ 'ahi_tuna', 'bacon', 'beef_brisket', 'beef_broth', 'beef_short_ribs',
37
+ 'beef_tenderloin', 'catfish_fillets', 'catfish_fillets_fr_en_big_d_l',
38
+ 'catfish_st_k_sustainably_sourced', 'chicken_drumsticks', 'chicken_legs',
39
+ 'chicken_tenders', 'chicken_thighs', 'chicken_wings', 'chuck_roast',
40
+ 'cod', 'cod_fillet', 'filet_mignon', 'flank_steak', 'ground_beef',
41
+ 'ground_chicken', 'ground_lamb', 'ham', 'lobster', 'pork_belly',
42
+ 'pork_chops', 'pork_loin', 'pork_shoulder', 'pork_tenderloin',
43
+ 'rotisserie_chicken', 'ry_catfish_fillets', 'shrimp', 'sirloin_steak',
44
+ 'smoked_salmon', 'tilapia', 'tilapia_fillet'
45
+ ];
46
+ // Dairy
47
+ const dairy = [
48
+ 'blue_cheese', 'butter', 'cacique_queso_fresco', 'cheddar_cheese',
49
+ 'cr_m', 'egg_whites', 'eggs', 'goat_cheese', 'gouda_cheese',
50
+ 'greek_yogurt', 'h_vy_cr_m', 'half_and_half', 'large_eggs', 'milk',
51
+ 'mozzarella_cheese', 'parmesan_cheese', 'provolone_cheese',
52
+ 'salted_butter', 'shredded_cheese', 'skim_milk', 'sliced_cheese',
53
+ 'soy_milk', 'unsalted_butter', 'vegan_cr_m', 'whole_milk', 'yogurt'
54
+ ];
55
+ // Bakery
56
+ const bakery = [
57
+ 'baguette', 'br_d', 'br_dcrumbs', 'crusty_br_d', 'hot_dog_buns',
58
+ 'ladyfingers_bought_or', 'panko_br_d_crumbs', 'shortcrust_pastry',
59
+ 'white_bread'
60
+ ];
61
+ // Packaged/Pantry
62
+ const packaged = [
63
+ 'all_purpose_flour', 'balsamic_vinegar', 'bbq_sauce', 'blackberry_preserves_seedless',
64
+ 'blackeye_p_s', 'bonne_maman_blackberry_preserves', 'brown_rice', 'brown_sugar',
65
+ 'cardamom_pods', 'chickpeas', 'chilli_flakes', 'citric_acid', 'crushed_tomatoes',
66
+ 'diced_tomatoes', 'double_strength_liquid_rennet', 'extra_virgin_olive_oil',
67
+ 'flour', 'garam_masala', 'garbanzo_b_ns', 'herbs_de_province', 'honey',
68
+ 'hot_sauce', 'jam', 'marinara_sauce', 'mayonnaise', 'mustard',
69
+ 'non_dairy_nutritional_y_st', 'olive_oil', 'on_the_border_monterey_jack_queso',
70
+ 'oregano', 'paprika', 'parchment_pa_to_line_the_baking_pan', 'pasta',
71
+ 'pinto_beans', 'polaner_with_fiber_seedless_blackberry_preserves_g',
72
+ 'powdered_sugar', 'pre_d_pepitas', 'pumpkin_pie_spice_shaker', 'quick_p_rled_barley',
73
+ 'rice', 's_soning', 'salsa', 'shirataki', 'spaghetti', 'stock', 'sugar',
74
+ 'tomato_paste', 'tomato_sauce', 'unsweetened_chocolate_baking_squares',
75
+ 'unsweetened_coconut_flakes', 'vanilla', 'vegetable_oil', 'xanthan_gum',
76
+ 'rosemary_l_ves', 'bay_l_f'
77
+ ];
78
+ // Snacks
79
+ const snack = [
80
+ 'cashews', 'chifles_plantain_strips', 'granola_bar', 'kind_pumpkin_seeds',
81
+ 'mixed_nuts', 'peanuts', 'philadelphia_snack_de_s_chocolate', 'plantain_single',
82
+ 'pretzels', 'protein_bar', 'tortilla_chips', 'trail_mix', 'walnuts',
83
+ 'vegan_marshmallows'
84
+ ];
85
+ // Beverages
86
+ const beverage = [
87
+ 'bottled_water', 'cr_m_soda', 'cranberry_juice', 'orange_juice',
88
+ 'sparkling_water', 'bigelow_benefits_cinnamon_blackberry_herbal_t_s',
89
+ 'ly_pulled_espresso_to', 'mamma_chia_chia_squeeze_blackberry_bliss_vitality',
90
+ 'twinings_londin_immue_support_blackberry_flavored'
91
+ ];
92
+ // Frozen
93
+ const frozen = [
94
+ 'bakery_pumpkin_pie', 'frozen_fruit', 'marie_callender_s_pumpkin_pie_fr_en_dessert',
95
+ 'microwave_the_noodles'
96
+ ];
97
+ // Supplements/Other
98
+ const other = [
99
+ 'melatonin_gummies_blackberry_5mg', 'olly_men_s_multivitamin_blackberry_flavored_gummy',
100
+ 'olly_sleep_blackberry_flavor_gummy_supplement_mela',
101
+ 'olly_strength_sleep_blackberry_flavor_gummy_supple',
102
+ 'purina_friskies_fish_a_licious_wet_cat_in_gravy_va',
103
+ 'spice_islands_pumpkin_pie_spice_kosher', 'grown_fairytale_pumpkin',
104
+ 'grown_pie_pumpkins', 'grown_pumpkins_up_to_13_s', 'grown_pumpkins_up_to_19_s',
105
+ 'la_costena_tomatillos', 'portobello_mushrooms'
106
+ ];
107
+ if (produce.includes(label))
108
+ return 'produce';
109
+ if (meat.includes(label))
110
+ return 'meat';
111
+ if (dairy.includes(label))
112
+ return 'dairy';
113
+ if (bakery.includes(label))
114
+ return 'bakery';
115
+ if (packaged.includes(label))
116
+ return 'packaged';
117
+ if (snack.includes(label))
118
+ return 'snack';
119
+ if (beverage.includes(label))
120
+ return 'beverage';
121
+ if (frozen.includes(label))
122
+ return 'frozen';
123
+ if (other.includes(label))
124
+ return 'unknown';
125
+ // Default categorization based on common patterns
126
+ if (label.includes('cheese'))
127
+ return 'dairy';
128
+ if (label.includes('milk') || label.includes('cream') || label.includes('butter'))
129
+ return 'dairy';
130
+ if (label.includes('beef') || label.includes('chicken') || label.includes('pork') ||
131
+ label.includes('fish') || label.includes('shrimp') || label.includes('salmon'))
132
+ return 'meat';
133
+ if (label.includes('bread') || label.includes('bun'))
134
+ return 'bakery';
135
+ if (label.includes('juice') || label.includes('water') || label.includes('soda'))
136
+ return 'beverage';
137
+ return 'unknown';
138
+ }
139
+ /**
140
+ * Map class index to label and category (233 classes)
141
+ */
142
+ exports.CLASS_LABELS = {
143
+ 0: { label: 'acorn_squash', category: 'produce' },
144
+ 1: { label: 'ahi_tuna', category: 'meat' },
145
+ 2: { label: 'all_purpose_flour', category: 'packaged' },
146
+ 3: { label: 'apple', category: 'produce' },
147
+ 4: { label: 'asparagus', category: 'produce' },
148
+ 5: { label: 'baby_carrots', category: 'produce' },
149
+ 6: { label: 'baby_spinach', category: 'produce' },
150
+ 7: { label: 'bacon', category: 'meat' },
151
+ 8: { label: 'baguette', category: 'bakery' },
152
+ 9: { label: 'bakery_pumpkin_pie', category: 'frozen' },
153
+ 10: { label: 'balsamic_vinegar', category: 'packaged' },
154
+ 11: { label: 'banana', category: 'produce' },
155
+ 12: { label: 'basil', category: 'produce' },
156
+ 13: { label: 'bay_l_f', category: 'spice' },
157
+ 14: { label: 'bbq_sauce', category: 'condiment' },
158
+ 15: { label: 'beef_brisket', category: 'meat' },
159
+ 16: { label: 'beef_broth', category: 'packaged' },
160
+ 17: { label: 'beef_short_ribs', category: 'meat' },
161
+ 18: { label: 'beef_tenderloin', category: 'meat' },
162
+ 19: { label: 'bell_pepper', category: 'produce' },
163
+ 20: { label: 'bigelow_benefits_cinnamon_blackberry_herbal_t_s', category: 'beverage' },
164
+ 21: { label: 'blackberries', category: 'produce' },
165
+ 22: { label: 'blackberry_preserves_seedless', category: 'packaged' },
166
+ 23: { label: 'blackeye_p_s', category: 'packaged' },
167
+ 24: { label: 'blue_cheese', category: 'dairy' },
168
+ 25: { label: 'blueberries', category: 'produce' },
169
+ 26: { label: 'bonne_maman_blackberry_preserves', category: 'packaged' },
170
+ 27: { label: 'bottled_water', category: 'beverage' },
171
+ 28: { label: 'br_d', category: 'bakery' },
172
+ 29: { label: 'br_dcrumbs', category: 'packaged' },
173
+ 30: { label: 'broccoli', category: 'produce' },
174
+ 31: { label: 'brown_rice', category: 'packaged' },
175
+ 32: { label: 'brown_sugar', category: 'packaged' },
176
+ 33: { label: 'brussels_sprouts', category: 'produce' },
177
+ 34: { label: 'butter', category: 'dairy' },
178
+ 35: { label: 'butternut_squash', category: 'produce' },
179
+ 36: { label: 'button_mushrooms', category: 'produce' },
180
+ 37: { label: 'cacique_queso_fresco', category: 'dairy' },
181
+ 38: { label: 'cardamom_pods', category: 'spice' },
182
+ 39: { label: 'carrot', category: 'produce' },
183
+ 40: { label: 'cashews', category: 'snack' },
184
+ 41: { label: 'catfish_fillets', category: 'meat' },
185
+ 42: { label: 'catfish_fillets_fr_en_big_d_l', category: 'meat' },
186
+ 43: { label: 'catfish_st_k_sustainably_sourced', category: 'meat' },
187
+ 44: { label: 'cauliflower', category: 'produce' },
188
+ 45: { label: 'celery', category: 'produce' },
189
+ 46: { label: 'cheddar_cheese', category: 'dairy' },
190
+ 47: { label: 'cherries', category: 'produce' },
191
+ 48: { label: 'cherry_tomatoes', category: 'produce' },
192
+ 49: { label: 'chicken_drumsticks', category: 'meat' },
193
+ 50: { label: 'chicken_legs', category: 'meat' },
194
+ 51: { label: 'chicken_tenders', category: 'meat' },
195
+ 52: { label: 'chicken_thighs', category: 'meat' },
196
+ 53: { label: 'chicken_wings', category: 'meat' },
197
+ 54: { label: 'chickpeas', category: 'packaged' },
198
+ 55: { label: 'chifles_plantain_strips', category: 'snack' },
199
+ 56: { label: 'chilli_flakes', category: 'spice' },
200
+ 57: { label: 'chillies', category: 'produce' },
201
+ 58: { label: 'chives', category: 'produce' },
202
+ 59: { label: 'chuck_roast', category: 'meat' },
203
+ 60: { label: 'citric_acid', category: 'packaged' },
204
+ 61: { label: 'clementine', category: 'produce' },
205
+ 62: { label: 'coconut', category: 'produce' },
206
+ 63: { label: 'cod', category: 'meat' },
207
+ 64: { label: 'cod_fillet', category: 'meat' },
208
+ 65: { label: 'corn', category: 'produce' },
209
+ 66: { label: 'cr_m', category: 'dairy' },
210
+ 67: { label: 'cr_m_soda', category: 'beverage' },
211
+ 68: { label: 'cranberry_juice', category: 'beverage' },
212
+ 69: { label: 'crushed_tomatoes', category: 'packaged' },
213
+ 70: { label: 'crusty_br_d', category: 'bakery' },
214
+ 71: { label: 'cucumber', category: 'produce' },
215
+ 72: { label: 'd_anjou_p_r', category: 'produce' },
216
+ 73: { label: 'd_anjou_p_rs_2_pound', category: 'produce' },
217
+ 74: { label: 'diced_tomatoes', category: 'packaged' },
218
+ 75: { label: 'dill', category: 'produce' },
219
+ 76: { label: 'double_strength_liquid_rennet', category: 'packaged' },
220
+ 77: { label: 'egg_whites', category: 'dairy' },
221
+ 78: { label: 'eggplant', category: 'produce' },
222
+ 79: { label: 'eggs', category: 'dairy' },
223
+ 80: { label: 'english_cucumber', category: 'produce' },
224
+ 81: { label: 'extra_virgin_olive_oil', category: 'packaged' },
225
+ 82: { label: 'filet_mignon', category: 'meat' },
226
+ 83: { label: 'flank_steak', category: 'meat' },
227
+ 84: { label: 'flour', category: 'packaged' },
228
+ 85: { label: 'frozen_fruit', category: 'frozen' },
229
+ 86: { label: 'fuji_apple', category: 'produce' },
230
+ 87: { label: 'garam_masala', category: 'spice' },
231
+ 88: { label: 'garbanzo_b_ns', category: 'packaged' },
232
+ 89: { label: 'garlic', category: 'produce' },
233
+ 90: { label: 'ginger', category: 'produce' },
234
+ 91: { label: 'goat_cheese', category: 'dairy' },
235
+ 92: { label: 'gouda_cheese', category: 'dairy' },
236
+ 93: { label: 'granola_bar', category: 'snack' },
237
+ 94: { label: 'grapes', category: 'produce' },
238
+ 95: { label: 'greek_yogurt', category: 'dairy' },
239
+ 96: { label: 'green_bell_pepper', category: 'produce' },
240
+ 97: { label: 'green_onion', category: 'produce' },
241
+ 98: { label: 'ground_beef', category: 'meat' },
242
+ 99: { label: 'ground_chicken', category: 'meat' },
243
+ 100: { label: 'ground_lamb', category: 'meat' },
244
+ 101: { label: 'grown_fairytale_pumpkin', category: 'produce' },
245
+ 102: { label: 'grown_pie_pumpkins', category: 'produce' },
246
+ 103: { label: 'grown_pumpkins_up_to_13_s', category: 'produce' },
247
+ 104: { label: 'grown_pumpkins_up_to_19_s', category: 'produce' },
248
+ 105: { label: 'h_vy_cr_m', category: 'dairy' },
249
+ 106: { label: 'half_and_half', category: 'dairy' },
250
+ 107: { label: 'herbs_de_province', category: 'spice' },
251
+ 108: { label: 'honey', category: 'packaged' },
252
+ 109: { label: 'honeydew_melon', category: 'produce' },
253
+ 110: { label: 'hot_dog_buns', category: 'bakery' },
254
+ 111: { label: 'hot_sauce', category: 'condiment' },
255
+ 112: { label: 'jalapeno', category: 'produce' },
256
+ 113: { label: 'jam', category: 'packaged' },
257
+ 114: { label: 'kind_pumpkin_seeds', category: 'snack' },
258
+ 115: { label: 'kiwi', category: 'produce' },
259
+ 116: { label: 'la_costena_tomatillos', category: 'packaged' },
260
+ 117: { label: 'ladyfingers_bought_or', category: 'bakery' },
261
+ 118: { label: 'large_eggs', category: 'dairy' },
262
+ 119: { label: 'lemon', category: 'produce' },
263
+ 120: { label: 'lettuce', category: 'produce' },
264
+ 121: { label: 'lime', category: 'produce' },
265
+ 122: { label: 'lobster', category: 'meat' },
266
+ 123: { label: 'ly_pulled_espresso_to', category: 'beverage' },
267
+ 124: { label: 'mamma_chia_chia_squeeze_blackberry_bliss_vitality', category: 'beverage' },
268
+ 125: { label: 'mango', category: 'produce' },
269
+ 126: { label: 'marie_callender_s_pumpkin_pie_fr_en_dessert', category: 'frozen' },
270
+ 127: { label: 'marinara_sauce', category: 'packaged' },
271
+ 128: { label: 'mayonnaise', category: 'condiment' },
272
+ 129: { label: 'melatonin_gummies_blackberry_5mg', category: 'unknown' },
273
+ 130: { label: 'microwave_the_noodles', category: 'frozen' },
274
+ 131: { label: 'mixed_greens', category: 'produce' },
275
+ 132: { label: 'mixed_nuts', category: 'snack' },
276
+ 133: { label: 'mozzarella_cheese', category: 'dairy' },
277
+ 134: { label: 'mushrooms', category: 'produce' },
278
+ 135: { label: 'mustard', category: 'condiment' },
279
+ 136: { label: 'napa_cabbage', category: 'produce' },
280
+ 137: { label: 'non_dairy_nutritional_y_st', category: 'packaged' },
281
+ 138: { label: 'olive_oil', category: 'packaged' },
282
+ 139: { label: 'olly_men_s_multivitamin_blackberry_flavored_gummy', category: 'unknown' },
283
+ 140: { label: 'olly_sleep_blackberry_flavor_gummy_supplement_mela', category: 'unknown' },
284
+ 141: { label: 'olly_strength_sleep_blackberry_flavor_gummy_supple', category: 'unknown' },
285
+ 142: { label: 'on_the_border_monterey_jack_queso', category: 'packaged' },
286
+ 143: { label: 'onion', category: 'produce' },
287
+ 144: { label: 'orange', category: 'produce' },
288
+ 145: { label: 'orange_juice', category: 'beverage' },
289
+ 146: { label: 'oregano', category: 'spice' },
290
+ 147: { label: 'p_es', category: 'produce' },
291
+ 148: { label: 'p_rs', category: 'produce' },
292
+ 149: { label: 'panko_br_d_crumbs', category: 'packaged' },
293
+ 150: { label: 'paprika', category: 'spice' },
294
+ 151: { label: 'parchment_pa_to_line_the_baking_pan', category: 'packaged' },
295
+ 152: { label: 'parmesan_cheese', category: 'dairy' },
296
+ 153: { label: 'pasta', category: 'packaged' },
297
+ 154: { label: 'pe_s', category: 'produce' },
298
+ 155: { label: 'peanuts', category: 'snack' },
299
+ 156: { label: 'philadelphia_snack_de_s_chocolate', category: 'snack' },
300
+ 157: { label: 'pinto_beans', category: 'packaged' },
301
+ 158: { label: 'plantain_single', category: 'produce' },
302
+ 159: { label: 'polaner_with_fiber_seedless_blackberry_preserves_g', category: 'packaged' },
303
+ 160: { label: 'pomegranate', category: 'produce' },
304
+ 161: { label: 'pork_belly', category: 'meat' },
305
+ 162: { label: 'pork_chops', category: 'meat' },
306
+ 163: { label: 'pork_loin', category: 'meat' },
307
+ 164: { label: 'pork_shoulder', category: 'meat' },
308
+ 165: { label: 'pork_tenderloin', category: 'meat' },
309
+ 166: { label: 'portobello_mushrooms', category: 'produce' },
310
+ 167: { label: 'potato', category: 'produce' },
311
+ 168: { label: 'powdered_sugar', category: 'packaged' },
312
+ 169: { label: 'pre_d_pepitas', category: 'snack' },
313
+ 170: { label: 'pretzels', category: 'snack' },
314
+ 171: { label: 'protein_bar', category: 'snack' },
315
+ 172: { label: 'provolone_cheese', category: 'dairy' },
316
+ 173: { label: 'pumpkin_pie_spice_shaker', category: 'spice' },
317
+ 174: { label: 'purina_friskies_fish_a_licious_wet_cat_in_gravy_va', category: 'unknown' },
318
+ 175: { label: 'quick_p_rled_barley', category: 'packaged' },
319
+ 176: { label: 'raspberries', category: 'produce' },
320
+ 177: { label: 'red_cabbage', category: 'produce' },
321
+ 178: { label: 'red_onion', category: 'produce' },
322
+ 179: { label: 'rice', category: 'packaged' },
323
+ 180: { label: 'roma_tomato', category: 'produce' },
324
+ 181: { label: 'romaine_lettuce', category: 'produce' },
325
+ 182: { label: 'rosemary', category: 'produce' },
326
+ 183: { label: 'rosemary_l_ves', category: 'spice' },
327
+ 184: { label: 'rotisserie_chicken', category: 'meat' },
328
+ 185: { label: 'ry_catfish_fillets', category: 'meat' },
329
+ 186: { label: 's_soning', category: 'spice' },
330
+ 187: { label: 'sage', category: 'produce' },
331
+ 188: { label: 'salsa', category: 'condiment' },
332
+ 189: { label: 'salted_butter', category: 'dairy' },
333
+ 190: { label: 'shallot', category: 'produce' },
334
+ 191: { label: 'shirataki', category: 'packaged' },
335
+ 192: { label: 'shortcrust_pastry', category: 'bakery' },
336
+ 193: { label: 'shredded_cheese', category: 'dairy' },
337
+ 194: { label: 'shrimp', category: 'meat' },
338
+ 195: { label: 'sirloin_steak', category: 'meat' },
339
+ 196: { label: 'skim_milk', category: 'dairy' },
340
+ 197: { label: 'sliced_cheese', category: 'dairy' },
341
+ 198: { label: 'smoked_salmon', category: 'meat' },
342
+ 199: { label: 'soy_milk', category: 'dairy' },
343
+ 200: { label: 'spaghetti', category: 'packaged' },
344
+ 201: { label: 'spaghetti_squash', category: 'produce' },
345
+ 202: { label: 'sparkling_water', category: 'beverage' },
346
+ 203: { label: 'spice_islands_pumpkin_pie_spice_kosher', category: 'spice' },
347
+ 204: { label: 'spinach', category: 'produce' },
348
+ 205: { label: 'stock', category: 'packaged' },
349
+ 206: { label: 'sugar', category: 'packaged' },
350
+ 207: { label: 'tilapia', category: 'meat' },
351
+ 208: { label: 'tilapia_fillet', category: 'meat' },
352
+ 209: { label: 'tomatillo', category: 'produce' },
353
+ 210: { label: 'tomato', category: 'produce' },
354
+ 211: { label: 'tomato_paste', category: 'packaged' },
355
+ 212: { label: 'tomato_sauce', category: 'packaged' },
356
+ 213: { label: 'tortilla_chips', category: 'snack' },
357
+ 214: { label: 'trail_mix', category: 'snack' },
358
+ 215: { label: 'twinings_londin_immue_support_blackberry_flavored', category: 'beverage' },
359
+ 216: { label: 'unsalted_butter', category: 'dairy' },
360
+ 217: { label: 'unsweetened_chocolate_baking_squares', category: 'packaged' },
361
+ 218: { label: 'unsweetened_coconut_flakes', category: 'packaged' },
362
+ 219: { label: 'vanilla', category: 'packaged' },
363
+ 220: { label: 'vegan_cr_m', category: 'dairy' },
364
+ 221: { label: 'vegan_marshmallows', category: 'snack' },
365
+ 222: { label: 'vegetable_oil', category: 'packaged' },
366
+ 223: { label: 'walnuts', category: 'snack' },
367
+ 224: { label: 'white_bread', category: 'bakery' },
368
+ 225: { label: 'white_onion', category: 'produce' },
369
+ 226: { label: 'whole_milk', category: 'dairy' },
370
+ 227: { label: 'xanthan_gum', category: 'packaged' },
371
+ 228: { label: 'yellow_onion', category: 'produce' },
372
+ 229: { label: 'yellow_squash', category: 'produce' },
373
+ 230: { label: 'yogurt', category: 'dairy' },
374
+ 231: { label: 'yukon_gold_potato', category: 'produce' },
375
+ 232: { label: 'zucchini', category: 'produce' },
376
+ };
377
+ /**
378
+ * Number of classes in the model
379
+ */
380
+ exports.NUM_CLASSES = 233;
381
+ /**
382
+ * Get label info for a class index
383
+ */
384
+ function getClassInfo(classIndex) {
385
+ const info = exports.CLASS_LABELS[classIndex];
386
+ if (info) {
387
+ return info;
388
+ }
389
+ // Fallback for unknown indices
390
+ return { label: `class_${classIndex}`, category: 'unknown' };
391
+ }
392
+ /**
393
+ * Get all labels as an array (ordered by class index)
394
+ */
395
+ function getLabelsArray() {
396
+ const labels = [];
397
+ for (let i = 0; i < exports.NUM_CLASSES; i++) {
398
+ labels.push(exports.CLASS_LABELS[i]?.label ?? `class_${i}`);
399
+ }
400
+ return labels;
401
+ }
402
+ /**
403
+ * Category to class indices mapping
404
+ */
405
+ exports.CATEGORY_CLASSES = {
406
+ produce: Object.entries(exports.CLASS_LABELS)
407
+ .filter(([, v]) => v.category === 'produce')
408
+ .map(([k]) => parseInt(k, 10)),
409
+ meat: Object.entries(exports.CLASS_LABELS)
410
+ .filter(([, v]) => v.category === 'meat')
411
+ .map(([k]) => parseInt(k, 10)),
412
+ dairy: Object.entries(exports.CLASS_LABELS)
413
+ .filter(([, v]) => v.category === 'dairy')
414
+ .map(([k]) => parseInt(k, 10)),
415
+ packaged: Object.entries(exports.CLASS_LABELS)
416
+ .filter(([, v]) => v.category === 'packaged')
417
+ .map(([k]) => parseInt(k, 10)),
418
+ bakery: Object.entries(exports.CLASS_LABELS)
419
+ .filter(([, v]) => v.category === 'bakery')
420
+ .map(([k]) => parseInt(k, 10)),
421
+ snack: Object.entries(exports.CLASS_LABELS)
422
+ .filter(([, v]) => v.category === 'snack')
423
+ .map(([k]) => parseInt(k, 10)),
424
+ beverage: Object.entries(exports.CLASS_LABELS)
425
+ .filter(([, v]) => v.category === 'beverage')
426
+ .map(([k]) => parseInt(k, 10)),
427
+ condiment: Object.entries(exports.CLASS_LABELS)
428
+ .filter(([, v]) => v.category === 'condiment')
429
+ .map(([k]) => parseInt(k, 10)),
430
+ spice: Object.entries(exports.CLASS_LABELS)
431
+ .filter(([, v]) => v.category === 'spice')
432
+ .map(([k]) => parseInt(k, 10)),
433
+ frozen: Object.entries(exports.CLASS_LABELS)
434
+ .filter(([, v]) => v.category === 'frozen')
435
+ .map(([k]) => parseInt(k, 10)),
436
+ unknown: Object.entries(exports.CLASS_LABELS)
437
+ .filter(([, v]) => v.category === 'unknown')
438
+ .map(([k]) => parseInt(k, 10)),
439
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Class label mappings for YOLOv8 COCO model
3
+ *
4
+ * These labels correspond to the 80 classes in the COCO dataset.
5
+ * Food-related classes: banana (46), apple (47), sandwich (48), orange (49),
6
+ * broccoli (50), carrot (51), hot dog (52), pizza (53), donut (54), cake (55)
7
+ */
8
+ import type { ProductCategory, ClassLabelMap } from '../types';
9
+ /**
10
+ * COCO class names in order
11
+ */
12
+ export declare const COCO_CLASSES: readonly ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch", "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"];
13
+ /**
14
+ * Map class index to label and category for COCO
15
+ */
16
+ export declare const CLASS_LABELS_COCO: ClassLabelMap;
17
+ /**
18
+ * Number of classes in COCO model
19
+ */
20
+ export declare const NUM_CLASSES_COCO = 80;
21
+ /**
22
+ * Food class indices in COCO (useful for filtering)
23
+ */
24
+ export declare const FOOD_CLASS_INDICES: number[];
25
+ /**
26
+ * Kitchen/dining class indices (context)
27
+ */
28
+ export declare const KITCHEN_CLASS_INDICES: number[];
29
+ /**
30
+ * Get label info for a COCO class index
31
+ */
32
+ export declare function getCocoClassInfo(classIndex: number): {
33
+ label: string;
34
+ category: ProductCategory;
35
+ };
36
+ /**
37
+ * Check if a class index is a food item
38
+ */
39
+ export declare function isFoodClass(classIndex: number): boolean;
40
+ /**
41
+ * Get all COCO labels as an array
42
+ */
43
+ export declare function getCocoLabelsArray(): string[];
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * Class label mappings for YOLOv8 COCO model
4
+ *
5
+ * These labels correspond to the 80 classes in the COCO dataset.
6
+ * Food-related classes: banana (46), apple (47), sandwich (48), orange (49),
7
+ * broccoli (50), carrot (51), hot dog (52), pizza (53), donut (54), cake (55)
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.KITCHEN_CLASS_INDICES = exports.FOOD_CLASS_INDICES = exports.NUM_CLASSES_COCO = exports.CLASS_LABELS_COCO = exports.COCO_CLASSES = void 0;
11
+ exports.getCocoClassInfo = getCocoClassInfo;
12
+ exports.isFoodClass = isFoodClass;
13
+ exports.getCocoLabelsArray = getCocoLabelsArray;
14
+ /**
15
+ * COCO class names in order
16
+ */
17
+ exports.COCO_CLASSES = [
18
+ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck',
19
+ 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench',
20
+ 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra',
21
+ 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
22
+ 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove',
23
+ 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup',
24
+ 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange',
25
+ 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
26
+ 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse',
27
+ 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink',
28
+ 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier',
29
+ 'toothbrush'
30
+ ];
31
+ /**
32
+ * Map COCO class to a product category
33
+ */
34
+ function getCocoCategory(label) {
35
+ // Food items
36
+ const produceItems = ['banana', 'apple', 'orange', 'broccoli', 'carrot'];
37
+ const meatItems = ['hot dog'];
38
+ const bakeryItems = ['sandwich', 'pizza', 'donut', 'cake'];
39
+ const dairyItems = [];
40
+ const beverageItems = ['bottle', 'wine glass', 'cup'];
41
+ const condimentItems = ['bowl']; // Often contains condiments/sauces
42
+ if (produceItems.includes(label))
43
+ return 'produce';
44
+ if (meatItems.includes(label))
45
+ return 'meat';
46
+ if (bakeryItems.includes(label))
47
+ return 'bakery';
48
+ if (dairyItems.includes(label))
49
+ return 'dairy';
50
+ if (beverageItems.includes(label))
51
+ return 'beverage';
52
+ if (condimentItems.includes(label))
53
+ return 'condiment';
54
+ // Kitchen items (useful for context)
55
+ const kitchenItems = [
56
+ 'fork', 'knife', 'spoon', 'microwave', 'oven', 'toaster', 'sink',
57
+ 'refrigerator', 'dining table'
58
+ ];
59
+ if (kitchenItems.includes(label))
60
+ return 'unknown'; // Not a product but kitchen context
61
+ return 'unknown';
62
+ }
63
+ /**
64
+ * Map class index to label and category for COCO
65
+ */
66
+ exports.CLASS_LABELS_COCO = Object.fromEntries(exports.COCO_CLASSES.map((label, index) => [
67
+ index,
68
+ { label, category: getCocoCategory(label) }
69
+ ]));
70
+ /**
71
+ * Number of classes in COCO model
72
+ */
73
+ exports.NUM_CLASSES_COCO = 80;
74
+ /**
75
+ * Food class indices in COCO (useful for filtering)
76
+ */
77
+ exports.FOOD_CLASS_INDICES = [46, 47, 48, 49, 50, 51, 52, 53, 54, 55];
78
+ /**
79
+ * Kitchen/dining class indices (context)
80
+ */
81
+ exports.KITCHEN_CLASS_INDICES = [39, 40, 41, 42, 43, 44, 45, 60, 68, 69, 70, 71, 72];
82
+ /**
83
+ * Get label info for a COCO class index
84
+ */
85
+ function getCocoClassInfo(classIndex) {
86
+ const info = exports.CLASS_LABELS_COCO[classIndex];
87
+ if (info) {
88
+ return info;
89
+ }
90
+ return { label: `class_${classIndex}`, category: 'unknown' };
91
+ }
92
+ /**
93
+ * Check if a class index is a food item
94
+ */
95
+ function isFoodClass(classIndex) {
96
+ return exports.FOOD_CLASS_INDICES.includes(classIndex);
97
+ }
98
+ /**
99
+ * Get all COCO labels as an array
100
+ */
101
+ function getCocoLabelsArray() {
102
+ return [...exports.COCO_CLASSES];
103
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Hooks exports
3
+ */
4
+ export { useProductDetector, default as useProductDetectorDefault } from './useProductDetector';
5
+ export { useMultiBarcodeScanner, default as useMultiBarcodeScannerDefault } from './useMultiBarcodeScanner';
6
+ export { useReceiptScanner, default as useReceiptScannerDefault } from './useReceiptScanner';
7
+ export { useVideoScanner, default as useVideoScannerDefault, type ScanMode, type VideoScanResult, type UseVideoScannerOptions, type UseVideoScannerReturn, } from './useVideoScanner';
8
+ export { CLASS_LABELS, NUM_CLASSES, getClassInfo, getLabelsArray, CATEGORY_CLASSES } from './classLabels';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * Hooks exports
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CATEGORY_CLASSES = exports.getLabelsArray = exports.getClassInfo = exports.NUM_CLASSES = exports.CLASS_LABELS = exports.useVideoScannerDefault = exports.useVideoScanner = exports.useReceiptScannerDefault = exports.useReceiptScanner = exports.useMultiBarcodeScannerDefault = exports.useMultiBarcodeScanner = exports.useProductDetectorDefault = exports.useProductDetector = void 0;
10
+ var useProductDetector_1 = require("./useProductDetector");
11
+ Object.defineProperty(exports, "useProductDetector", { enumerable: true, get: function () { return useProductDetector_1.useProductDetector; } });
12
+ Object.defineProperty(exports, "useProductDetectorDefault", { enumerable: true, get: function () { return __importDefault(useProductDetector_1).default; } });
13
+ var useMultiBarcodeScanner_1 = require("./useMultiBarcodeScanner");
14
+ Object.defineProperty(exports, "useMultiBarcodeScanner", { enumerable: true, get: function () { return useMultiBarcodeScanner_1.useMultiBarcodeScanner; } });
15
+ Object.defineProperty(exports, "useMultiBarcodeScannerDefault", { enumerable: true, get: function () { return __importDefault(useMultiBarcodeScanner_1).default; } });
16
+ var useReceiptScanner_1 = require("./useReceiptScanner");
17
+ Object.defineProperty(exports, "useReceiptScanner", { enumerable: true, get: function () { return useReceiptScanner_1.useReceiptScanner; } });
18
+ Object.defineProperty(exports, "useReceiptScannerDefault", { enumerable: true, get: function () { return __importDefault(useReceiptScanner_1).default; } });
19
+ var useVideoScanner_1 = require("./useVideoScanner");
20
+ Object.defineProperty(exports, "useVideoScanner", { enumerable: true, get: function () { return useVideoScanner_1.useVideoScanner; } });
21
+ Object.defineProperty(exports, "useVideoScannerDefault", { enumerable: true, get: function () { return __importDefault(useVideoScanner_1).default; } });
22
+ var classLabels_1 = require("./classLabels");
23
+ Object.defineProperty(exports, "CLASS_LABELS", { enumerable: true, get: function () { return classLabels_1.CLASS_LABELS; } });
24
+ Object.defineProperty(exports, "NUM_CLASSES", { enumerable: true, get: function () { return classLabels_1.NUM_CLASSES; } });
25
+ Object.defineProperty(exports, "getClassInfo", { enumerable: true, get: function () { return classLabels_1.getClassInfo; } });
26
+ Object.defineProperty(exports, "getLabelsArray", { enumerable: true, get: function () { return classLabels_1.getLabelsArray; } });
27
+ Object.defineProperty(exports, "CATEGORY_CLASSES", { enumerable: true, get: function () { return classLabels_1.CATEGORY_CLASSES; } });