From 3b07ad6743d191d77f542c906bad51af6ea0780f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:59:30 -0500 Subject: [PATCH] Version Packages (#184) * RELEASING: Releasing 8 package(s) Releases: @infinitered/react-native-mlkit-object-detection@3.0.0 @infinitered/react-native-mlkit-face-detection@3.0.0 @infinitered/react-native-mlkit-image-labeling@3.0.0 @infinitered/react-native-mlkit-core@3.0.0 @infinitered/react-native-mlkit-document-scanner@3.0.0 example-app@4.0.0 @infinitered/react-native-mlkit-docs@0.6.0 @infinitered/tsconfig@0.4.0 * Version Packages --------- Co-authored-by: github-actions[bot] --- .changeset/afraid-knives-pull.md | 8 - .changeset/early-jars-give.md | 200 ---------------- .changeset/fifty-walls-fry.md | 12 - .changeset/wet-cups-burn.md | 5 - apps/ExampleApp/CHANGELOG.md | 16 ++ apps/ExampleApp/package.json | 12 +- modules/react-native-mlkit-core/CHANGELOG.md | 206 +++++++++++++++++ modules/react-native-mlkit-core/package.json | 4 +- .../CHANGELOG.md | 14 ++ .../package.json | 4 +- .../CHANGELOG.md | 18 ++ .../package.json | 4 +- .../CHANGELOG.md | 213 ++++++++++++++++++ .../package.json | 4 +- .../CHANGELOG.md | 213 ++++++++++++++++++ .../package.json | 6 +- packages/docusaurus/CHANGELOG.md | 6 + packages/docusaurus/package.json | 2 +- packages/tsconfig/CHANGELOG.md | 6 + packages/tsconfig/package.json | 2 +- yarn.lock | 32 +-- 21 files changed, 727 insertions(+), 260 deletions(-) delete mode 100644 .changeset/afraid-knives-pull.md delete mode 100644 .changeset/early-jars-give.md delete mode 100644 .changeset/fifty-walls-fry.md delete mode 100644 .changeset/wet-cups-burn.md diff --git a/.changeset/afraid-knives-pull.md b/.changeset/afraid-knives-pull.md deleted file mode 100644 index ab56acd9..00000000 --- a/.changeset/afraid-knives-pull.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@infinitered/react-native-mlkit-object-detection": minor -"@infinitered/react-native-mlkit-face-detection": minor -"@infinitered/react-native-mlkit-image-labeling": minor -"@infinitered/react-native-mlkit-core": minor ---- - -align podspec platform requirements with expo version diff --git a/.changeset/early-jars-give.md b/.changeset/early-jars-give.md deleted file mode 100644 index 82e4e80a..00000000 --- a/.changeset/early-jars-give.md +++ /dev/null @@ -1,200 +0,0 @@ ---- -"@infinitered/react-native-mlkit-object-detection": major -"@infinitered/react-native-mlkit-image-labeling": major -"@infinitered/react-native-mlkit-core": major ---- - -Standardize API patterns and coordinate structures across ML Kit modules - -1. Separates model operations into three hooks with simpler APIs - 1. loading the models, (`useObjectDetectionModels`, `useImageLabelingModels`) - 2. initializing the provider (`useObjectDetectionProvider`, `useImageLabelingProvider`) - 3. accessing models for inference, (`useObjectDetector`, `useImageLabeling`) -2. Implements consistent naming patterns to make the APIs more legible - - Removes "RNMLKit" prefix from non-native types - - Use specific names for hooks (`useImageLabelingModels` instead of `useModels`) - - Model configs are now `Configs`, instead of `AssetRecords` -3. Moves base types into the `core` package to ensure consistency -4. Fixes an issue with bounding box placement on portrait / rotated images on iOS -5. Improves error handling and state management -6. Updates documentation to match the new API - -## Breaking Changes - -### Image Labeling - -- Renamed `useModels` to `useImageLabelingModels` for clarity -- Renamed `useImageLabeler` to `useImageLabeling` -- Introduced new `useImageLabelingProvider` hook for cleaner context management -- Added type-safe configurations with `ImageLabelingConfig` -- Renamed model context provider from `ObjectDetectionModelContextProvider` to `ImageLabelingModelProvider` - -Here's how to update your app: - -#### Fetching the provider - -```diff -- const MODELS: AssetRecord = { -+ const MODELS: ImageLabelingConfig = { - nsfwDetector: { - model: require("./assets/models/nsfw-detector.tflite"), - options: { - maxResultCount: 5, - confidenceThreshold: 0.5, - } - }, -}; - -function App() { -- const { ObjectDetectionModelContextProvider } = useModels(MODELS) -+ const models = useImageLabelingModels(MODELS) -+ const { ImageLabelingModelProvider } = useImageLabelingProvider(models) - - return ( -- -+ - {/* Rest of your app */} -- -+ - ) -} -``` - -#### Using the model - -```diff -- const model = useImageLabeler("nsfwDetector") -+ const detector = useImageLabeling("nsfwDetector") - -const labels = await detector.classifyImage(imagePath) -``` - -### Object Detection - -- `useObjectDetectionModels` now requires an `assets` parameter -- `useObjectDetector` is now `useObjectDetection` -- Introduced new `useObjectDetectionProvider` hook for context management -- Renamed and standardized type definitions: - - `RNMLKitObjectDetectionObject` → `ObjectDetectionObject` - - `RNMLKitObjectDetectorOptions` → `ObjectDetectorOptions` - - `RNMLKitCustomObjectDetectorOptions` → `CustomObjectDetectorOptions` -- Added new types: `ObjectDetectionModelInfo`, `ObjectDetectionConfig`, `ObjectDetectionModels` -- Moved model configuration to typed asset records -- Default model now included in models type union - -Here's how to update your app: - -#### Fetching the provider - -```diff - -- const MODELS: AssetRecord = { -+ const MODELS: ObjectDetectionConfig = { - birdDetector: { - model: require("./assets/models/bird-detector.tflite"), - options: { - shouldEnableClassification: false, - shouldEnableMultipleObjects: false, - } - }, -}; - -function App() { - -- const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({ -- assets: MODELS, -- loadDefaultModel: true, -- defaultModelOptions: DEFAULT_MODEL_OPTIONS, -- }) - -+ const models = useObjectDetectionModels({ -+ assets: MODELS, -+ loadDefaultModel: true, -+ defaultModelOptions: DEFAULT_MODEL_OPTIONS, -+ }) -+ -+ const { ObjectDetectionProvider } = useObjectDetectionProvider(models) - - return ( -- -+ - {/* Rest of your app */} -- -+ -) -} - -``` - -#### Using the model - -```diff -- const {models: {birdDetector} = useObjectDetectionModels({ -- assets: MODELS, -- loadDefaultModel: true, -- defaultModelOptions: DEFAULT_MODEL_OPTIONS, -- }) -- -+ const birdDetector = useObjectDetection("birdDetector") - -const objects = birdDetector.detectObjects(imagePath) -``` - -### Face Detection - -- Changed option naming conventions to match ML Kit SDK patterns: -- `detectLandmarks` → `landmarkMode` -- `runClassifications` → `classificationMode` -- Changed default `performanceMode` from `accurate` to `fast` -- Renamed hook from `useFaceDetector` to `useFaceDetection` -- Renamed context provider from `RNMLKitFaceDetectionContextProvider` to `FaceDetectionProvider` -- Added comprehensive error handling -- Added new state management with `FaceDetectionState` type - -Here's how to update your app: - -#### Using the detector - -```diff -const options = { -- detectLandmarks: true, -+ landmarkMode: true, -- runClassifications: true, -+ classificationMode: true, -} -``` - -#### Using the provider - -```diff -- import { RNMLKitFaceDetectionContextProvider } from "@infinitered/react-native-mlkit-face-detection" -+ import { FaceDetectionProvider } from "@infinitered/react-native-mlkit-face-detection" - -function App() { - return ( -- -+ - {/* Rest of your app */} -- -+ - ) -} -``` - -#### Using the hooks - -```diff -- const detector = useFaceDetector() -+ const detector = useFaceDetection() - -// useFacesInPhoto remains unchanged -const { faces, status, error } = useFacesInPhoto(imageUri) -``` - -### Core Module - -- Introduced shared TypeScript interfaces: - - `ModelInfo` - - `AssetRecord` -- Standardized frame coordinate structure -- Implemented consistent type patterns diff --git a/.changeset/fifty-walls-fry.md b/.changeset/fifty-walls-fry.md deleted file mode 100644 index f3334c4e..00000000 --- a/.changeset/fifty-walls-fry.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"@infinitered/react-native-mlkit-document-scanner": major -"@infinitered/react-native-mlkit-object-detection": major -"@infinitered/react-native-mlkit-face-detection": major -"@infinitered/react-native-mlkit-image-labeling": major -"@infinitered/react-native-mlkit-core": major -"example-app": major -"@infinitered/react-native-mlkit-docs": minor -"@infinitered/tsconfig": minor ---- - -Upgrade to expo 52 diff --git a/.changeset/wet-cups-burn.md b/.changeset/wet-cups-burn.md deleted file mode 100644 index d75be73e..00000000 --- a/.changeset/wet-cups-burn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@infinitered/react-native-mlkit-core": minor ---- - -fix: sets static builds in core podspec to prevent dependency conflicts diff --git a/apps/ExampleApp/CHANGELOG.md b/apps/ExampleApp/CHANGELOG.md index 5415fdfc..f276b20f 100644 --- a/apps/ExampleApp/CHANGELOG.md +++ b/apps/ExampleApp/CHANGELOG.md @@ -1,5 +1,21 @@ # example-app +## 4.0.0 + +### Major Changes + +- b668ab0: Upgrade to expo 52 + +### Patch Changes + +- Updated dependencies [b668ab0] +- Updated dependencies [83b7e6e] +- Updated dependencies [b668ab0] + - @infinitered/react-native-mlkit-object-detection@3.0.0 + - @infinitered/react-native-mlkit-face-detection@3.0.0 + - @infinitered/react-native-mlkit-image-labeling@3.0.0 + - @infinitered/react-native-mlkit-document-scanner@3.0.0 + ## 3.0.0 ### Major Changes diff --git a/apps/ExampleApp/package.json b/apps/ExampleApp/package.json index 82320a7a..235c7e08 100644 --- a/apps/ExampleApp/package.json +++ b/apps/ExampleApp/package.json @@ -1,6 +1,6 @@ { "name": "example-app", - "version": "3.0.0", + "version": "4.0.0", "private": true, "main": "./index.js", "scripts": { @@ -32,10 +32,10 @@ "dependencies": { "@expo-google-fonts/space-grotesk": "^0.2.2", "@expo/metro-runtime": "~4.0.1", - "@infinitered/react-native-mlkit-document-scanner": "workspace:^2.0.1", - "@infinitered/react-native-mlkit-face-detection": "workspace:^2.0.1", - "@infinitered/react-native-mlkit-image-labeling": "workspace:^2.0.1", - "@infinitered/react-native-mlkit-object-detection": "workspace:^2.0.1", + "@infinitered/react-native-mlkit-document-scanner": "workspace:^3.0.0", + "@infinitered/react-native-mlkit-face-detection": "workspace:^3.0.0", + "@infinitered/react-native-mlkit-image-labeling": "workspace:^3.0.0", + "@infinitered/react-native-mlkit-object-detection": "workspace:^3.0.0", "@react-native-async-storage/async-storage": "^2.0.0", "@react-navigation/native": "^6.0.8", "@react-navigation/native-stack": "^6.0.2", @@ -76,7 +76,7 @@ "@babel/plugin-transform-template-literals": "^7.0.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", - "@infinitered/tsconfig": "0.3.0", + "@infinitered/tsconfig": "0.4.0", "@react-native-community/cli": "^15.0.0", "@react-native-community/cli-platform-android": "^15.0.0", "@react-native-community/cli-platform-ios": "^15.0.0", diff --git a/modules/react-native-mlkit-core/CHANGELOG.md b/modules/react-native-mlkit-core/CHANGELOG.md index 5a2053d6..b154156a 100644 --- a/modules/react-native-mlkit-core/CHANGELOG.md +++ b/modules/react-native-mlkit-core/CHANGELOG.md @@ -1,5 +1,211 @@ # @infinitered/react-native-mlkit-core +## 3.0.0 + +### Major Changes + +- 83b7e6e: Standardize API patterns and coordinate structures across ML Kit modules + + 1. Separates model operations into three hooks with simpler APIs + 1. loading the models, (`useObjectDetectionModels`, `useImageLabelingModels`) + 2. initializing the provider (`useObjectDetectionProvider`, `useImageLabelingProvider`) + 3. accessing models for inference, (`useObjectDetector`, `useImageLabeling`) + 2. Implements consistent naming patterns to make the APIs more legible + - Removes "RNMLKit" prefix from non-native types + - Use specific names for hooks (`useImageLabelingModels` instead of `useModels`) + - Model configs are now `Configs`, instead of `AssetRecords` + 3. Moves base types into the `core` package to ensure consistency + 4. Fixes an issue with bounding box placement on portrait / rotated images on iOS + 5. Improves error handling and state management + 6. Updates documentation to match the new API + + ## Breaking Changes + + ### Image Labeling + + - Renamed `useModels` to `useImageLabelingModels` for clarity + - Renamed `useImageLabeler` to `useImageLabeling` + - Introduced new `useImageLabelingProvider` hook for cleaner context management + - Added type-safe configurations with `ImageLabelingConfig` + - Renamed model context provider from `ObjectDetectionModelContextProvider` to `ImageLabelingModelProvider` + + Here's how to update your app: + + #### Fetching the provider + + ```diff + - const MODELS: AssetRecord = { + + const MODELS: ImageLabelingConfig = { + nsfwDetector: { + model: require("./assets/models/nsfw-detector.tflite"), + options: { + maxResultCount: 5, + confidenceThreshold: 0.5, + } + }, + }; + + function App() { + - const { ObjectDetectionModelContextProvider } = useModels(MODELS) + + const models = useImageLabelingModels(MODELS) + + const { ImageLabelingModelProvider } = useImageLabelingProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the model + + ```diff + - const model = useImageLabeler("nsfwDetector") + + const detector = useImageLabeling("nsfwDetector") + + const labels = await detector.classifyImage(imagePath) + ``` + + ### Object Detection + + - `useObjectDetectionModels` now requires an `assets` parameter + - `useObjectDetector` is now `useObjectDetection` + - Introduced new `useObjectDetectionProvider` hook for context management + - Renamed and standardized type definitions: + - `RNMLKitObjectDetectionObject` → `ObjectDetectionObject` + - `RNMLKitObjectDetectorOptions` → `ObjectDetectorOptions` + - `RNMLKitCustomObjectDetectorOptions` → `CustomObjectDetectorOptions` + - Added new types: `ObjectDetectionModelInfo`, `ObjectDetectionConfig`, `ObjectDetectionModels` + - Moved model configuration to typed asset records + - Default model now included in models type union + + Here's how to update your app: + + #### Fetching the provider + + ```diff + + - const MODELS: AssetRecord = { + + const MODELS: ObjectDetectionConfig = { + birdDetector: { + model: require("./assets/models/bird-detector.tflite"), + options: { + shouldEnableClassification: false, + shouldEnableMultipleObjects: false, + } + }, + }; + + function App() { + + - const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + + + const models = useObjectDetectionModels({ + + assets: MODELS, + + loadDefaultModel: true, + + defaultModelOptions: DEFAULT_MODEL_OPTIONS, + + }) + + + + const { ObjectDetectionProvider } = useObjectDetectionProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + + ``` + + #### Using the model + + ```diff + - const {models: {birdDetector} = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + - + + const birdDetector = useObjectDetection("birdDetector") + + const objects = birdDetector.detectObjects(imagePath) + ``` + + ### Face Detection + + - Changed option naming conventions to match ML Kit SDK patterns: + - `detectLandmarks` → `landmarkMode` + - `runClassifications` → `classificationMode` + - Changed default `performanceMode` from `accurate` to `fast` + - Renamed hook from `useFaceDetector` to `useFaceDetection` + - Renamed context provider from `RNMLKitFaceDetectionContextProvider` to `FaceDetectionProvider` + - Added comprehensive error handling + - Added new state management with `FaceDetectionState` type + + Here's how to update your app: + + #### Using the detector + + ```diff + const options = { + - detectLandmarks: true, + + landmarkMode: true, + - runClassifications: true, + + classificationMode: true, + } + ``` + + #### Using the provider + + ```diff + - import { RNMLKitFaceDetectionContextProvider } from "@infinitered/react-native-mlkit-face-detection" + + import { FaceDetectionProvider } from "@infinitered/react-native-mlkit-face-detection" + + function App() { + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the hooks + + ```diff + - const detector = useFaceDetector() + + const detector = useFaceDetection() + + // useFacesInPhoto remains unchanged + const { faces, status, error } = useFacesInPhoto(imageUri) + ``` + + ### Core Module + + - Introduced shared TypeScript interfaces: + - `ModelInfo` + - `AssetRecord` + - Standardized frame coordinate structure + - Implemented consistent type patterns + +- b668ab0: Upgrade to expo 52 + +### Minor Changes + +- b668ab0: align podspec platform requirements with expo version +- 213f085: fix: sets static builds in core podspec to prevent dependency conflicts + ## 2.1.0 ### Minor Changes diff --git a/modules/react-native-mlkit-core/package.json b/modules/react-native-mlkit-core/package.json index a0987189..1caaab5f 100644 --- a/modules/react-native-mlkit-core/package.json +++ b/modules/react-native-mlkit-core/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-core", - "version": "2.1.0", + "version": "3.0.0", "description": "Shared Library for RNMLKit", "main": "build/index.js", "types": "build/index.d.ts", @@ -28,7 +28,7 @@ "homepage": "https://infinitered.github.io/react-native-mlkit", "devDependencies": { "@babel/plugin-transform-private-methods": "^7.24.7", - "@infinitered/tsconfig": "0.3.0", + "@infinitered/tsconfig": "0.4.0", "@rnx-kit/align-deps": "^3.0.3", "@testing-library/react-native": "^13.0.1", "expo-asset": "^11.0.3", diff --git a/modules/react-native-mlkit-document-scanner/CHANGELOG.md b/modules/react-native-mlkit-document-scanner/CHANGELOG.md index 909a654d..22c792c0 100644 --- a/modules/react-native-mlkit-document-scanner/CHANGELOG.md +++ b/modules/react-native-mlkit-document-scanner/CHANGELOG.md @@ -1,5 +1,19 @@ # @infinitered/react-native-mlkit-document-scanner +## 3.0.0 + +### Major Changes + +- b668ab0: Upgrade to expo 52 + +### Patch Changes + +- Updated dependencies [b668ab0] +- Updated dependencies [83b7e6e] +- Updated dependencies [b668ab0] +- Updated dependencies [213f085] + - @infinitered/react-native-mlkit-core@3.0.0 + ## 2.0.1 ### Patch Changes diff --git a/modules/react-native-mlkit-document-scanner/package.json b/modules/react-native-mlkit-document-scanner/package.json index af5a219a..affb27b0 100644 --- a/modules/react-native-mlkit-document-scanner/package.json +++ b/modules/react-native-mlkit-document-scanner/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-document-scanner", - "version": "2.0.1", + "version": "3.0.0", "description": "MLKit Document Scanner for Expo", "main": "build/index.js", "types": "build/index.d.ts", @@ -27,7 +27,7 @@ "license": "MIT", "homepage": "https://docs.infinite.red/category/document-scanner/", "dependencies": { - "@infinitered/react-native-mlkit-core": "2.1.0" + "@infinitered/react-native-mlkit-core": "3.0.0" }, "devDependencies": { "@types/react": "~18.3.12", diff --git a/modules/react-native-mlkit-face-detection/CHANGELOG.md b/modules/react-native-mlkit-face-detection/CHANGELOG.md index f013eb84..140b8d94 100644 --- a/modules/react-native-mlkit-face-detection/CHANGELOG.md +++ b/modules/react-native-mlkit-face-detection/CHANGELOG.md @@ -1,5 +1,23 @@ # @infinitered/react-native-mlkit-face-detection +## 3.0.0 + +### Major Changes + +- b668ab0: Upgrade to expo 52 + +### Minor Changes + +- b668ab0: align podspec platform requirements with expo version + +### Patch Changes + +- Updated dependencies [b668ab0] +- Updated dependencies [83b7e6e] +- Updated dependencies [b668ab0] +- Updated dependencies [213f085] + - @infinitered/react-native-mlkit-core@3.0.0 + ## 2.0.1 ### Patch Changes diff --git a/modules/react-native-mlkit-face-detection/package.json b/modules/react-native-mlkit-face-detection/package.json index 21e6b2d9..f30ac5c0 100644 --- a/modules/react-native-mlkit-face-detection/package.json +++ b/modules/react-native-mlkit-face-detection/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-face-detection", - "version": "2.0.1", + "version": "3.0.0", "description": "MLKit Face Detection for Expo", "main": "build/index.js", "types": "build/index.d.ts", @@ -27,7 +27,7 @@ "license": "MIT", "homepage": "https://docs.infinite.red/category/face-detection/", "dependencies": { - "@infinitered/react-native-mlkit-core": "2.1.0" + "@infinitered/react-native-mlkit-core": "3.0.0" }, "devDependencies": { "@types/react": "~18.3.12", diff --git a/modules/react-native-mlkit-image-labeling/CHANGELOG.md b/modules/react-native-mlkit-image-labeling/CHANGELOG.md index 8006e1b8..94153226 100644 --- a/modules/react-native-mlkit-image-labeling/CHANGELOG.md +++ b/modules/react-native-mlkit-image-labeling/CHANGELOG.md @@ -1,5 +1,218 @@ # Changelog +## 3.0.0 + +### Major Changes + +- 83b7e6e: Standardize API patterns and coordinate structures across ML Kit modules + + 1. Separates model operations into three hooks with simpler APIs + 1. loading the models, (`useObjectDetectionModels`, `useImageLabelingModels`) + 2. initializing the provider (`useObjectDetectionProvider`, `useImageLabelingProvider`) + 3. accessing models for inference, (`useObjectDetector`, `useImageLabeling`) + 2. Implements consistent naming patterns to make the APIs more legible + - Removes "RNMLKit" prefix from non-native types + - Use specific names for hooks (`useImageLabelingModels` instead of `useModels`) + - Model configs are now `Configs`, instead of `AssetRecords` + 3. Moves base types into the `core` package to ensure consistency + 4. Fixes an issue with bounding box placement on portrait / rotated images on iOS + 5. Improves error handling and state management + 6. Updates documentation to match the new API + + ## Breaking Changes + + ### Image Labeling + + - Renamed `useModels` to `useImageLabelingModels` for clarity + - Renamed `useImageLabeler` to `useImageLabeling` + - Introduced new `useImageLabelingProvider` hook for cleaner context management + - Added type-safe configurations with `ImageLabelingConfig` + - Renamed model context provider from `ObjectDetectionModelContextProvider` to `ImageLabelingModelProvider` + + Here's how to update your app: + + #### Fetching the provider + + ```diff + - const MODELS: AssetRecord = { + + const MODELS: ImageLabelingConfig = { + nsfwDetector: { + model: require("./assets/models/nsfw-detector.tflite"), + options: { + maxResultCount: 5, + confidenceThreshold: 0.5, + } + }, + }; + + function App() { + - const { ObjectDetectionModelContextProvider } = useModels(MODELS) + + const models = useImageLabelingModels(MODELS) + + const { ImageLabelingModelProvider } = useImageLabelingProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the model + + ```diff + - const model = useImageLabeler("nsfwDetector") + + const detector = useImageLabeling("nsfwDetector") + + const labels = await detector.classifyImage(imagePath) + ``` + + ### Object Detection + + - `useObjectDetectionModels` now requires an `assets` parameter + - `useObjectDetector` is now `useObjectDetection` + - Introduced new `useObjectDetectionProvider` hook for context management + - Renamed and standardized type definitions: + - `RNMLKitObjectDetectionObject` → `ObjectDetectionObject` + - `RNMLKitObjectDetectorOptions` → `ObjectDetectorOptions` + - `RNMLKitCustomObjectDetectorOptions` → `CustomObjectDetectorOptions` + - Added new types: `ObjectDetectionModelInfo`, `ObjectDetectionConfig`, `ObjectDetectionModels` + - Moved model configuration to typed asset records + - Default model now included in models type union + + Here's how to update your app: + + #### Fetching the provider + + ```diff + + - const MODELS: AssetRecord = { + + const MODELS: ObjectDetectionConfig = { + birdDetector: { + model: require("./assets/models/bird-detector.tflite"), + options: { + shouldEnableClassification: false, + shouldEnableMultipleObjects: false, + } + }, + }; + + function App() { + + - const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + + + const models = useObjectDetectionModels({ + + assets: MODELS, + + loadDefaultModel: true, + + defaultModelOptions: DEFAULT_MODEL_OPTIONS, + + }) + + + + const { ObjectDetectionProvider } = useObjectDetectionProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + + ``` + + #### Using the model + + ```diff + - const {models: {birdDetector} = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + - + + const birdDetector = useObjectDetection("birdDetector") + + const objects = birdDetector.detectObjects(imagePath) + ``` + + ### Face Detection + + - Changed option naming conventions to match ML Kit SDK patterns: + - `detectLandmarks` → `landmarkMode` + - `runClassifications` → `classificationMode` + - Changed default `performanceMode` from `accurate` to `fast` + - Renamed hook from `useFaceDetector` to `useFaceDetection` + - Renamed context provider from `RNMLKitFaceDetectionContextProvider` to `FaceDetectionProvider` + - Added comprehensive error handling + - Added new state management with `FaceDetectionState` type + + Here's how to update your app: + + #### Using the detector + + ```diff + const options = { + - detectLandmarks: true, + + landmarkMode: true, + - runClassifications: true, + + classificationMode: true, + } + ``` + + #### Using the provider + + ```diff + - import { RNMLKitFaceDetectionContextProvider } from "@infinitered/react-native-mlkit-face-detection" + + import { FaceDetectionProvider } from "@infinitered/react-native-mlkit-face-detection" + + function App() { + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the hooks + + ```diff + - const detector = useFaceDetector() + + const detector = useFaceDetection() + + // useFacesInPhoto remains unchanged + const { faces, status, error } = useFacesInPhoto(imageUri) + ``` + + ### Core Module + + - Introduced shared TypeScript interfaces: + - `ModelInfo` + - `AssetRecord` + - Standardized frame coordinate structure + - Implemented consistent type patterns + +- b668ab0: Upgrade to expo 52 + +### Minor Changes + +- b668ab0: align podspec platform requirements with expo version + +### Patch Changes + +- Updated dependencies [b668ab0] +- Updated dependencies [83b7e6e] +- Updated dependencies [b668ab0] +- Updated dependencies [213f085] + - @infinitered/react-native-mlkit-core@3.0.0 + ## 2.0.1 ### Patch Changes diff --git a/modules/react-native-mlkit-image-labeling/package.json b/modules/react-native-mlkit-image-labeling/package.json index 745ca9fd..6f8d7b9b 100644 --- a/modules/react-native-mlkit-image-labeling/package.json +++ b/modules/react-native-mlkit-image-labeling/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-image-labeling", - "version": "2.0.1", + "version": "3.0.0", "description": "MLKit Image Labeling for React Native with Expo", "main": "build/index.js", "types": "build/index.d.ts", @@ -27,7 +27,7 @@ "license": "MIT", "homepage": "https://docs.infinite.red/category/image-labeling/", "dependencies": { - "@infinitered/react-native-mlkit-core": "2.1.0" + "@infinitered/react-native-mlkit-core": "3.0.0" }, "devDependencies": { "@types/react": "~18.3.12", diff --git a/modules/react-native-mlkit-object-detection/CHANGELOG.md b/modules/react-native-mlkit-object-detection/CHANGELOG.md index 756b4ade..0b4ba79b 100644 --- a/modules/react-native-mlkit-object-detection/CHANGELOG.md +++ b/modules/react-native-mlkit-object-detection/CHANGELOG.md @@ -1,5 +1,218 @@ # Changelog +## 3.0.0 + +### Major Changes + +- 83b7e6e: Standardize API patterns and coordinate structures across ML Kit modules + + 1. Separates model operations into three hooks with simpler APIs + 1. loading the models, (`useObjectDetectionModels`, `useImageLabelingModels`) + 2. initializing the provider (`useObjectDetectionProvider`, `useImageLabelingProvider`) + 3. accessing models for inference, (`useObjectDetector`, `useImageLabeling`) + 2. Implements consistent naming patterns to make the APIs more legible + - Removes "RNMLKit" prefix from non-native types + - Use specific names for hooks (`useImageLabelingModels` instead of `useModels`) + - Model configs are now `Configs`, instead of `AssetRecords` + 3. Moves base types into the `core` package to ensure consistency + 4. Fixes an issue with bounding box placement on portrait / rotated images on iOS + 5. Improves error handling and state management + 6. Updates documentation to match the new API + + ## Breaking Changes + + ### Image Labeling + + - Renamed `useModels` to `useImageLabelingModels` for clarity + - Renamed `useImageLabeler` to `useImageLabeling` + - Introduced new `useImageLabelingProvider` hook for cleaner context management + - Added type-safe configurations with `ImageLabelingConfig` + - Renamed model context provider from `ObjectDetectionModelContextProvider` to `ImageLabelingModelProvider` + + Here's how to update your app: + + #### Fetching the provider + + ```diff + - const MODELS: AssetRecord = { + + const MODELS: ImageLabelingConfig = { + nsfwDetector: { + model: require("./assets/models/nsfw-detector.tflite"), + options: { + maxResultCount: 5, + confidenceThreshold: 0.5, + } + }, + }; + + function App() { + - const { ObjectDetectionModelContextProvider } = useModels(MODELS) + + const models = useImageLabelingModels(MODELS) + + const { ImageLabelingModelProvider } = useImageLabelingProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the model + + ```diff + - const model = useImageLabeler("nsfwDetector") + + const detector = useImageLabeling("nsfwDetector") + + const labels = await detector.classifyImage(imagePath) + ``` + + ### Object Detection + + - `useObjectDetectionModels` now requires an `assets` parameter + - `useObjectDetector` is now `useObjectDetection` + - Introduced new `useObjectDetectionProvider` hook for context management + - Renamed and standardized type definitions: + - `RNMLKitObjectDetectionObject` → `ObjectDetectionObject` + - `RNMLKitObjectDetectorOptions` → `ObjectDetectorOptions` + - `RNMLKitCustomObjectDetectorOptions` → `CustomObjectDetectorOptions` + - Added new types: `ObjectDetectionModelInfo`, `ObjectDetectionConfig`, `ObjectDetectionModels` + - Moved model configuration to typed asset records + - Default model now included in models type union + + Here's how to update your app: + + #### Fetching the provider + + ```diff + + - const MODELS: AssetRecord = { + + const MODELS: ObjectDetectionConfig = { + birdDetector: { + model: require("./assets/models/bird-detector.tflite"), + options: { + shouldEnableClassification: false, + shouldEnableMultipleObjects: false, + } + }, + }; + + function App() { + + - const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + + + const models = useObjectDetectionModels({ + + assets: MODELS, + + loadDefaultModel: true, + + defaultModelOptions: DEFAULT_MODEL_OPTIONS, + + }) + + + + const { ObjectDetectionProvider } = useObjectDetectionProvider(models) + + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + + ``` + + #### Using the model + + ```diff + - const {models: {birdDetector} = useObjectDetectionModels({ + - assets: MODELS, + - loadDefaultModel: true, + - defaultModelOptions: DEFAULT_MODEL_OPTIONS, + - }) + - + + const birdDetector = useObjectDetection("birdDetector") + + const objects = birdDetector.detectObjects(imagePath) + ``` + + ### Face Detection + + - Changed option naming conventions to match ML Kit SDK patterns: + - `detectLandmarks` → `landmarkMode` + - `runClassifications` → `classificationMode` + - Changed default `performanceMode` from `accurate` to `fast` + - Renamed hook from `useFaceDetector` to `useFaceDetection` + - Renamed context provider from `RNMLKitFaceDetectionContextProvider` to `FaceDetectionProvider` + - Added comprehensive error handling + - Added new state management with `FaceDetectionState` type + + Here's how to update your app: + + #### Using the detector + + ```diff + const options = { + - detectLandmarks: true, + + landmarkMode: true, + - runClassifications: true, + + classificationMode: true, + } + ``` + + #### Using the provider + + ```diff + - import { RNMLKitFaceDetectionContextProvider } from "@infinitered/react-native-mlkit-face-detection" + + import { FaceDetectionProvider } from "@infinitered/react-native-mlkit-face-detection" + + function App() { + return ( + - + + + {/* Rest of your app */} + - + + + ) + } + ``` + + #### Using the hooks + + ```diff + - const detector = useFaceDetector() + + const detector = useFaceDetection() + + // useFacesInPhoto remains unchanged + const { faces, status, error } = useFacesInPhoto(imageUri) + ``` + + ### Core Module + + - Introduced shared TypeScript interfaces: + - `ModelInfo` + - `AssetRecord` + - Standardized frame coordinate structure + - Implemented consistent type patterns + +- b668ab0: Upgrade to expo 52 + +### Minor Changes + +- b668ab0: align podspec platform requirements with expo version + +### Patch Changes + +- Updated dependencies [b668ab0] +- Updated dependencies [83b7e6e] +- Updated dependencies [b668ab0] +- Updated dependencies [213f085] + - @infinitered/react-native-mlkit-core@3.0.0 + ## 2.0.1 ### Patch Changes diff --git a/modules/react-native-mlkit-object-detection/package.json b/modules/react-native-mlkit-object-detection/package.json index 00893cf1..3c698246 100644 --- a/modules/react-native-mlkit-object-detection/package.json +++ b/modules/react-native-mlkit-object-detection/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-object-detection", - "version": "2.0.1", + "version": "3.0.0", "description": "Expo module for MLKit Object Detection", "main": "build/index.js", "types": "build/index.d.ts", @@ -27,10 +27,10 @@ "license": "MIT", "homepage": "https://docs.infinite.red/category/object-detection/", "dependencies": { - "@infinitered/react-native-mlkit-core": "2.1.0" + "@infinitered/react-native-mlkit-core": "3.0.0" }, "devDependencies": { - "@infinitered/react-native-mlkit-core": "2.1.0", + "@infinitered/react-native-mlkit-core": "3.0.0", "@types/react": "~18.3.12", "expo-module-scripts": "^3.4.1", "expo-modules-core": "~2.2.0", diff --git a/packages/docusaurus/CHANGELOG.md b/packages/docusaurus/CHANGELOG.md index 0ff3ef92..aa0817bb 100644 --- a/packages/docusaurus/CHANGELOG.md +++ b/packages/docusaurus/CHANGELOG.md @@ -1,5 +1,11 @@ # docusaurus +## 0.6.0 + +### Minor Changes + +- b668ab0: Upgrade to expo 52 + ## 0.5.12 ### Patch Changes diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index a721ed93..f74dca94 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/react-native-mlkit-docs", - "version": "0.5.12", + "version": "0.6.0", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/packages/tsconfig/CHANGELOG.md b/packages/tsconfig/CHANGELOG.md index 910a4d89..004b15ab 100644 --- a/packages/tsconfig/CHANGELOG.md +++ b/packages/tsconfig/CHANGELOG.md @@ -1,5 +1,11 @@ # @infinitered/tsconfig +## 0.4.0 + +### Minor Changes + +- b668ab0: Upgrade to expo 52 + ## 0.3.0 ### Minor Changes diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index 17d4cfc2..96f6b07e 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -1,6 +1,6 @@ { "name": "@infinitered/tsconfig", - "version": "0.3.0", + "version": "0.4.0", "private": true, "license": "MIT", "dependencies": { diff --git a/yarn.lock b/yarn.lock index 3214590a..7d214ec7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4195,12 +4195,12 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/react-native-mlkit-core@2.1.0, @infinitered/react-native-mlkit-core@workspace:modules/react-native-mlkit-core": +"@infinitered/react-native-mlkit-core@3.0.0, @infinitered/react-native-mlkit-core@workspace:modules/react-native-mlkit-core": version: 0.0.0-use.local resolution: "@infinitered/react-native-mlkit-core@workspace:modules/react-native-mlkit-core" dependencies: "@babel/plugin-transform-private-methods": ^7.24.7 - "@infinitered/tsconfig": 0.3.0 + "@infinitered/tsconfig": 0.4.0 "@rnx-kit/align-deps": ^3.0.3 "@testing-library/jest-native": ^5.4.3 "@testing-library/react-hooks": ^8.0.1 @@ -4241,11 +4241,11 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/react-native-mlkit-document-scanner@workspace:^2.0.1, @infinitered/react-native-mlkit-document-scanner@workspace:modules/react-native-mlkit-document-scanner": +"@infinitered/react-native-mlkit-document-scanner@workspace:^3.0.0, @infinitered/react-native-mlkit-document-scanner@workspace:modules/react-native-mlkit-document-scanner": version: 0.0.0-use.local resolution: "@infinitered/react-native-mlkit-document-scanner@workspace:modules/react-native-mlkit-document-scanner" dependencies: - "@infinitered/react-native-mlkit-core": 2.1.0 + "@infinitered/react-native-mlkit-core": 3.0.0 "@types/react": ~18.3.12 expo-module-scripts: ^3.4.1 expo-modules-core: ~2.2.0 @@ -4256,11 +4256,11 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/react-native-mlkit-face-detection@workspace:^2.0.1, @infinitered/react-native-mlkit-face-detection@workspace:modules/react-native-mlkit-face-detection": +"@infinitered/react-native-mlkit-face-detection@workspace:^3.0.0, @infinitered/react-native-mlkit-face-detection@workspace:modules/react-native-mlkit-face-detection": version: 0.0.0-use.local resolution: "@infinitered/react-native-mlkit-face-detection@workspace:modules/react-native-mlkit-face-detection" dependencies: - "@infinitered/react-native-mlkit-core": 2.1.0 + "@infinitered/react-native-mlkit-core": 3.0.0 "@types/react": ~18.3.12 expo-module-scripts: ^3.4.1 expo-modules-core: ~2.2.0 @@ -4271,11 +4271,11 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/react-native-mlkit-image-labeling@workspace:^2.0.1, @infinitered/react-native-mlkit-image-labeling@workspace:modules/react-native-mlkit-image-labeling": +"@infinitered/react-native-mlkit-image-labeling@workspace:^3.0.0, @infinitered/react-native-mlkit-image-labeling@workspace:modules/react-native-mlkit-image-labeling": version: 0.0.0-use.local resolution: "@infinitered/react-native-mlkit-image-labeling@workspace:modules/react-native-mlkit-image-labeling" dependencies: - "@infinitered/react-native-mlkit-core": 2.1.0 + "@infinitered/react-native-mlkit-core": 3.0.0 "@types/react": ~18.3.12 expo-module-scripts: ^3.4.1 expo-modules-core: ~2.2.0 @@ -4286,11 +4286,11 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/react-native-mlkit-object-detection@workspace:^2.0.1, @infinitered/react-native-mlkit-object-detection@workspace:modules/react-native-mlkit-object-detection": +"@infinitered/react-native-mlkit-object-detection@workspace:^3.0.0, @infinitered/react-native-mlkit-object-detection@workspace:modules/react-native-mlkit-object-detection": version: 0.0.0-use.local resolution: "@infinitered/react-native-mlkit-object-detection@workspace:modules/react-native-mlkit-object-detection" dependencies: - "@infinitered/react-native-mlkit-core": 2.1.0 + "@infinitered/react-native-mlkit-core": 3.0.0 "@types/react": ~18.3.12 expo-module-scripts: ^3.4.1 expo-modules-core: ~2.2.0 @@ -4302,7 +4302,7 @@ __metadata: languageName: unknown linkType: soft -"@infinitered/tsconfig@0.3.0, @infinitered/tsconfig@workspace:packages/tsconfig": +"@infinitered/tsconfig@0.4.0, @infinitered/tsconfig@workspace:packages/tsconfig": version: 0.0.0-use.local resolution: "@infinitered/tsconfig@workspace:packages/tsconfig" dependencies: @@ -11412,11 +11412,11 @@ __metadata: "@babel/runtime": ^7.20.0 "@expo-google-fonts/space-grotesk": ^0.2.2 "@expo/metro-runtime": ~4.0.1 - "@infinitered/react-native-mlkit-document-scanner": "workspace:^2.0.1" - "@infinitered/react-native-mlkit-face-detection": "workspace:^2.0.1" - "@infinitered/react-native-mlkit-image-labeling": "workspace:^2.0.1" - "@infinitered/react-native-mlkit-object-detection": "workspace:^2.0.1" - "@infinitered/tsconfig": 0.3.0 + "@infinitered/react-native-mlkit-document-scanner": "workspace:^3.0.0" + "@infinitered/react-native-mlkit-face-detection": "workspace:^3.0.0" + "@infinitered/react-native-mlkit-image-labeling": "workspace:^3.0.0" + "@infinitered/react-native-mlkit-object-detection": "workspace:^3.0.0" + "@infinitered/tsconfig": 0.4.0 "@react-native-async-storage/async-storage": ^2.0.0 "@react-native-community/cli": ^15.0.0 "@react-native-community/cli-platform-android": ^15.0.0