@souscheflabs/ml-vision 0.1.1 → 0.1.2

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 (149) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/LICENSE +15 -0
  3. package/README.md +50 -5
  4. package/dist/{components → cjs/components}/DetectionOverlay.js +1 -0
  5. package/dist/cjs/components/DetectionOverlay.js.map +1 -0
  6. package/dist/{components → cjs/components}/index.js +1 -0
  7. package/dist/cjs/components/index.js.map +1 -0
  8. package/dist/{core → cjs/core}/CacheManager.js +1 -0
  9. package/dist/cjs/core/CacheManager.js.map +1 -0
  10. package/dist/{core → cjs/core}/MLVisionProvider.js +4 -2
  11. package/dist/cjs/core/MLVisionProvider.js.map +1 -0
  12. package/dist/{core → cjs/core}/ServerClient.js +33 -13
  13. package/dist/cjs/core/ServerClient.js.map +1 -0
  14. package/dist/{core → cjs/core}/index.js +1 -0
  15. package/dist/cjs/core/index.js.map +1 -0
  16. package/dist/{hooks → cjs/hooks}/classLabels.js +1 -0
  17. package/dist/cjs/hooks/classLabels.js.map +1 -0
  18. package/dist/{hooks → cjs/hooks}/classLabelsCoco.js +1 -0
  19. package/dist/cjs/hooks/classLabelsCoco.js.map +1 -0
  20. package/dist/{hooks → cjs/hooks}/index.js +1 -0
  21. package/dist/cjs/hooks/index.js.map +1 -0
  22. package/dist/{hooks → cjs/hooks}/useMultiBarcodeScanner.js +6 -3
  23. package/dist/cjs/hooks/useMultiBarcodeScanner.js.map +1 -0
  24. package/dist/{hooks → cjs/hooks}/useProductDetector.js +161 -90
  25. package/dist/cjs/hooks/useProductDetector.js.map +1 -0
  26. package/dist/{hooks → cjs/hooks}/useReceiptScanner.js +60 -52
  27. package/dist/cjs/hooks/useReceiptScanner.js.map +1 -0
  28. package/dist/{hooks → cjs/hooks}/useVideoScanner.js +8 -5
  29. package/dist/cjs/hooks/useVideoScanner.js.map +1 -0
  30. package/dist/{index.js → cjs/index.js} +8 -4
  31. package/dist/cjs/index.js.map +1 -0
  32. package/dist/{processors → cjs/processors}/detectionProcessor.js +1 -0
  33. package/dist/cjs/processors/detectionProcessor.js.map +1 -0
  34. package/dist/{processors → cjs/processors}/index.js +1 -0
  35. package/dist/cjs/processors/index.js.map +1 -0
  36. package/dist/{processors → cjs/processors}/tfliteFrameProcessor.js +108 -25
  37. package/dist/cjs/processors/tfliteFrameProcessor.js.map +1 -0
  38. package/dist/{types → cjs/types}/barcode.js +1 -0
  39. package/dist/cjs/types/barcode.js.map +1 -0
  40. package/dist/{types → cjs/types}/detection.js +1 -0
  41. package/dist/cjs/types/detection.js.map +1 -0
  42. package/dist/{types → cjs/types}/index.js +1 -0
  43. package/dist/cjs/types/index.js.map +1 -0
  44. package/dist/{types → cjs/types}/ocr.js +1 -0
  45. package/dist/cjs/types/ocr.js.map +1 -0
  46. package/dist/{utils → cjs/utils}/imagePreprocessor.js +30 -25
  47. package/dist/cjs/utils/imagePreprocessor.js.map +1 -0
  48. package/dist/cjs/utils/logger.js +99 -0
  49. package/dist/cjs/utils/logger.js.map +1 -0
  50. package/dist/{utils → cjs/utils}/yoloProcessor.js +1 -0
  51. package/dist/cjs/utils/yoloProcessor.js.map +1 -0
  52. package/dist/esm/components/DetectionOverlay.js +130 -0
  53. package/dist/esm/components/DetectionOverlay.js.map +1 -0
  54. package/dist/esm/components/index.js +5 -0
  55. package/dist/esm/components/index.js.map +1 -0
  56. package/dist/esm/core/CacheManager.js +327 -0
  57. package/dist/esm/core/CacheManager.js.map +1 -0
  58. package/dist/esm/core/MLVisionProvider.js +185 -0
  59. package/dist/esm/core/MLVisionProvider.js.map +1 -0
  60. package/dist/esm/core/ServerClient.js +305 -0
  61. package/dist/esm/core/ServerClient.js.map +1 -0
  62. package/dist/esm/core/index.js +7 -0
  63. package/dist/esm/core/index.js.map +1 -0
  64. package/dist/esm/hooks/classLabels.js +436 -0
  65. package/dist/esm/hooks/classLabels.js.map +1 -0
  66. package/dist/esm/hooks/classLabelsCoco.js +98 -0
  67. package/dist/esm/hooks/classLabelsCoco.js.map +1 -0
  68. package/dist/esm/hooks/index.js +9 -0
  69. package/dist/esm/hooks/index.js.map +1 -0
  70. package/dist/esm/hooks/useMultiBarcodeScanner.js +290 -0
  71. package/dist/esm/hooks/useMultiBarcodeScanner.js.map +1 -0
  72. package/dist/esm/hooks/useProductDetector.js +714 -0
  73. package/dist/esm/hooks/useProductDetector.js.map +1 -0
  74. package/dist/esm/hooks/useReceiptScanner.js +407 -0
  75. package/dist/esm/hooks/useReceiptScanner.js.map +1 -0
  76. package/dist/esm/hooks/useVideoScanner.js +383 -0
  77. package/dist/esm/hooks/useVideoScanner.js.map +1 -0
  78. package/dist/esm/index.js +93 -0
  79. package/dist/esm/index.js.map +1 -0
  80. package/dist/esm/processors/detectionProcessor.js +121 -0
  81. package/dist/esm/processors/detectionProcessor.js.map +1 -0
  82. package/dist/esm/processors/index.js +7 -0
  83. package/dist/esm/processors/index.js.map +1 -0
  84. package/dist/esm/processors/tfliteFrameProcessor.js +292 -0
  85. package/dist/esm/processors/tfliteFrameProcessor.js.map +1 -0
  86. package/dist/esm/types/barcode.js +17 -0
  87. package/dist/esm/types/barcode.js.map +1 -0
  88. package/dist/esm/types/detection.js +8 -0
  89. package/dist/esm/types/detection.js.map +1 -0
  90. package/dist/esm/types/index.js +10 -0
  91. package/dist/esm/types/index.js.map +1 -0
  92. package/dist/esm/types/ocr.js +8 -0
  93. package/dist/esm/types/ocr.js.map +1 -0
  94. package/dist/esm/utils/imagePreprocessor.js +268 -0
  95. package/dist/esm/utils/imagePreprocessor.js.map +1 -0
  96. package/dist/esm/utils/logger.js +94 -0
  97. package/dist/esm/utils/logger.js.map +1 -0
  98. package/dist/esm/utils/yoloProcessor.js +151 -0
  99. package/dist/esm/utils/yoloProcessor.js.map +1 -0
  100. package/dist/{components → types/components}/DetectionOverlay.d.ts +1 -0
  101. package/dist/types/components/DetectionOverlay.d.ts.map +1 -0
  102. package/dist/{components → types/components}/index.d.ts +1 -0
  103. package/dist/types/components/index.d.ts.map +1 -0
  104. package/dist/{core → types/core}/CacheManager.d.ts +1 -0
  105. package/dist/types/core/CacheManager.d.ts.map +1 -0
  106. package/dist/{core → types/core}/MLVisionProvider.d.ts +1 -0
  107. package/dist/types/core/MLVisionProvider.d.ts.map +1 -0
  108. package/dist/{core → types/core}/ServerClient.d.ts +1 -0
  109. package/dist/types/core/ServerClient.d.ts.map +1 -0
  110. package/dist/{core → types/core}/index.d.ts +1 -0
  111. package/dist/types/core/index.d.ts.map +1 -0
  112. package/dist/{hooks → types/hooks}/classLabels.d.ts +1 -0
  113. package/dist/types/hooks/classLabels.d.ts.map +1 -0
  114. package/dist/{hooks → types/hooks}/classLabelsCoco.d.ts +1 -0
  115. package/dist/types/hooks/classLabelsCoco.d.ts.map +1 -0
  116. package/dist/{hooks → types/hooks}/index.d.ts +1 -0
  117. package/dist/types/hooks/index.d.ts.map +1 -0
  118. package/dist/{hooks → types/hooks}/useMultiBarcodeScanner.d.ts +1 -0
  119. package/dist/types/hooks/useMultiBarcodeScanner.d.ts.map +1 -0
  120. package/dist/{hooks → types/hooks}/useProductDetector.d.ts +1 -0
  121. package/dist/types/hooks/useProductDetector.d.ts.map +1 -0
  122. package/dist/{hooks → types/hooks}/useReceiptScanner.d.ts +2 -1
  123. package/dist/types/hooks/useReceiptScanner.d.ts.map +1 -0
  124. package/dist/{hooks → types/hooks}/useVideoScanner.d.ts +1 -0
  125. package/dist/types/hooks/useVideoScanner.d.ts.map +1 -0
  126. package/dist/types/index.d.ts +58 -124
  127. package/dist/types/index.d.ts.map +1 -0
  128. package/dist/{processors → types/processors}/detectionProcessor.d.ts +1 -0
  129. package/dist/types/processors/detectionProcessor.d.ts.map +1 -0
  130. package/dist/{processors → types/processors}/index.d.ts +1 -0
  131. package/dist/types/processors/index.d.ts.map +1 -0
  132. package/dist/{processors → types/processors}/tfliteFrameProcessor.d.ts +5 -4
  133. package/dist/types/processors/tfliteFrameProcessor.d.ts.map +1 -0
  134. package/dist/types/{barcode.d.ts → types/barcode.d.ts} +1 -0
  135. package/dist/types/types/barcode.d.ts.map +1 -0
  136. package/dist/types/{detection.d.ts → types/detection.d.ts} +1 -0
  137. package/dist/types/types/detection.d.ts.map +1 -0
  138. package/dist/types/types/index.d.ts +127 -0
  139. package/dist/types/types/index.d.ts.map +1 -0
  140. package/dist/types/{ocr.d.ts → types/ocr.d.ts} +1 -0
  141. package/dist/types/types/ocr.d.ts.map +1 -0
  142. package/dist/{utils → types/utils}/imagePreprocessor.d.ts +1 -0
  143. package/dist/types/utils/imagePreprocessor.d.ts.map +1 -0
  144. package/dist/types/utils/logger.d.ts +52 -0
  145. package/dist/types/utils/logger.d.ts.map +1 -0
  146. package/dist/{utils → types/utils}/yoloProcessor.d.ts +1 -0
  147. package/dist/types/utils/yoloProcessor.d.ts.map +1 -0
  148. package/package.json +62 -21
  149. package/dist/index.d.ts +0 -58
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,KAAK,cAAc,IAAI,oBAAoB,EAC3C,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,GACpC,MAAM,wBAAwB,CAAC"}
@@ -9,9 +9,9 @@
9
9
  * - npm install react-native-fast-tflite
10
10
  * - npm install react-native-worklets-core
11
11
  */
12
- import type { TensorflowModel } from 'react-native-fast-tflite';
13
- import type { Frame } from 'react-native-vision-camera';
14
- import { useResizePlugin } from 'vision-camera-resize-plugin';
12
+ import type { TensorflowModel } from "react-native-fast-tflite";
13
+ import type { Frame } from "react-native-vision-camera";
14
+ import { useResizePlugin } from "vision-camera-resize-plugin";
15
15
  export interface FrameDetection {
16
16
  x: number;
17
17
  y: number;
@@ -67,7 +67,7 @@ export declare function useTFLiteFrameProcessor(options: UseTFLiteFrameProcessor
67
67
  isReady: boolean;
68
68
  };
69
69
  /** Type for the resize function from useResizePlugin */
70
- type ResizeFunction = ReturnType<typeof useResizePlugin>['resize'];
70
+ type ResizeFunction = ReturnType<typeof useResizePlugin>["resize"];
71
71
  /**
72
72
  * Create a simple frame processor function for use with useFrameProcessor
73
73
  *
@@ -88,3 +88,4 @@ export declare function createTFLiteFrameProcessor(model: TensorflowModel, resiz
88
88
  foodOnly?: boolean;
89
89
  }): (frame: Frame) => FrameDetection[];
90
90
  export {};
91
+ //# sourceMappingURL=tfliteFrameProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tfliteFrameProcessor.d.ts","sourceRoot":"","sources":["../../../src/processors/tfliteFrameProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,0BAA0B;IAC1B,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACvD;AAkKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B;6BAiD7B,KAAK;;;;EAgFhB;AAED,wDAAwD;AACxD,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACf,IAUE,OAAO,KAAK,KAAG,cAAc,EAAE,CAwBxC"}
@@ -89,3 +89,4 @@ export interface BarcodeCacheEntry {
89
89
  cachedAt: number;
90
90
  ttl: number;
91
91
  }
92
+ //# sourceMappingURL=barcode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barcode.d.ts","sourceRoot":"","sources":["../../../src/types/barcode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAA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C;IACjC,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAClC,2BAA2B;IAC3B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAGpB,gCAAgC;IAChC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,oBAAoB;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,uCAAuC;IACvC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IAC9D,wBAAwB;IACxB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAIlB,cAAc,EAAE,OAAO,CAAC;CACzB;AAMD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -164,3 +164,4 @@ export interface ClassLabelMap {
164
164
  subcategory?: string;
165
165
  };
166
166
  }
167
+ //# sourceMappingURL=detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../../src/types/detection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAMnD;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,MAAM,GACN,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAChD,QAAQ,GAAG,QA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AK,EAAE,eAAe,GAAG,IAAI,CAAC;IAG9B,iCAAiC;IACjC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACnE,8CAA8C;IAC9C,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACvD,2CAA2C;IAC3C,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,2BAA2B;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;IAG5B,cAAc,EAAE,OAAO,CAAC;IAGxB,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,IAAI,CAAC;QAClB,IAAI,EAAE,WAAW,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CAAC;CACV;AAMD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;IAClB,oBAAoB;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wBAAwB;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,UAAU,EAAE,MAAM,GAAG;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,eAAe,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @souschef/ml-vision Type Definitions
3
+ *
4
+ * Core types for the ML Vision package. These types are designed to be
5
+ * compatible with your existing Sous Chef app patterns.
6
+ */
7
+ export * from './barcode';
8
+ export * from './detection';
9
+ export * from './ocr';
10
+ /**
11
+ * Configuration for the MLVisionProvider
12
+ */
13
+ export interface MLVisionConfig {
14
+ /** URL for the ML inference server (your Docker server) */
15
+ serverUrl?: string;
16
+ /** Timeout for server requests in milliseconds (default: 5000) */
17
+ serverTimeout?: number;
18
+ /** Enable MMKV caching for results (default: true) */
19
+ cacheEnabled?: boolean;
20
+ /** Cache TTL in milliseconds (default: 24 hours) */
21
+ cacheTTL?: number;
22
+ /** Check for model updates on app start (default: true) */
23
+ modelUpdateCheck?: boolean;
24
+ /** Enable GPU delegates for on-device inference (default: true) */
25
+ enableGPUDelegate?: boolean;
26
+ }
27
+ /**
28
+ * Bounding box for detected items
29
+ */
30
+ export interface BoundingBox {
31
+ /** X coordinate (0-1 normalized) */
32
+ x: number;
33
+ /** Y coordinate (0-1 normalized) */
34
+ y: number;
35
+ /** Width (0-1 normalized) */
36
+ width: number;
37
+ /** Height (0-1 normalized) */
38
+ height: number;
39
+ /** Rotation in degrees (optional) */
40
+ rotation?: number;
41
+ }
42
+ /**
43
+ * Base detection result that all specific results extend
44
+ */
45
+ export interface BaseDetectionResult {
46
+ /** Unique identifier for this detection */
47
+ id: string;
48
+ /** Confidence score (0-1) */
49
+ confidence: number;
50
+ /** Bounding box in the image */
51
+ boundingBox?: BoundingBox;
52
+ /** Whether this was processed on-device or via server */
53
+ source: 'on_device' | 'server';
54
+ /** Processing time in milliseconds */
55
+ processingTimeMs: number;
56
+ /** Timestamp of detection */
57
+ timestamp: number;
58
+ }
59
+ /**
60
+ * Information about a loaded ML model
61
+ */
62
+ export interface ModelInfo {
63
+ /** Model identifier */
64
+ id: string;
65
+ /** Human-readable name */
66
+ name: string;
67
+ /** Semantic version */
68
+ version: string;
69
+ /** File size in bytes */
70
+ sizeBytes: number;
71
+ /** When the model was last updated */
72
+ lastUpdated: Date;
73
+ /** Model type */
74
+ type: 'detection' | 'classification' | 'ocr';
75
+ /** Whether the model is currently loaded */
76
+ isLoaded: boolean;
77
+ }
78
+ /**
79
+ * Model download progress
80
+ */
81
+ export interface ModelDownloadProgress {
82
+ modelId: string;
83
+ bytesDownloaded: number;
84
+ totalBytes: number;
85
+ progress: number;
86
+ }
87
+ /**
88
+ * Cache entry wrapper
89
+ */
90
+ export interface CacheEntry<T> {
91
+ data: T;
92
+ timestamp: number;
93
+ ttl: number;
94
+ }
95
+ /**
96
+ * Cache statistics
97
+ */
98
+ export interface CacheStats {
99
+ barcodeEntries: number;
100
+ productEntries: number;
101
+ receiptEntries: number;
102
+ totalSizeBytes: number;
103
+ }
104
+ /**
105
+ * Server health response
106
+ */
107
+ export interface ServerHealthResponse {
108
+ status: 'healthy' | 'degraded' | 'unhealthy';
109
+ version: string;
110
+ models: {
111
+ id: string;
112
+ loaded: boolean;
113
+ lastUsed?: string;
114
+ }[];
115
+ gpuAvailable: boolean;
116
+ gpuMemoryUsed?: number;
117
+ gpuMemoryTotal?: number;
118
+ }
119
+ /**
120
+ * Server error response
121
+ */
122
+ export interface ServerErrorResponse {
123
+ error: string;
124
+ code: string;
125
+ details?: Record<string, unknown>;
126
+ }
127
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AAMtB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAMD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,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EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAMD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
@@ -200,3 +200,4 @@ export interface ParsedReceiptLine {
200
200
  /** Confidence in classification */
201
201
  confidence: number;
202
202
  }
203
+ //# sourceMappingURL=ocr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../../../src/types/ocr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMhE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACn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,YAAY,EAAE,MAAM,IAAI,CAAC;IAGzB,cAAc,EAAE,OAAO,CAAC;CACzB;AAMD;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,KAAK,GACL,OAAO,GACP,SAAS,GACT,YAAY,GACZ,WAAW,GACX,aAAa,GACb,UAAU,GACV,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,uBAAuB;IACvB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -83,3 +83,4 @@ export declare function initSkia(): Promise<boolean>;
83
83
  * Check if resize plugin is available for frame processing
84
84
  */
85
85
  export declare function isResizePluginAvailable(): Promise<boolean>;
86
+ //# sourceMappingURL=imagePreprocessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imagePreprocessor.d.ts","sourceRoot":"","sources":["../../../src/utils/imagePreprocessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA4CH,MAAM,WAAW,iBAAiB;IAChC,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,IAAI,EAAE,YAAY,CAAC;IACnB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,wCAAwC;IACxC,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAgC3B;AAgLD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAsBtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAKlE;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;GAGG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjD;AAKD;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAYhE"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Logger utility for @souscheflabs/ml-vision
3
+ *
4
+ * Provides configurable logging with different levels.
5
+ * In production, set LOG_LEVEL to 'none' or 'error' to reduce noise.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { logger, setLogLevel } from './utils/logger';
10
+ *
11
+ * // Set log level (default: 'warn' in production, 'debug' in development)
12
+ * setLogLevel('debug');
13
+ *
14
+ * // Use logger
15
+ * logger.debug('Detailed info for debugging');
16
+ * logger.info('General information');
17
+ * logger.warn('Warning message');
18
+ * logger.error('Error occurred', error);
19
+ * ```
20
+ */
21
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
22
+ /**
23
+ * Set the current log level
24
+ */
25
+ export declare function setLogLevel(level: LogLevel): void;
26
+ /**
27
+ * Get the current log level
28
+ */
29
+ export declare function getLogLevel(): LogLevel;
30
+ /**
31
+ * Logger instance with configurable levels
32
+ */
33
+ export declare const logger: {
34
+ /**
35
+ * Debug level - detailed information for debugging
36
+ */
37
+ debug(message: string, ...args: unknown[]): void;
38
+ /**
39
+ * Info level - general information
40
+ */
41
+ info(message: string, ...args: unknown[]): void;
42
+ /**
43
+ * Warn level - warning messages
44
+ */
45
+ warn(message: string, ...args: unknown[]): void;
46
+ /**
47
+ * Error level - error messages
48
+ */
49
+ error(message: string, ...args: unknown[]): void;
50
+ };
51
+ export default logger;
52
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAapE;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAgBD;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;mBACY,MAAM,WAAW,OAAO,EAAE,GAAG,IAAI;IAOhD;;OAEG;kBACW,MAAM,WAAW,OAAO,EAAE,GAAG,IAAI;IAO/C;;OAEG;kBACW,MAAM,WAAW,OAAO,EAAE,GAAG,IAAI;IAM/C;;OAEG;mBACY,MAAM,WAAW,OAAO,EAAE,GAAG,IAAI;CAKjD,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -38,3 +38,4 @@ export declare function processYoloOutput(output: Float32Array, numClasses: numb
38
38
  * Scale detection coordinates to actual image dimensions
39
39
  */
40
40
  export declare function scaleDetections(detections: ProcessedDetection[], modelSize: number, imageWidth: number, imageHeight: number): ProcessedDetection[];
41
+ //# sourceMappingURL=yoloProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yoloProcessor.d.ts","sourceRoot":"","sources":["../../../src/utils/yoloProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,MAAM,EAClB,aAAa,GAAE,MAAa,EAC5B,YAAY,GAAE,MAAa,GAC1B,kBAAkB,EAAE,CAqDtB;AA6ED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,kBAAkB,EAAE,EAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,kBAAkB,EAAE,CAqBtB"}
package/package.json CHANGED
@@ -1,20 +1,37 @@
1
1
  {
2
2
  "name": "@souscheflabs/ml-vision",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "ML-powered product detection for React Native - multi-barcode scanning, receipt OCR, and visual product recognition",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "default": "./dist/esm/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/types/index.d.ts",
16
+ "default": "./dist/cjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "sideEffects": false,
7
21
  "scripts": {
8
- "build": "tsc",
22
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
23
+ "build:cjs": "tsc -p tsconfig.cjs.json",
24
+ "build:esm": "tsc -p tsconfig.esm.json",
25
+ "build:types": "tsc -p tsconfig.json --emitDeclarationOnly --outDir dist/types",
9
26
  "watch": "tsc --watch",
10
27
  "clean": "rm -rf dist",
11
- "prepublishOnly": "npm run lint && npm run clean && npm run build",
12
28
  "typecheck": "tsc --noEmit",
13
- "lint": "eslint src --ext .ts,.tsx",
14
- "lint:fix": "eslint src --ext .ts,.tsx --fix",
29
+ "lint": "eslint src",
30
+ "lint:fix": "eslint src --fix",
15
31
  "test": "jest",
16
32
  "test:watch": "jest --watch",
17
- "test:coverage": "jest --coverage"
33
+ "test:coverage": "jest --coverage",
34
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run clean && npm run build"
18
35
  },
19
36
  "keywords": [
20
37
  "react-native",
@@ -24,27 +41,51 @@
24
41
  "ocr",
25
42
  "product-detection",
26
43
  "vision-camera",
27
- "tflite"
44
+ "tflite",
45
+ "yolo",
46
+ "object-detection",
47
+ "food-recognition"
28
48
  ],
29
- "author": "Artan Muzhaqi",
49
+ "author": "Artan Muzhaqi <artan@souscheflabs.com>",
30
50
  "license": "ISC",
31
51
  "type": "commonjs",
52
+ "homepage": "https://github.com/SousChefLabs/ml-vision#readme",
53
+ "bugs": {
54
+ "url": "https://github.com/SousChefLabs/ml-vision/issues"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/SousChefLabs/ml-vision.git"
59
+ },
60
+ "funding": {
61
+ "type": "github",
62
+ "url": "https://github.com/sponsors/SousChefLabs"
63
+ },
32
64
  "devDependencies": {
65
+ "@eslint/eslintrc": "^3.3.3",
66
+ "@eslint/js": "^9.39.2",
67
+ "@react-native/eslint-config": "^0.83.1",
33
68
  "@testing-library/react-native": "^12.4.3",
34
69
  "@types/jest": "^29.5.12",
35
70
  "@types/react": "^19.2.8",
36
71
  "@types/react-native": "^0.73.0",
72
+ "@typescript-eslint/eslint-plugin": "^8.53.0",
73
+ "@typescript-eslint/parser": "^8.53.0",
74
+ "eslint": "^9.39.2",
75
+ "eslint-plugin-react": "^7.37.5",
76
+ "eslint-plugin-react-hooks": "^7.0.1",
77
+ "eslint-plugin-react-native": "^5.0.0",
37
78
  "jest": "^29.7.0",
38
79
  "react-native-reanimated": "^4.2.1",
39
80
  "ts-jest": "^29.1.2",
40
81
  "typescript": "^5.9.3"
41
82
  },
42
83
  "peerDependencies": {
43
- "react": ">=18.0.0",
44
- "react-native": ">=0.73.0",
45
- "react-native-mmkv": ">=3.0.0",
46
- "react-native-reanimated": ">=3.0.0",
47
- "react-native-vision-camera": ">=4.0.0"
84
+ "react": ">=18.2.0",
85
+ "react-native": ">=0.74.0",
86
+ "react-native-mmkv": ">=3.8.0",
87
+ "react-native-reanimated": ">=3.8.0",
88
+ "react-native-vision-camera": ">=4.7.0"
48
89
  },
49
90
  "peerDependenciesMeta": {
50
91
  "react-native-mmkv": {
@@ -58,21 +99,21 @@
58
99
  }
59
100
  },
60
101
  "dependencies": {
61
- "react-native-fast-tflite": "^1.5.0"
102
+ "@react-native-ml-kit/text-recognition": "^2.0.0",
103
+ "react-native-fast-tflite": "^1.5.0",
104
+ "react-native-worklets-core": "^1.6.2",
105
+ "vision-camera-resize-plugin": "^3.2.0"
62
106
  },
63
107
  "engines": {
64
108
  "node": ">=18.0.0"
65
109
  },
66
- "repository": {
67
- "type": "git",
68
- "url": "git@github.com:SousChefLabs/ml-vision.git"
69
- },
70
110
  "publishConfig": {
71
111
  "access": "public"
72
112
  },
73
113
  "files": [
74
114
  "dist",
75
115
  "README.md",
76
- "LICENSE"
116
+ "LICENSE",
117
+ "CHANGELOG.md"
77
118
  ]
78
119
  }
package/dist/index.d.ts DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * @souschef/ml-vision
3
- *
4
- * ML-powered product detection for React Native
5
- *
6
- * Features:
7
- * - Multi-barcode scanning (scan multiple barcodes at once)
8
- * - Receipt OCR (photograph receipts to extract items)
9
- * - Visual product recognition (recognize fridge/pantry contents)
10
- * - Video scanning (real-time product detection)
11
- *
12
- * @example
13
- * ```typescript
14
- * import {
15
- * MLVisionProvider,
16
- * useMultiBarcodeScanner,
17
- * useProductDetector,
18
- * useReceiptScanner,
19
- * } from '@souschef/ml-vision';
20
- *
21
- * // Wrap your app with the provider
22
- * function App() {
23
- * return (
24
- * <MLVisionProvider
25
- * config={{ serverUrl: 'http://192.168.1.100:8000' }}
26
- * storage={mmkvInstance}
27
- * >
28
- * <YourApp />
29
- * </MLVisionProvider>
30
- * );
31
- * }
32
- *
33
- * // Use hooks in your components
34
- * function ScannerScreen() {
35
- * const { scanPhoto, results } = useMultiBarcodeScanner();
36
- * const { detectProducts, detections } = useProductDetector();
37
- *
38
- * // ...
39
- * }
40
- * ```
41
- *
42
- * @packageDocumentation
43
- */
44
- export type { MLVisionConfig, BoundingBox, BaseDetectionResult, ModelInfo, ModelDownloadProgress, CacheEntry, CacheStats, ServerHealthResponse, ServerErrorResponse, BarcodeFormat, BarcodeData, BarcodeDetectionResult, UseMultiBarcodeScannerOptions, UseMultiBarcodeScannerReturn, BarcodeCacheEntry, ProductCategory, ProduceType, ProduceQuality, ProductData, ProductMatch, ProduceData, ProductDetectionResult, DetectionModel, UseProductDetectorOptions, UseProductDetectorReturn, TFLiteDetectionOutput, ClassLabelMap, TextLine, TextBlock, TextRecognitionResult, ReceiptItem, ReceiptMetadata, ReceiptScanResult, KnownStore, UseReceiptScannerOptions, UseReceiptScannerReturn, ReceiptLineType, ParsedReceiptLine, } from './types';
45
- export { GROCERY_BARCODE_FORMATS } from './types/barcode';
46
- export { MLVisionProvider, useMLVisionContext, useMLVisionReady, type MLVisionProviderProps, type MLVisionContextValue, CacheManager, createCacheManager, CACHE_TTL, type CachedBarcodeLookup, type CachedProductRecognition, ServerClient, createServerClient, ServerError, type ServerRequestOptions, type ImageUploadData, type DetectionRequestOptions, type OCRRequestOptions, } from './core';
47
- export { useProductDetector } from './hooks/useProductDetector';
48
- export { CLASS_LABELS, NUM_CLASSES, getClassInfo, getLabelsArray, CATEGORY_CLASSES, } from './hooks/classLabels';
49
- export { useMultiBarcodeScanner } from './hooks/useMultiBarcodeScanner';
50
- export { useReceiptScanner } from './hooks/useReceiptScanner';
51
- export { useVideoScanner, type ScanMode, type VideoScanResult, type UseVideoScannerOptions, type UseVideoScannerReturn, } from './hooks/useVideoScanner';
52
- export { DetectionOverlay, DetectionLoadingOverlay, type DetectionOverlayProps, } from './components';
53
- export { createDetectionProcessor, frameDetectionToResult, getClassLabel, type FrameDetection, type DetectionProcessorOptions, } from './processors';
54
- export { useTFLiteFrameProcessor, createTFLiteFrameProcessor, type TFLiteFrameDetection, type FrameProcessorResult, type UseTFLiteFrameProcessorOptions, } from './processors';
55
- export { preprocessImage, isSkiaAvailable, isResizePluginAvailable, getFrameProcessorInstructions, } from './utils/imagePreprocessor';
56
- export { processYoloOutput, scaleDetections, } from './utils/yoloProcessor';
57
- export { COCO_CLASSES, CLASS_LABELS_COCO, NUM_CLASSES_COCO, FOOD_CLASS_INDICES, getCocoClassInfo, isFoodClass, } from './hooks/classLabelsCoco';
58
- export declare const VERSION = "0.1.0";