diff --git a/.cspell-wordlist.txt b/.cspell-wordlist.txt
index e06bde775..2238f7142 100644
--- a/.cspell-wordlist.txt
+++ b/.cspell-wordlist.txt
@@ -122,3 +122,8 @@ worklet
worklets
BGRA
RGBA
+DETR
+detr
+metaprogramming
+ktlint
+lefthook
diff --git a/apps/computer-vision/app/object_detection/index.tsx b/apps/computer-vision/app/object_detection/index.tsx
index 6a43dd920..2f8fa6d58 100644
--- a/apps/computer-vision/app/object_detection/index.tsx
+++ b/apps/computer-vision/app/object_detection/index.tsx
@@ -4,7 +4,7 @@ import { getImage } from '../../utils';
import {
Detection,
useObjectDetection,
- SSDLITE_320_MOBILENET_V3_LARGE,
+ RF_DETR_NANO,
} from 'react-native-executorch';
import { View, StyleSheet, Image } from 'react-native';
import ImageWithBboxes from '../../components/ImageWithBboxes';
@@ -20,11 +20,11 @@ export default function ObjectDetectionScreen() {
height: number;
}>();
- const ssdLite = useObjectDetection({ model: SSDLITE_320_MOBILENET_V3_LARGE });
+ const rfDetr = useObjectDetection({ model: RF_DETR_NANO });
const { setGlobalGenerating } = useContext(GeneratingContext);
useEffect(() => {
- setGlobalGenerating(ssdLite.isGenerating);
- }, [ssdLite.isGenerating, setGlobalGenerating]);
+ setGlobalGenerating(rfDetr.isGenerating);
+ }, [rfDetr.isGenerating, setGlobalGenerating]);
const handleCameraPress = async (isCamera: boolean) => {
const image = await getImage(isCamera);
@@ -42,7 +42,7 @@ export default function ObjectDetectionScreen() {
const runForward = async () => {
if (imageUri) {
try {
- const output = await ssdLite.forward(imageUri);
+ const output = await rfDetr.forward(imageUri);
setResults(output);
} catch (e) {
console.error(e);
@@ -50,11 +50,11 @@ export default function ObjectDetectionScreen() {
}
};
- if (!ssdLite.isReady) {
+ if (!rfDetr.isReady) {
return (
);
}
diff --git a/docs/docs/03-hooks/02-computer-vision/useObjectDetection.md b/docs/docs/03-hooks/02-computer-vision/useObjectDetection.md
index 4dc96eafb..69ac3c79a 100644
--- a/docs/docs/03-hooks/02-computer-vision/useObjectDetection.md
+++ b/docs/docs/03-hooks/02-computer-vision/useObjectDetection.md
@@ -2,8 +2,7 @@
title: useObjectDetection
---
-Object detection is a computer vision technique that identifies and locates objects within images or video. It’s commonly used in applications like image recognition, video surveillance or autonomous driving.
-`useObjectDetection` is a hook that allows you to seamlessly integrate object detection into your React Native applications.
+Object detection is a computer vision technique that identifies and locates objects within images. Unlike image classification, which assigns a single label to the whole image, object detection returns a list of detected objects — each with a bounding box, a class label, and a confidence score. React Native ExecuTorch offers a dedicated hook `useObjectDetection` for this task.
:::warning
It is recommended to use models provided by us, which are available at our [Hugging Face repository](https://huggingface.co/collections/software-mansion/object-detection-68d0ea936cd0906843cbba7d). You can also use [constants](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts) shipped with our library.
@@ -16,22 +15,23 @@ It is recommended to use models provided by us, which are available at our [Hugg
## High Level Overview
-```tsx
+```typescript
import {
useObjectDetection,
SSDLITE_320_MOBILENET_V3_LARGE,
} from 'react-native-executorch';
-function App() {
- const ssdlite = useObjectDetection({ model: SSDLITE_320_MOBILENET_V3_LARGE });
+const model = useObjectDetection({
+ model: SSDLITE_320_MOBILENET_V3_LARGE,
+});
- // ...
- for (const detection of await ssdlite.forward('https://url-to-image.jpg')) {
- console.log('Bounding box: ', detection.bbox);
- console.log('Bounding label: ', detection.label);
- console.log('Bounding score: ', detection.score);
- }
- // ...
+const imageUri = 'file:///Users/.../photo.jpg';
+
+try {
+ const detections = await model.forward(imageUri);
+ // detections is an array of Detection objects
+} catch (error) {
+ console.error(error);
}
```
@@ -39,9 +39,13 @@ function App() {
`useObjectDetection` takes [`ObjectDetectionProps`](../../06-api-reference/interfaces/ObjectDetectionProps.md) that consists of:
-- `model` containing [`modelSource`](../../06-api-reference/interfaces/ObjectDetectionProps.md#modelsource).
+- `model` - An object containing:
+ - `modelName` - The name of a built-in model. See [`ObjectDetectionModelSources`](../../06-api-reference/interfaces/ObjectDetectionProps.md) for the list of supported models.
+ - `modelSource` - The location of the model binary (a URL or a bundled resource).
- An optional flag [`preventLoad`](../../06-api-reference/interfaces/ObjectDetectionProps.md#preventload) which prevents auto-loading of the model.
+The hook is generic over the model config — TypeScript automatically infers the correct label type based on the `modelName` you provide. No explicit generic parameter is needed.
+
You need more details? Check the following resources:
- For detailed information about `useObjectDetection` arguments check this section: [`useObjectDetection` arguments](../../06-api-reference/functions/useObjectDetection.md#parameters).
@@ -50,54 +54,56 @@ You need more details? Check the following resources:
### Returns
-`useObjectDetection` returns an object called `ObjectDetectionType` containing bunch of functions to interact with object detection models. To get more details please read: [`ObjectDetectionType` API Reference](../../06-api-reference/interfaces/ObjectDetectionType.md).
+`useObjectDetection` returns an [`ObjectDetectionType`](../../06-api-reference/interfaces/ObjectDetectionType.md) object containing:
-## Running the model
-
-To run the model, you can use the [`forward`](../../06-api-reference/interfaces/ObjectDetectionType.md#forward) method. It accepts one argument, which is the image. The image can be a remote URL, a local file URI, or a base64-encoded image (whole URI or only raw base64). The function returns an array of [`Detection`](../../06-api-reference/interfaces/Detection.md) objects. Each object contains coordinates of the bounding box, the label of the detected object, and the confidence score. For more information, please refer to the reference or type definitions.
+- `isReady` - Whether the model is loaded and ready to process images.
+- `isGenerating` - Whether the model is currently processing an image.
+- `error` - An error object if the model failed to load or encountered a runtime error.
+- `downloadProgress` - A value between 0 and 1 representing the download progress of the model binary.
+- `forward` - A function to run inference on an image.
-## Detection object
+## Running the model
-The detection object is specified as follows:
+To run the model, use the [`forward`](../../06-api-reference/interfaces/ObjectDetectionType.md#forward) method. It accepts two arguments:
-```typescript
-interface Bbox {
- x1: number;
- y1: number;
- x2: number;
- y2: number;
-}
+- `imageSource` (required) - The image to process. Can be a remote URL, a local file URI, or a base64-encoded image (whole URI or only raw base64).
+- `detectionThreshold` (optional) - A number between 0 and 1 representing the minimum confidence score for a detection to be included in the results. Defaults to `0.7`.
-interface Detection {
- bbox: Bbox;
- label: keyof typeof CocoLabels;
- score: number;
-}
-```
+`forward` returns a promise resolving to an array of [`Detection`](../../06-api-reference/interfaces/Detection.md) objects, each containing:
-The `bbox` property contains information about the bounding box of detected objects. It is represented as two points: one at the bottom-left corner of the bounding box (`x1`, `y1`) and the other at the top-right corner (`x2`, `y2`).
-The `label` property contains the name of the detected object, which corresponds to one of the [`CocoLabels`](../../06-api-reference/enumerations/CocoLabel.md). The `score` represents the confidence score of the detected object.
+- `bbox` - A [`Bbox`](../../06-api-reference/interfaces/Bbox.md) object with `x1`, `y1` (top-left corner) and `x2`, `y2` (bottom-right corner) coordinates in the original image's pixel space.
+- `label` - The class name of the detected object, typed to the label map of the chosen model.
+- `score` - The confidence score of the detection, between 0 and 1.
## Example
-```tsx
-import {
- useObjectDetection,
- SSDLITE_320_MOBILENET_V3_LARGE,
-} from 'react-native-executorch';
+```typescript
+import { useObjectDetection, RF_DETR_NANO } from 'react-native-executorch';
function App() {
- const ssdlite = useObjectDetection({ model: SSDLITE_320_MOBILENET_V3_LARGE });
+ const model = useObjectDetection({
+ model: RF_DETR_NANO,
+ });
+
+ const handleDetect = async () => {
+ if (!model.isReady) return;
+
+ const imageUri = 'file:///Users/.../photo.jpg';
- const runModel = async () => {
- const detections = await ssdlite.forward('https://url-to-image.jpg');
+ try {
+ const detections = await model.forward(imageUri, 0.5);
- for (const detection of detections) {
- console.log('Bounding box: ', detection.bbox);
- console.log('Bounding label: ', detection.label);
- console.log('Bounding score: ', detection.score);
+ for (const detection of detections) {
+ console.log('Label:', detection.label);
+ console.log('Score:', detection.score);
+ console.log('Bounding box:', detection.bbox);
+ }
+ } catch (error) {
+ console.error(error);
}
};
+
+ // ...
}
```
@@ -106,3 +112,4 @@ function App() {
| Model | Number of classes | Class list |
| ----------------------------------------------------------------------------------------------------------------------------- | ----------------- | -------------------------------------------------------- |
| [SSDLite320 MobileNetV3 Large](https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large) | 91 | [COCO](../../06-api-reference/enumerations/CocoLabel.md) |
+| [RF-DETR Nano](https://huggingface.co/software-mansion/react-native-executorch-rf-detr-nano) | 80 | [COCO](../../06-api-reference/enumerations/CocoLabel.md) |
diff --git a/docs/docs/06-api-reference/classes/ObjectDetectionModule.md b/docs/docs/06-api-reference/classes/ObjectDetectionModule.md
index fadb2536c..e36777857 100644
--- a/docs/docs/06-api-reference/classes/ObjectDetectionModule.md
+++ b/docs/docs/06-api-reference/classes/ObjectDetectionModule.md
@@ -1,26 +1,21 @@
-# Class: ObjectDetectionModule
+# Class: ObjectDetectionModule\
-Defined in: [modules/computer_vision/ObjectDetectionModule.ts:14](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L14)
+Defined in: [modules/computer_vision/ObjectDetectionModule.ts:59](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L59)
-Module for object detection tasks.
+Generic object detection module with type-safe label maps.
## Extends
-- `VisionModule`\<[`Detection`](../interfaces/Detection.md)[]\>
+- `VisionLabeledModule`\<[`Detection`](../interfaces/Detection.md)\<`ResolveLabels`\<`T`\>\>[], `ResolveLabels`\<`T`\>\>
-## Constructors
+## Type Parameters
-### Constructor
+### T
-> **new ObjectDetectionModule**(): `ObjectDetectionModule`
+`T` _extends_ [`ObjectDetectionModelName`](../type-aliases/ObjectDetectionModelName.md) \| [`LabelEnum`](../type-aliases/LabelEnum.md)
-#### Returns
-
-`ObjectDetectionModule`
-
-#### Inherited from
-
-`VisionModule.constructor`
+Either a built-in model name (e.g. `'ssdlite-320-mobilenet-v3-large'`)
+or a custom [LabelEnum](../type-aliases/LabelEnum.md) label map.
## Properties
@@ -92,7 +87,19 @@ Model-specific output (e.g., detections, classifications, embeddings)
#### Inherited from
-`VisionModule.generateFromFrame`
+`VisionLabeledModule.generateFromFrame`
+
+---
+
+### labelMap
+
+> `protected` `readonly` **labelMap**: `ResolveLabels`
+
+Defined in: [modules/computer_vision/VisionLabeledModule.ts:16](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/VisionLabeledModule.ts#L16)
+
+#### Inherited from
+
+`VisionLabeledModule.labelMap`
---
@@ -108,7 +115,7 @@ Native module instance (JSI Host Object)
#### Inherited from
-`VisionModule.nativeModule`
+`VisionLabeledModule.nativeModule`
## Accessors
@@ -154,7 +161,7 @@ const frameOutput = useFrameOutput({
#### Inherited from
-`VisionModule.runOnFrame`
+`VisionLabeledModule.runOnFrame`
## Methods
@@ -174,70 +181,41 @@ Always call this method when you're done with a model to prevent memory leaks.
#### Inherited from
-`VisionModule.delete`
+`VisionLabeledModule.delete`
---
### forward()
-> **forward**(`input`, `detectionThreshold?`): `Promise`\<[`Detection`](../interfaces/Detection.md)[]\>
+> **forward**(`input`, `detectionThreshold?`): `Promise`\<[`Detection`](../interfaces/Detection.md)\<`ResolveLabels`\<`T`, \{ `rf-detr-nano`: \{ `labelMap`: _typeof_ [`CocoLabel`](../enumerations/CocoLabel.md); `preprocessorConfig`: \{ `normMean`: [`Triple`](../type-aliases/Triple.md)\<`number`\>; `normStd`: [`Triple`](../type-aliases/Triple.md)\<`number`\>; \}; \}; `ssdlite-320-mobilenet-v3-large`: \{ `labelMap`: _typeof_ [`CocoLabel`](../enumerations/CocoLabel.md); `preprocessorConfig`: `undefined`; \}; \}\>\>[]\>
-Defined in: [modules/computer_vision/ObjectDetectionModule.ts:46](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L46)
+Defined in: [modules/computer_vision/ObjectDetectionModule.ts:118](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L118)
-Executes the model's forward pass with automatic input type detection.
-
-Supports two input types:
-
-1. **String path/URI**: File path, URL, or Base64-encoded string
-2. **PixelData**: Raw pixel data from image libraries (e.g., NitroImage)
-
-**Note**: For VisionCamera frame processing, use `runOnFrame` instead.
-This method is async and cannot be called in worklet context.
+Executes the model's forward pass to detect objects within the provided image.
#### Parameters
##### input
-Image source (string path or PixelData object)
+A string image source (file path, URI, or Base64) or a [PixelData](../interfaces/PixelData.md) object.
`string` | [`PixelData`](../interfaces/PixelData.md)
##### detectionThreshold?
-`number` = `0.5`
-
-#### Returns
+`number` = `0.7`
-`Promise`\<[`Detection`](../interfaces/Detection.md)[]\>
+Minimum confidence score for a detection to be included. Default is 0.7.
-A Promise that resolves to the model output.
+#### Returns
-#### Example
+`Promise`\<[`Detection`](../interfaces/Detection.md)\<`ResolveLabels`\<`T`, \{ `rf-detr-nano`: \{ `labelMap`: _typeof_ [`CocoLabel`](../enumerations/CocoLabel.md); `preprocessorConfig`: \{ `normMean`: [`Triple`](../type-aliases/Triple.md)\<`number`\>; `normStd`: [`Triple`](../type-aliases/Triple.md)\<`number`\>; \}; \}; `ssdlite-320-mobilenet-v3-large`: \{ `labelMap`: _typeof_ [`CocoLabel`](../enumerations/CocoLabel.md); `preprocessorConfig`: `undefined`; \}; \}\>\>[]\>
-```typescript
-// String path (async)
-const result1 = await model.forward('file:///path/to/image.jpg');
-
-// Pixel data (async)
-const result2 = await model.forward({
- dataPtr: new Uint8Array(pixelBuffer),
- sizes: [480, 640, 3],
- scalarType: ScalarType.BYTE,
-});
-
-// For VisionCamera frames, use runOnFrame in worklet:
-const frameOutput = useFrameOutput({
- onFrame(frame) {
- 'worklet';
- if (!model.runOnFrame) return;
- const result = model.runOnFrame(frame);
- },
-});
-```
+A Promise resolving to an array of [Detection](../interfaces/Detection.md) objects.
#### Overrides
-`VisionModule.forward`
+`VisionLabeledModule.forward`
---
@@ -268,7 +246,7 @@ Array of output tensors.
#### Inherited from
-`VisionModule.forwardET`
+`VisionLabeledModule.forwardET`
---
@@ -302,39 +280,90 @@ The input shape as an array of numbers.
#### Inherited from
-`VisionModule.getInputShape`
+`VisionLabeledModule.getInputShape`
---
### load()
-> **load**(`model`, `onDownloadProgressCallback?`): `Promise`\<`void`\>
+> **load**(): `Promise`\<`void`\>
-Defined in: [modules/computer_vision/ObjectDetectionModule.ts:22](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L22)
+Defined in: [modules/computer_vision/VisionLabeledModule.ts:25](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/VisionLabeledModule.ts#L25)
-Loads the model, where `modelSource` is a string that specifies the location of the model binary.
-To track the download progress, supply a callback function `onDownloadProgressCallback`.
+Load the model and prepare it for inference.
-#### Parameters
+#### Returns
+
+`Promise`\<`void`\>
+
+#### Inherited from
-##### model
+`VisionLabeledModule.load`
-Object containing `modelSource`.
+---
+
+### fromCustomConfig()
+
+> `static` **fromCustomConfig**\<`L`\>(`modelSource`, `config`, `onDownloadProgress?`): `Promise`\<`ObjectDetectionModule`\<`L`\>\>
+
+Defined in: [modules/computer_vision/ObjectDetectionModule.ts:125](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L125)
+
+#### Type Parameters
+
+##### L
+
+`L` _extends_ `Readonly`\<`Record`\<`string`, `string` \| `number`\>\>
+
+#### Parameters
-###### modelSource
+##### modelSource
[`ResourceSource`](../type-aliases/ResourceSource.md)
-##### onDownloadProgressCallback?
+##### config
-(`progress`) => `void`
+[`ObjectDetectionConfig`](../type-aliases/ObjectDetectionConfig.md)\<`L`\>
+
+##### onDownloadProgress?
-Optional callback to monitor download progress.
+(`progress`) => `void`
#### Returns
-`Promise`\<`void`\>
+`Promise`\<`ObjectDetectionModule`\<`L`\>\>
-#### Overrides
+---
+
+### fromModelName()
+
+> `static` **fromModelName**\<`C`\>(`config`, `onDownloadProgress?`): `Promise`\<`ObjectDetectionModule`\<`ModelNameOf`\<`C`\>\>\>
+
+Defined in: [modules/computer_vision/ObjectDetectionModule.ts:73](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L73)
+
+Creates an object detection instance for a built-in model.
+
+#### Type Parameters
+
+##### C
+
+`C` _extends_ [`ObjectDetectionModelSources`](../type-aliases/ObjectDetectionModelSources.md)
+
+#### Parameters
+
+##### config
+
+`C`
+
+A [ObjectDetectionModelSources](../type-aliases/ObjectDetectionModelSources.md) object specifying which model to load and where to fetch it from.
+
+##### onDownloadProgress?
+
+(`progress`) => `void`
+
+Optional callback to monitor download progress, receiving a value between 0 and 1.
+
+#### Returns
+
+`Promise`\<`ObjectDetectionModule`\<`ModelNameOf`\<`C`\>\>\>
-`VisionModule.load`
+A Promise resolving to an `ObjectDetectionModule` instance typed to the chosen model's label map.
diff --git a/docs/docs/06-api-reference/classes/SemanticSegmentationModule.md b/docs/docs/06-api-reference/classes/SemanticSegmentationModule.md
index b6f23cd74..97f33ea24 100644
--- a/docs/docs/06-api-reference/classes/SemanticSegmentationModule.md
+++ b/docs/docs/06-api-reference/classes/SemanticSegmentationModule.md
@@ -1,6 +1,6 @@
# Class: SemanticSegmentationModule\
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:81](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L81)
+Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:80](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L80)
Generic semantic segmentation module with type-safe label maps.
Use a model name (e.g. `'deeplab-v3-resnet50'`) as the generic parameter for built-in models,
@@ -8,7 +8,7 @@ or a custom label enum for custom configs.
## Extends
-- `BaseModule`
+- `BaseLabeledModule`\<`ResolveLabels`\<`T`\>\>
## Type Parameters
@@ -94,7 +94,19 @@ Model-specific output (e.g., detections, classifications, embeddings)
#### Inherited from
-`BaseModule.generateFromFrame`
+`BaseLabeledModule.generateFromFrame`
+
+---
+
+### labelMap
+
+> `protected` `readonly` **labelMap**: `ResolveLabels`
+
+Defined in: [modules/BaseLabeledModule.ts:52](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/BaseLabeledModule.ts#L52)
+
+#### Inherited from
+
+`BaseLabeledModule.labelMap`
---
@@ -110,7 +122,7 @@ Native module instance (JSI Host Object)
#### Inherited from
-`BaseModule.nativeModule`
+`BaseLabeledModule.nativeModule`
## Methods
@@ -130,7 +142,7 @@ Always call this method when you're done with a model to prevent memory leaks.
#### Inherited from
-`BaseModule.delete`
+`BaseLabeledModule.delete`
---
@@ -138,7 +150,7 @@ Always call this method when you're done with a model to prevent memory leaks.
> **forward**\<`K`\>(`imageSource`, `classesOfInterest?`, `resizeToInput?`): `Promise`\<`Record`\<`"ARGMAX"`, `Int32Array`\<`ArrayBufferLike`\>\> & `Record`\<`K`, `Float32Array`\<`ArrayBufferLike`\>\>\>
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:197](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L197)
+Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:179](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L179)
Executes the model's forward pass to perform semantic segmentation on the provided image.
@@ -207,7 +219,7 @@ Array of output tensors.
#### Inherited from
-`BaseModule.forwardET`
+`BaseLabeledModule.forwardET`
---
@@ -241,7 +253,7 @@ The input shape as an array of numbers.
#### Inherited from
-`BaseModule.getInputShape`
+`BaseLabeledModule.getInputShape`
---
@@ -249,7 +261,7 @@ The input shape as an array of numbers.
> **load**(): `Promise`\<`void`\>
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:97](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L97)
+Defined in: [modules/BaseLabeledModule.ts:61](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/BaseLabeledModule.ts#L61)
Load the model and prepare it for inference.
@@ -257,9 +269,9 @@ Load the model and prepare it for inference.
`Promise`\<`void`\>
-#### Overrides
+#### Inherited from
-`BaseModule.load`
+`BaseLabeledModule.load`
---
@@ -267,7 +279,7 @@ Load the model and prepare it for inference.
> `static` **fromCustomConfig**\<`L`\>(`modelSource`, `config`, `onDownloadProgress?`): `Promise`\<`SemanticSegmentationModule`\<`L`\>\>
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:163](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L163)
+Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:147](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L147)
Creates a segmentation instance with a user-provided label map and custom config.
Use this when working with a custom-exported segmentation model that is not one of the built-in models.
@@ -320,7 +332,7 @@ const segmentation = await SemanticSegmentationModule.fromCustomConfig(
> `static` **fromModelName**\<`C`\>(`config`, `onDownloadProgress?`): `Promise`\<`SemanticSegmentationModule`\<[`ModelNameOf`](../type-aliases/ModelNameOf.md)\<`C`\>\>\>
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:116](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L116)
+Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:104](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L104)
Creates a segmentation instance for a built-in model.
The config object is discriminated by `modelName` — each model can require different fields.
diff --git a/docs/docs/06-api-reference/enumerations/CocoLabel.md b/docs/docs/06-api-reference/enumerations/CocoLabel.md
index b94e3e9c6..8a15fbe25 100644
--- a/docs/docs/06-api-reference/enumerations/CocoLabel.md
+++ b/docs/docs/06-api-reference/enumerations/CocoLabel.md
@@ -1,6 +1,6 @@
# Enumeration: CocoLabel
-Defined in: [types/objectDetection.ts:39](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L39)
+Defined in: [constants/commonVision.ts:11](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L11)
COCO dataset class labels used for object detection.
@@ -10,7 +10,7 @@ COCO dataset class labels used for object detection.
> **AIRPLANE**: `5`
-Defined in: [types/objectDetection.ts:44](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L44)
+Defined in: [constants/commonVision.ts:16](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L16)
---
@@ -18,7 +18,7 @@ Defined in: [types/objectDetection.ts:44](https://github.com/software-mansion/re
> **APPLE**: `53`
-Defined in: [types/objectDetection.ts:91](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L91)
+Defined in: [constants/commonVision.ts:63](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L63)
---
@@ -26,7 +26,7 @@ Defined in: [types/objectDetection.ts:91](https://github.com/software-mansion/re
> **BACKPACK**: `27`
-Defined in: [types/objectDetection.ts:66](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L66)
+Defined in: [constants/commonVision.ts:38](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L38)
---
@@ -34,7 +34,7 @@ Defined in: [types/objectDetection.ts:66](https://github.com/software-mansion/re
> **BANANA**: `52`
-Defined in: [types/objectDetection.ts:90](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L90)
+Defined in: [constants/commonVision.ts:62](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L62)
---
@@ -42,7 +42,7 @@ Defined in: [types/objectDetection.ts:90](https://github.com/software-mansion/re
> **BASEBALL**: `39`
-Defined in: [types/objectDetection.ts:78](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L78)
+Defined in: [constants/commonVision.ts:50](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L50)
---
@@ -50,7 +50,7 @@ Defined in: [types/objectDetection.ts:78](https://github.com/software-mansion/re
> **BEAR**: `23`
-Defined in: [types/objectDetection.ts:62](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L62)
+Defined in: [constants/commonVision.ts:34](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L34)
---
@@ -58,7 +58,7 @@ Defined in: [types/objectDetection.ts:62](https://github.com/software-mansion/re
> **BED**: `65`
-Defined in: [types/objectDetection.ts:103](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L103)
+Defined in: [constants/commonVision.ts:75](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L75)
---
@@ -66,7 +66,7 @@ Defined in: [types/objectDetection.ts:103](https://github.com/software-mansion/r
> **BENCH**: `15`
-Defined in: [types/objectDetection.ts:54](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L54)
+Defined in: [constants/commonVision.ts:26](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L26)
---
@@ -74,7 +74,7 @@ Defined in: [types/objectDetection.ts:54](https://github.com/software-mansion/re
> **BICYCLE**: `2`
-Defined in: [types/objectDetection.ts:41](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L41)
+Defined in: [constants/commonVision.ts:13](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L13)
---
@@ -82,7 +82,7 @@ Defined in: [types/objectDetection.ts:41](https://github.com/software-mansion/re
> **BIRD**: `16`
-Defined in: [types/objectDetection.ts:55](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L55)
+Defined in: [constants/commonVision.ts:27](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L27)
---
@@ -90,7 +90,7 @@ Defined in: [types/objectDetection.ts:55](https://github.com/software-mansion/re
> **BLENDER**: `83`
-Defined in: [types/objectDetection.ts:121](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L121)
+Defined in: [constants/commonVision.ts:93](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L93)
---
@@ -98,7 +98,7 @@ Defined in: [types/objectDetection.ts:121](https://github.com/software-mansion/r
> **BOAT**: `9`
-Defined in: [types/objectDetection.ts:48](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L48)
+Defined in: [constants/commonVision.ts:20](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L20)
---
@@ -106,7 +106,7 @@ Defined in: [types/objectDetection.ts:48](https://github.com/software-mansion/re
> **BOOK**: `84`
-Defined in: [types/objectDetection.ts:122](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L122)
+Defined in: [constants/commonVision.ts:94](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L94)
---
@@ -114,7 +114,7 @@ Defined in: [types/objectDetection.ts:122](https://github.com/software-mansion/r
> **BOTTLE**: `44`
-Defined in: [types/objectDetection.ts:82](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L82)
+Defined in: [constants/commonVision.ts:54](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L54)
---
@@ -122,7 +122,7 @@ Defined in: [types/objectDetection.ts:82](https://github.com/software-mansion/re
> **BOWL**: `51`
-Defined in: [types/objectDetection.ts:89](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L89)
+Defined in: [constants/commonVision.ts:61](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L61)
---
@@ -130,7 +130,7 @@ Defined in: [types/objectDetection.ts:89](https://github.com/software-mansion/re
> **BROCCOLI**: `56`
-Defined in: [types/objectDetection.ts:94](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L94)
+Defined in: [constants/commonVision.ts:66](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L66)
---
@@ -138,7 +138,7 @@ Defined in: [types/objectDetection.ts:94](https://github.com/software-mansion/re
> **BUS**: `6`
-Defined in: [types/objectDetection.ts:45](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L45)
+Defined in: [constants/commonVision.ts:17](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L17)
---
@@ -146,7 +146,7 @@ Defined in: [types/objectDetection.ts:45](https://github.com/software-mansion/re
> **CAKE**: `61`
-Defined in: [types/objectDetection.ts:99](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L99)
+Defined in: [constants/commonVision.ts:71](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L71)
---
@@ -154,7 +154,7 @@ Defined in: [types/objectDetection.ts:99](https://github.com/software-mansion/re
> **CAR**: `3`
-Defined in: [types/objectDetection.ts:42](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L42)
+Defined in: [constants/commonVision.ts:14](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L14)
---
@@ -162,7 +162,7 @@ Defined in: [types/objectDetection.ts:42](https://github.com/software-mansion/re
> **CARROT**: `57`
-Defined in: [types/objectDetection.ts:95](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L95)
+Defined in: [constants/commonVision.ts:67](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L67)
---
@@ -170,7 +170,7 @@ Defined in: [types/objectDetection.ts:95](https://github.com/software-mansion/re
> **CAT**: `17`
-Defined in: [types/objectDetection.ts:56](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L56)
+Defined in: [constants/commonVision.ts:28](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L28)
---
@@ -178,7 +178,7 @@ Defined in: [types/objectDetection.ts:56](https://github.com/software-mansion/re
> **CELL_PHONE**: `77`
-Defined in: [types/objectDetection.ts:115](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L115)
+Defined in: [constants/commonVision.ts:87](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L87)
---
@@ -186,7 +186,7 @@ Defined in: [types/objectDetection.ts:115](https://github.com/software-mansion/r
> **CHAIR**: `62`
-Defined in: [types/objectDetection.ts:100](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L100)
+Defined in: [constants/commonVision.ts:72](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L72)
---
@@ -194,7 +194,7 @@ Defined in: [types/objectDetection.ts:100](https://github.com/software-mansion/r
> **CLOCK**: `85`
-Defined in: [types/objectDetection.ts:123](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L123)
+Defined in: [constants/commonVision.ts:95](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L95)
---
@@ -202,7 +202,7 @@ Defined in: [types/objectDetection.ts:123](https://github.com/software-mansion/r
> **COUCH**: `63`
-Defined in: [types/objectDetection.ts:101](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L101)
+Defined in: [constants/commonVision.ts:73](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L73)
---
@@ -210,7 +210,7 @@ Defined in: [types/objectDetection.ts:101](https://github.com/software-mansion/r
> **COW**: `21`
-Defined in: [types/objectDetection.ts:60](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L60)
+Defined in: [constants/commonVision.ts:32](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L32)
---
@@ -218,7 +218,7 @@ Defined in: [types/objectDetection.ts:60](https://github.com/software-mansion/re
> **CUP**: `47`
-Defined in: [types/objectDetection.ts:85](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L85)
+Defined in: [constants/commonVision.ts:57](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L57)
---
@@ -226,7 +226,7 @@ Defined in: [types/objectDetection.ts:85](https://github.com/software-mansion/re
> **DESK**: `69`
-Defined in: [types/objectDetection.ts:107](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L107)
+Defined in: [constants/commonVision.ts:79](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L79)
---
@@ -234,7 +234,7 @@ Defined in: [types/objectDetection.ts:107](https://github.com/software-mansion/r
> **DINING_TABLE**: `67`
-Defined in: [types/objectDetection.ts:105](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L105)
+Defined in: [constants/commonVision.ts:77](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L77)
---
@@ -242,7 +242,7 @@ Defined in: [types/objectDetection.ts:105](https://github.com/software-mansion/r
> **DOG**: `18`
-Defined in: [types/objectDetection.ts:57](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L57)
+Defined in: [constants/commonVision.ts:29](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L29)
---
@@ -250,7 +250,7 @@ Defined in: [types/objectDetection.ts:57](https://github.com/software-mansion/re
> **DONUT**: `60`
-Defined in: [types/objectDetection.ts:98](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L98)
+Defined in: [constants/commonVision.ts:70](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L70)
---
@@ -258,7 +258,7 @@ Defined in: [types/objectDetection.ts:98](https://github.com/software-mansion/re
> **DOOR**: `71`
-Defined in: [types/objectDetection.ts:109](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L109)
+Defined in: [constants/commonVision.ts:81](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L81)
---
@@ -266,7 +266,7 @@ Defined in: [types/objectDetection.ts:109](https://github.com/software-mansion/r
> **ELEPHANT**: `22`
-Defined in: [types/objectDetection.ts:61](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L61)
+Defined in: [constants/commonVision.ts:33](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L33)
---
@@ -274,7 +274,7 @@ Defined in: [types/objectDetection.ts:61](https://github.com/software-mansion/re
> **EYE**: `30`
-Defined in: [types/objectDetection.ts:69](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L69)
+Defined in: [constants/commonVision.ts:41](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L41)
---
@@ -282,7 +282,7 @@ Defined in: [types/objectDetection.ts:69](https://github.com/software-mansion/re
> **FIRE_HYDRANT**: `11`
-Defined in: [types/objectDetection.ts:50](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L50)
+Defined in: [constants/commonVision.ts:22](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L22)
---
@@ -290,7 +290,7 @@ Defined in: [types/objectDetection.ts:50](https://github.com/software-mansion/re
> **FORK**: `48`
-Defined in: [types/objectDetection.ts:86](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L86)
+Defined in: [constants/commonVision.ts:58](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L58)
---
@@ -298,7 +298,7 @@ Defined in: [types/objectDetection.ts:86](https://github.com/software-mansion/re
> **FRISBEE**: `34`
-Defined in: [types/objectDetection.ts:73](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L73)
+Defined in: [constants/commonVision.ts:45](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L45)
---
@@ -306,7 +306,7 @@ Defined in: [types/objectDetection.ts:73](https://github.com/software-mansion/re
> **GIRAFFE**: `25`
-Defined in: [types/objectDetection.ts:64](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L64)
+Defined in: [constants/commonVision.ts:36](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L36)
---
@@ -314,7 +314,7 @@ Defined in: [types/objectDetection.ts:64](https://github.com/software-mansion/re
> **HAIR_BRUSH**: `91`
-Defined in: [types/objectDetection.ts:129](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L129)
+Defined in: [constants/commonVision.ts:101](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L101)
---
@@ -322,7 +322,7 @@ Defined in: [types/objectDetection.ts:129](https://github.com/software-mansion/r
> **HAIR_DRIER**: `89`
-Defined in: [types/objectDetection.ts:127](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L127)
+Defined in: [constants/commonVision.ts:99](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L99)
---
@@ -330,7 +330,7 @@ Defined in: [types/objectDetection.ts:127](https://github.com/software-mansion/r
> **HANDBAG**: `31`
-Defined in: [types/objectDetection.ts:70](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L70)
+Defined in: [constants/commonVision.ts:42](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L42)
---
@@ -338,7 +338,7 @@ Defined in: [types/objectDetection.ts:70](https://github.com/software-mansion/re
> **HAT**: `26`
-Defined in: [types/objectDetection.ts:65](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L65)
+Defined in: [constants/commonVision.ts:37](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L37)
---
@@ -346,7 +346,7 @@ Defined in: [types/objectDetection.ts:65](https://github.com/software-mansion/re
> **HORSE**: `19`
-Defined in: [types/objectDetection.ts:58](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L58)
+Defined in: [constants/commonVision.ts:30](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L30)
---
@@ -354,7 +354,7 @@ Defined in: [types/objectDetection.ts:58](https://github.com/software-mansion/re
> **HOT_DOG**: `58`
-Defined in: [types/objectDetection.ts:96](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L96)
+Defined in: [constants/commonVision.ts:68](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L68)
---
@@ -362,7 +362,7 @@ Defined in: [types/objectDetection.ts:96](https://github.com/software-mansion/re
> **KEYBOARD**: `76`
-Defined in: [types/objectDetection.ts:114](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L114)
+Defined in: [constants/commonVision.ts:86](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L86)
---
@@ -370,7 +370,7 @@ Defined in: [types/objectDetection.ts:114](https://github.com/software-mansion/r
> **KITE**: `38`
-Defined in: [types/objectDetection.ts:77](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L77)
+Defined in: [constants/commonVision.ts:49](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L49)
---
@@ -378,7 +378,7 @@ Defined in: [types/objectDetection.ts:77](https://github.com/software-mansion/re
> **KNIFE**: `49`
-Defined in: [types/objectDetection.ts:87](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L87)
+Defined in: [constants/commonVision.ts:59](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L59)
---
@@ -386,7 +386,7 @@ Defined in: [types/objectDetection.ts:87](https://github.com/software-mansion/re
> **LAPTOP**: `73`
-Defined in: [types/objectDetection.ts:111](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L111)
+Defined in: [constants/commonVision.ts:83](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L83)
---
@@ -394,7 +394,7 @@ Defined in: [types/objectDetection.ts:111](https://github.com/software-mansion/r
> **MICROWAVE**: `78`
-Defined in: [types/objectDetection.ts:116](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L116)
+Defined in: [constants/commonVision.ts:88](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L88)
---
@@ -402,7 +402,7 @@ Defined in: [types/objectDetection.ts:116](https://github.com/software-mansion/r
> **MIRROR**: `66`
-Defined in: [types/objectDetection.ts:104](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L104)
+Defined in: [constants/commonVision.ts:76](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L76)
---
@@ -410,7 +410,7 @@ Defined in: [types/objectDetection.ts:104](https://github.com/software-mansion/r
> **MOTORCYCLE**: `4`
-Defined in: [types/objectDetection.ts:43](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L43)
+Defined in: [constants/commonVision.ts:15](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L15)
---
@@ -418,7 +418,7 @@ Defined in: [types/objectDetection.ts:43](https://github.com/software-mansion/re
> **MOUSE**: `74`
-Defined in: [types/objectDetection.ts:112](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L112)
+Defined in: [constants/commonVision.ts:84](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L84)
---
@@ -426,7 +426,7 @@ Defined in: [types/objectDetection.ts:112](https://github.com/software-mansion/r
> **ORANGE**: `55`
-Defined in: [types/objectDetection.ts:93](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L93)
+Defined in: [constants/commonVision.ts:65](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L65)
---
@@ -434,7 +434,7 @@ Defined in: [types/objectDetection.ts:93](https://github.com/software-mansion/re
> **OVEN**: `79`
-Defined in: [types/objectDetection.ts:117](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L117)
+Defined in: [constants/commonVision.ts:89](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L89)
---
@@ -442,7 +442,7 @@ Defined in: [types/objectDetection.ts:117](https://github.com/software-mansion/r
> **PARKING**: `14`
-Defined in: [types/objectDetection.ts:53](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L53)
+Defined in: [constants/commonVision.ts:25](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L25)
---
@@ -450,7 +450,7 @@ Defined in: [types/objectDetection.ts:53](https://github.com/software-mansion/re
> **PERSON**: `1`
-Defined in: [types/objectDetection.ts:40](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L40)
+Defined in: [constants/commonVision.ts:12](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L12)
---
@@ -458,7 +458,7 @@ Defined in: [types/objectDetection.ts:40](https://github.com/software-mansion/re
> **PIZZA**: `59`
-Defined in: [types/objectDetection.ts:97](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L97)
+Defined in: [constants/commonVision.ts:69](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L69)
---
@@ -466,7 +466,7 @@ Defined in: [types/objectDetection.ts:97](https://github.com/software-mansion/re
> **PLATE**: `45`
-Defined in: [types/objectDetection.ts:83](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L83)
+Defined in: [constants/commonVision.ts:55](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L55)
---
@@ -474,7 +474,7 @@ Defined in: [types/objectDetection.ts:83](https://github.com/software-mansion/re
> **POTTED_PLANT**: `64`
-Defined in: [types/objectDetection.ts:102](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L102)
+Defined in: [constants/commonVision.ts:74](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L74)
---
@@ -482,7 +482,7 @@ Defined in: [types/objectDetection.ts:102](https://github.com/software-mansion/r
> **REFRIGERATOR**: `82`
-Defined in: [types/objectDetection.ts:120](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L120)
+Defined in: [constants/commonVision.ts:92](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L92)
---
@@ -490,7 +490,7 @@ Defined in: [types/objectDetection.ts:120](https://github.com/software-mansion/r
> **REMOTE**: `75`
-Defined in: [types/objectDetection.ts:113](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L113)
+Defined in: [constants/commonVision.ts:85](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L85)
---
@@ -498,7 +498,7 @@ Defined in: [types/objectDetection.ts:113](https://github.com/software-mansion/r
> **SANDWICH**: `54`
-Defined in: [types/objectDetection.ts:92](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L92)
+Defined in: [constants/commonVision.ts:64](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L64)
---
@@ -506,7 +506,7 @@ Defined in: [types/objectDetection.ts:92](https://github.com/software-mansion/re
> **SCISSORS**: `87`
-Defined in: [types/objectDetection.ts:125](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L125)
+Defined in: [constants/commonVision.ts:97](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L97)
---
@@ -514,7 +514,7 @@ Defined in: [types/objectDetection.ts:125](https://github.com/software-mansion/r
> **SHEEP**: `20`
-Defined in: [types/objectDetection.ts:59](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L59)
+Defined in: [constants/commonVision.ts:31](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L31)
---
@@ -522,7 +522,7 @@ Defined in: [types/objectDetection.ts:59](https://github.com/software-mansion/re
> **SHOE**: `29`
-Defined in: [types/objectDetection.ts:68](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L68)
+Defined in: [constants/commonVision.ts:40](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L40)
---
@@ -530,7 +530,7 @@ Defined in: [types/objectDetection.ts:68](https://github.com/software-mansion/re
> **SINK**: `81`
-Defined in: [types/objectDetection.ts:119](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L119)
+Defined in: [constants/commonVision.ts:91](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L91)
---
@@ -538,7 +538,7 @@ Defined in: [types/objectDetection.ts:119](https://github.com/software-mansion/r
> **SKATEBOARD**: `41`
-Defined in: [types/objectDetection.ts:79](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L79)
+Defined in: [constants/commonVision.ts:51](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L51)
---
@@ -546,7 +546,7 @@ Defined in: [types/objectDetection.ts:79](https://github.com/software-mansion/re
> **SKIS**: `35`
-Defined in: [types/objectDetection.ts:74](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L74)
+Defined in: [constants/commonVision.ts:46](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L46)
---
@@ -554,7 +554,7 @@ Defined in: [types/objectDetection.ts:74](https://github.com/software-mansion/re
> **SNOWBOARD**: `36`
-Defined in: [types/objectDetection.ts:75](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L75)
+Defined in: [constants/commonVision.ts:47](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L47)
---
@@ -562,7 +562,7 @@ Defined in: [types/objectDetection.ts:75](https://github.com/software-mansion/re
> **SPOON**: `50`
-Defined in: [types/objectDetection.ts:88](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L88)
+Defined in: [constants/commonVision.ts:60](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L60)
---
@@ -570,7 +570,7 @@ Defined in: [types/objectDetection.ts:88](https://github.com/software-mansion/re
> **SPORTS**: `37`
-Defined in: [types/objectDetection.ts:76](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L76)
+Defined in: [constants/commonVision.ts:48](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L48)
---
@@ -578,7 +578,7 @@ Defined in: [types/objectDetection.ts:76](https://github.com/software-mansion/re
> **STOP_SIGN**: `13`
-Defined in: [types/objectDetection.ts:52](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L52)
+Defined in: [constants/commonVision.ts:24](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L24)
---
@@ -586,7 +586,7 @@ Defined in: [types/objectDetection.ts:52](https://github.com/software-mansion/re
> **STREET_SIGN**: `12`
-Defined in: [types/objectDetection.ts:51](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L51)
+Defined in: [constants/commonVision.ts:23](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L23)
---
@@ -594,7 +594,7 @@ Defined in: [types/objectDetection.ts:51](https://github.com/software-mansion/re
> **SUITCASE**: `33`
-Defined in: [types/objectDetection.ts:72](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L72)
+Defined in: [constants/commonVision.ts:44](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L44)
---
@@ -602,7 +602,7 @@ Defined in: [types/objectDetection.ts:72](https://github.com/software-mansion/re
> **SURFBOARD**: `42`
-Defined in: [types/objectDetection.ts:80](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L80)
+Defined in: [constants/commonVision.ts:52](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L52)
---
@@ -610,7 +610,7 @@ Defined in: [types/objectDetection.ts:80](https://github.com/software-mansion/re
> **TEDDY_BEAR**: `88`
-Defined in: [types/objectDetection.ts:126](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L126)
+Defined in: [constants/commonVision.ts:98](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L98)
---
@@ -618,7 +618,7 @@ Defined in: [types/objectDetection.ts:126](https://github.com/software-mansion/r
> **TENNIS_RACKET**: `43`
-Defined in: [types/objectDetection.ts:81](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L81)
+Defined in: [constants/commonVision.ts:53](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L53)
---
@@ -626,7 +626,7 @@ Defined in: [types/objectDetection.ts:81](https://github.com/software-mansion/re
> **TIE**: `32`
-Defined in: [types/objectDetection.ts:71](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L71)
+Defined in: [constants/commonVision.ts:43](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L43)
---
@@ -634,7 +634,7 @@ Defined in: [types/objectDetection.ts:71](https://github.com/software-mansion/re
> **TOASTER**: `80`
-Defined in: [types/objectDetection.ts:118](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L118)
+Defined in: [constants/commonVision.ts:90](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L90)
---
@@ -642,7 +642,7 @@ Defined in: [types/objectDetection.ts:118](https://github.com/software-mansion/r
> **TOILET**: `70`
-Defined in: [types/objectDetection.ts:108](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L108)
+Defined in: [constants/commonVision.ts:80](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L80)
---
@@ -650,7 +650,7 @@ Defined in: [types/objectDetection.ts:108](https://github.com/software-mansion/r
> **TOOTHBRUSH**: `90`
-Defined in: [types/objectDetection.ts:128](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L128)
+Defined in: [constants/commonVision.ts:100](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L100)
---
@@ -658,7 +658,7 @@ Defined in: [types/objectDetection.ts:128](https://github.com/software-mansion/r
> **TRAFFIC_LIGHT**: `10`
-Defined in: [types/objectDetection.ts:49](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L49)
+Defined in: [constants/commonVision.ts:21](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L21)
---
@@ -666,7 +666,7 @@ Defined in: [types/objectDetection.ts:49](https://github.com/software-mansion/re
> **TRAIN**: `7`
-Defined in: [types/objectDetection.ts:46](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L46)
+Defined in: [constants/commonVision.ts:18](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L18)
---
@@ -674,7 +674,7 @@ Defined in: [types/objectDetection.ts:46](https://github.com/software-mansion/re
> **TRUCK**: `8`
-Defined in: [types/objectDetection.ts:47](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L47)
+Defined in: [constants/commonVision.ts:19](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L19)
---
@@ -682,7 +682,7 @@ Defined in: [types/objectDetection.ts:47](https://github.com/software-mansion/re
> **TV**: `72`
-Defined in: [types/objectDetection.ts:110](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L110)
+Defined in: [constants/commonVision.ts:82](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L82)
---
@@ -690,7 +690,7 @@ Defined in: [types/objectDetection.ts:110](https://github.com/software-mansion/r
> **UMBRELLA**: `28`
-Defined in: [types/objectDetection.ts:67](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L67)
+Defined in: [constants/commonVision.ts:39](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L39)
---
@@ -698,7 +698,7 @@ Defined in: [types/objectDetection.ts:67](https://github.com/software-mansion/re
> **VASE**: `86`
-Defined in: [types/objectDetection.ts:124](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L124)
+Defined in: [constants/commonVision.ts:96](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L96)
---
@@ -706,7 +706,7 @@ Defined in: [types/objectDetection.ts:124](https://github.com/software-mansion/r
> **WINDOW**: `68`
-Defined in: [types/objectDetection.ts:106](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L106)
+Defined in: [constants/commonVision.ts:78](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L78)
---
@@ -714,7 +714,7 @@ Defined in: [types/objectDetection.ts:106](https://github.com/software-mansion/r
> **WINE_GLASS**: `46`
-Defined in: [types/objectDetection.ts:84](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L84)
+Defined in: [constants/commonVision.ts:56](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L56)
---
@@ -722,4 +722,4 @@ Defined in: [types/objectDetection.ts:84](https://github.com/software-mansion/re
> **ZEBRA**: `24`
-Defined in: [types/objectDetection.ts:63](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L63)
+Defined in: [constants/commonVision.ts:35](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L35)
diff --git a/docs/docs/06-api-reference/functions/useObjectDetection.md b/docs/docs/06-api-reference/functions/useObjectDetection.md
index 8cc0ba419..7ed581760 100644
--- a/docs/docs/06-api-reference/functions/useObjectDetection.md
+++ b/docs/docs/06-api-reference/functions/useObjectDetection.md
@@ -1,21 +1,29 @@
# Function: useObjectDetection()
-> **useObjectDetection**(`ObjectDetectionProps`): [`ObjectDetectionType`](../interfaces/ObjectDetectionType.md)
+> **useObjectDetection**\<`C`\>(`props`): [`ObjectDetectionType`](../interfaces/ObjectDetectionType.md)\<[`ObjectDetectionLabels`](../type-aliases/ObjectDetectionLabels.md)\<`C`\[`"modelName"`\]\>\>
-Defined in: [hooks/computer_vision/useObjectDetection.ts:15](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts#L15)
+Defined in: [hooks/computer_vision/useObjectDetection.ts:22](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts#L22)
React hook for managing an Object Detection model instance.
+## Type Parameters
+
+### C
+
+`C` _extends_ [`ObjectDetectionModelSources`](../type-aliases/ObjectDetectionModelSources.md)
+
+A [ObjectDetectionModelSources](../type-aliases/ObjectDetectionModelSources.md) config specifying which built-in model to load.
+
## Parameters
-### ObjectDetectionProps
+### props
-[`ObjectDetectionProps`](../interfaces/ObjectDetectionProps.md)
+[`ObjectDetectionProps`](../interfaces/ObjectDetectionProps.md)\<`C`\>
-Configuration object containing `model` source and optional `preventLoad` flag.
+Configuration object containing `model` config and optional `preventLoad` flag.
## Returns
-[`ObjectDetectionType`](../interfaces/ObjectDetectionType.md)
+[`ObjectDetectionType`](../interfaces/ObjectDetectionType.md)\<[`ObjectDetectionLabels`](../type-aliases/ObjectDetectionLabels.md)\<`C`\[`"modelName"`\]\>\>
-Ready to use Object Detection model.
+An object with model state (`error`, `isReady`, `isGenerating`, `downloadProgress`) and typed `forward` and `runOnFrame` functions.
diff --git a/docs/docs/06-api-reference/functions/useSemanticSegmentation.md b/docs/docs/06-api-reference/functions/useSemanticSegmentation.md
index ebd154086..ee260c7f1 100644
--- a/docs/docs/06-api-reference/functions/useSemanticSegmentation.md
+++ b/docs/docs/06-api-reference/functions/useSemanticSegmentation.md
@@ -2,7 +2,7 @@
> **useSemanticSegmentation**\<`C`\>(`props`): [`SemanticSegmentationType`](../interfaces/SemanticSegmentationType.md)\<[`SegmentationLabels`](../type-aliases/SegmentationLabels.md)\<[`ModelNameOf`](../type-aliases/ModelNameOf.md)\<`C`\>\>\>
-Defined in: [hooks/computer_vision/useSemanticSegmentation.ts:31](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts#L31)
+Defined in: [hooks/computer_vision/useSemanticSegmentation.ts:29](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts#L29)
React hook for managing a Semantic Segmentation model instance.
diff --git a/docs/docs/06-api-reference/index.md b/docs/docs/06-api-reference/index.md
index 7bffecd63..c059a9cc8 100644
--- a/docs/docs/06-api-reference/index.md
+++ b/docs/docs/06-api-reference/index.md
@@ -74,6 +74,7 @@
## Models - Object Detection
+- [RF_DETR_NANO](variables/RF_DETR_NANO.md)
- [SSDLITE_320_MOBILENET_V3_LARGE](variables/SSDLITE_320_MOBILENET_V3_LARGE.md)
## Models - Semantic Segmentation
@@ -198,6 +199,8 @@
- [Logger](classes/Logger.md)
- [RnExecutorchError](classes/RnExecutorchError.md)
- [Frame](interfaces/Frame.md)
+- [IMAGENET1K_MEAN](variables/IMAGENET1K_MEAN.md)
+- [IMAGENET1K_STD](variables/IMAGENET1K_STD.md)
## TTS Supported Voices
@@ -277,6 +280,10 @@
- [LLMTool](type-aliases/LLMTool.md)
- [MessageRole](type-aliases/MessageRole.md)
- [ModelNameOf](type-aliases/ModelNameOf.md)
+- [ObjectDetectionConfig](type-aliases/ObjectDetectionConfig.md)
+- [ObjectDetectionLabels](type-aliases/ObjectDetectionLabels.md)
+- [ObjectDetectionModelName](type-aliases/ObjectDetectionModelName.md)
+- [ObjectDetectionModelSources](type-aliases/ObjectDetectionModelSources.md)
- [OCRLanguage](type-aliases/OCRLanguage.md)
- [ResourceSource](type-aliases/ResourceSource.md)
- [SegmentationLabels](type-aliases/SegmentationLabels.md)
diff --git a/docs/docs/06-api-reference/interfaces/Bbox.md b/docs/docs/06-api-reference/interfaces/Bbox.md
index 98fec21a8..6eadedfb1 100644
--- a/docs/docs/06-api-reference/interfaces/Bbox.md
+++ b/docs/docs/06-api-reference/interfaces/Bbox.md
@@ -1,6 +1,6 @@
# Interface: Bbox
-Defined in: [types/objectDetection.ts:13](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L13)
+Defined in: [types/objectDetection.ts:15](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L15)
Represents a bounding box for a detected object in an image.
@@ -10,7 +10,7 @@ Represents a bounding box for a detected object in an image.
> **x1**: `number`
-Defined in: [types/objectDetection.ts:14](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L14)
+Defined in: [types/objectDetection.ts:16](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L16)
The x-coordinate of the bottom-left corner of the bounding box.
@@ -20,7 +20,7 @@ The x-coordinate of the bottom-left corner of the bounding box.
> **x2**: `number`
-Defined in: [types/objectDetection.ts:15](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L15)
+Defined in: [types/objectDetection.ts:17](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L17)
The x-coordinate of the top-right corner of the bounding box.
@@ -30,7 +30,7 @@ The x-coordinate of the top-right corner of the bounding box.
> **y1**: `number`
-Defined in: [types/objectDetection.ts:16](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L16)
+Defined in: [types/objectDetection.ts:18](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L18)
The y-coordinate of the bottom-left corner of the bounding box.
@@ -40,6 +40,6 @@ The y-coordinate of the bottom-left corner of the bounding box.
> **y2**: `number`
-Defined in: [types/objectDetection.ts:17](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L17)
+Defined in: [types/objectDetection.ts:19](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L19)
The y-coordinate of the top-right corner of the bounding box.
diff --git a/docs/docs/06-api-reference/interfaces/Detection.md b/docs/docs/06-api-reference/interfaces/Detection.md
index 55bfa2a2c..44a7324aa 100644
--- a/docs/docs/06-api-reference/interfaces/Detection.md
+++ b/docs/docs/06-api-reference/interfaces/Detection.md
@@ -1,16 +1,24 @@
-# Interface: Detection
+# Interface: Detection\
-Defined in: [types/objectDetection.ts:28](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L28)
+Defined in: [types/objectDetection.ts:31](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L31)
Represents a detected object within an image, including its bounding box, label, and confidence score.
+## Type Parameters
+
+### L
+
+`L` _extends_ [`LabelEnum`](../type-aliases/LabelEnum.md) = _typeof_ [`CocoLabel`](../enumerations/CocoLabel.md)
+
+The label enum type for the detected object. Defaults to [CocoLabel](../enumerations/CocoLabel.md).
+
## Properties
### bbox
> **bbox**: [`Bbox`](Bbox.md)
-Defined in: [types/objectDetection.ts:29](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L29)
+Defined in: [types/objectDetection.ts:32](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L32)
The bounding box of the detected object, defined by its top-left (x1, y1) and bottom-right (x2, y2) coordinates.
@@ -18,11 +26,11 @@ The bounding box of the detected object, defined by its top-left (x1, y1) and bo
### label
-> **label**: `"BICYCLE"` \| `"BIRD"` \| `"BOAT"` \| `"BOTTLE"` \| `"BUS"` \| `"CAR"` \| `"CAT"` \| `"CHAIR"` \| `"COW"` \| `"DOG"` \| `"HORSE"` \| `"PERSON"` \| `"SHEEP"` \| `"TRAIN"` \| `"MOTORCYCLE"` \| `"AIRPLANE"` \| `"TRUCK"` \| `"TRAFFIC_LIGHT"` \| `"FIRE_HYDRANT"` \| `"STREET_SIGN"` \| `"STOP_SIGN"` \| `"PARKING"` \| `"BENCH"` \| `"ELEPHANT"` \| `"BEAR"` \| `"ZEBRA"` \| `"GIRAFFE"` \| `"HAT"` \| `"BACKPACK"` \| `"UMBRELLA"` \| `"SHOE"` \| `"EYE"` \| `"HANDBAG"` \| `"TIE"` \| `"SUITCASE"` \| `"FRISBEE"` \| `"SKIS"` \| `"SNOWBOARD"` \| `"SPORTS"` \| `"KITE"` \| `"BASEBALL"` \| `"SKATEBOARD"` \| `"SURFBOARD"` \| `"TENNIS_RACKET"` \| `"PLATE"` \| `"WINE_GLASS"` \| `"CUP"` \| `"FORK"` \| `"KNIFE"` \| `"SPOON"` \| `"BOWL"` \| `"BANANA"` \| `"APPLE"` \| `"SANDWICH"` \| `"ORANGE"` \| `"BROCCOLI"` \| `"CARROT"` \| `"HOT_DOG"` \| `"PIZZA"` \| `"DONUT"` \| `"CAKE"` \| `"COUCH"` \| `"POTTED_PLANT"` \| `"BED"` \| `"MIRROR"` \| `"DINING_TABLE"` \| `"WINDOW"` \| `"DESK"` \| `"TOILET"` \| `"DOOR"` \| `"TV"` \| `"LAPTOP"` \| `"MOUSE"` \| `"REMOTE"` \| `"KEYBOARD"` \| `"CELL_PHONE"` \| `"MICROWAVE"` \| `"OVEN"` \| `"TOASTER"` \| `"SINK"` \| `"REFRIGERATOR"` \| `"BLENDER"` \| `"BOOK"` \| `"CLOCK"` \| `"VASE"` \| `"SCISSORS"` \| `"TEDDY_BEAR"` \| `"HAIR_DRIER"` \| `"TOOTHBRUSH"` \| `"HAIR_BRUSH"`
+> **label**: keyof `L`
-Defined in: [types/objectDetection.ts:30](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L30)
+Defined in: [types/objectDetection.ts:33](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L33)
-The class label of the detected object, represented as a key from the `CocoLabel` enum.
+The class label of the detected object.
---
@@ -30,6 +38,6 @@ The class label of the detected object, represented as a key from the `CocoLabel
> **score**: `number`
-Defined in: [types/objectDetection.ts:31](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L31)
+Defined in: [types/objectDetection.ts:34](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L34)
The confidence score of the detection, typically ranging from 0 to 1.
diff --git a/docs/docs/06-api-reference/interfaces/ObjectDetectionProps.md b/docs/docs/06-api-reference/interfaces/ObjectDetectionProps.md
index 069c4d3e1..7199fe504 100644
--- a/docs/docs/06-api-reference/interfaces/ObjectDetectionProps.md
+++ b/docs/docs/06-api-reference/interfaces/ObjectDetectionProps.md
@@ -1,22 +1,26 @@
-# Interface: ObjectDetectionProps
+# Interface: ObjectDetectionProps\
-Defined in: [types/objectDetection.ts:140](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L140)
+Defined in: [types/objectDetection.ts:72](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L72)
Props for the `useObjectDetection` hook.
-## Properties
+## Type Parameters
-### model
+### C
+
+`C` _extends_ [`ObjectDetectionModelSources`](../type-aliases/ObjectDetectionModelSources.md)
-> **model**: `object`
+A [ObjectDetectionModelSources](../type-aliases/ObjectDetectionModelSources.md) config specifying which built-in model to load.
-Defined in: [types/objectDetection.ts:141](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L141)
+## Properties
+
+### model
-An object containing the model source.
+> **model**: `C`
-#### modelSource
+Defined in: [types/objectDetection.ts:73](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L73)
-> **modelSource**: [`ResourceSource`](../type-aliases/ResourceSource.md)
+The model config containing `modelName` and `modelSource`.
---
@@ -24,6 +28,6 @@ An object containing the model source.
> `optional` **preventLoad**: `boolean`
-Defined in: [types/objectDetection.ts:142](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L142)
+Defined in: [types/objectDetection.ts:74](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L74)
Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
diff --git a/docs/docs/06-api-reference/interfaces/ObjectDetectionType.md b/docs/docs/06-api-reference/interfaces/ObjectDetectionType.md
index 4bd5dba98..95a2bd407 100644
--- a/docs/docs/06-api-reference/interfaces/ObjectDetectionType.md
+++ b/docs/docs/06-api-reference/interfaces/ObjectDetectionType.md
@@ -1,17 +1,25 @@
-# Interface: ObjectDetectionType
+# Interface: ObjectDetectionType\
-Defined in: [types/objectDetection.ts:151](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L151)
+Defined in: [types/objectDetection.ts:85](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L85)
Return type for the `useObjectDetection` hook.
Manages the state and operations for Computer Vision object detection tasks.
+## Type Parameters
+
+### L
+
+`L` _extends_ [`LabelEnum`](../type-aliases/LabelEnum.md)
+
+The [LabelEnum](../type-aliases/LabelEnum.md) representing the model's class labels.
+
## Properties
### downloadProgress
> **downloadProgress**: `number`
-Defined in: [types/objectDetection.ts:170](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L170)
+Defined in: [types/objectDetection.ts:104](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L104)
Represents the download progress of the model binary as a value between 0 and 1.
@@ -21,7 +29,7 @@ Represents the download progress of the model binary as a value between 0 and 1.
> **error**: [`RnExecutorchError`](../classes/RnExecutorchError.md) \| `null`
-Defined in: [types/objectDetection.ts:155](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L155)
+Defined in: [types/objectDetection.ts:89](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L89)
Contains the error object if the model failed to load, download, or encountered a runtime error during detection.
@@ -29,24 +37,17 @@ Contains the error object if the model failed to load, download, or encountered
### forward()
-> **forward**: (`input`, `detectionThreshold?`) => `Promise`\<[`Detection`](Detection.md)[]\>
+> **forward**: (`input`, `detectionThreshold?`) => `Promise`\<[`Detection`](Detection.md)\<`L`\>[]\>
-Defined in: [types/objectDetection.ts:199](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L199)
+Defined in: [types/objectDetection.ts:114](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L114)
Executes the model's forward pass with automatic input type detection.
-Supports two input types:
-
-1. **String path/URI**: File path, URL, or Base64-encoded string
-2. **PixelData**: Raw pixel data from image libraries (e.g., NitroImage)
-
-**Note**: For VisionCamera frame processing, use `runOnFrame` instead.
-
#### Parameters
##### input
-Image source (string or PixelData object)
+Image source (string path/URI or PixelData object)
`string` | [`PixelData`](PixelData.md)
@@ -54,11 +55,11 @@ Image source (string or PixelData object)
`number`
-An optional number between 0 and 1 representing the minimum confidence score. Default is 0.5.
+An optional number between 0 and 1 representing the minimum confidence score. Default is 0.7.
#### Returns
-`Promise`\<[`Detection`](Detection.md)[]\>
+`Promise`\<[`Detection`](Detection.md)\<`L`\>[]\>
A Promise that resolves to an array of `Detection` objects.
@@ -66,27 +67,13 @@ A Promise that resolves to an array of `Detection` objects.
If the model is not loaded or is currently processing another image.
-#### Example
-
-```typescript
-// String path
-const detections1 = await model.forward('file:///path/to/image.jpg');
-
-// Pixel data
-const detections2 = await model.forward({
- dataPtr: new Uint8Array(rgbPixels),
- sizes: [480, 640, 3],
- scalarType: ScalarType.BYTE,
-});
-```
-
---
### isGenerating
> **isGenerating**: `boolean`
-Defined in: [types/objectDetection.ts:165](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L165)
+Defined in: [types/objectDetection.ts:99](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L99)
Indicates whether the model is currently processing an image.
@@ -96,7 +83,7 @@ Indicates whether the model is currently processing an image.
> **isReady**: `boolean`
-Defined in: [types/objectDetection.ts:160](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L160)
+Defined in: [types/objectDetection.ts:94](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L94)
Indicates whether the object detection model is loaded and ready to process images.
@@ -104,9 +91,9 @@ Indicates whether the object detection model is loaded and ready to process imag
### runOnFrame
-> **runOnFrame**: (`frame`, `detectionThreshold`) => [`Detection`](Detection.md)[] \| `null`
+> **runOnFrame**: (`frame`, `detectionThreshold`) => [`Detection`](Detection.md)\<`L`\>[] \| `null`
-Defined in: [types/objectDetection.ts:231](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L231)
+Defined in: [types/objectDetection.ts:132](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L132)
Synchronous worklet function for real-time VisionCamera frame processing.
Automatically handles native buffer extraction and cleanup.
@@ -116,21 +103,6 @@ For async processing, use `forward()` instead.
Available after model is loaded (`isReady: true`).
-#### Example
-
-```typescript
-const { runOnFrame, isReady } = useObjectDetection({ model: MODEL });
-
-const frameOutput = useFrameOutput({
- onFrame(frame) {
- 'worklet';
- if (!runOnFrame) return;
- const detections = runOnFrame(frame, 0.5);
- frame.dispose();
- },
-});
-```
-
#### Param
VisionCamera Frame object
diff --git a/docs/docs/06-api-reference/type-aliases/ObjectDetectionConfig.md b/docs/docs/06-api-reference/type-aliases/ObjectDetectionConfig.md
new file mode 100644
index 000000000..5705f34d2
--- /dev/null
+++ b/docs/docs/06-api-reference/type-aliases/ObjectDetectionConfig.md
@@ -0,0 +1,37 @@
+# Type Alias: ObjectDetectionConfig\
+
+> **ObjectDetectionConfig**\<`T`\> = `object`
+
+Defined in: [types/objectDetection.ts:59](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L59)
+
+Configuration for a custom object detection model.
+
+## Type Parameters
+
+### T
+
+`T` _extends_ [`LabelEnum`](LabelEnum.md)
+
+## Properties
+
+### labelMap
+
+> **labelMap**: `T`
+
+Defined in: [types/objectDetection.ts:60](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L60)
+
+---
+
+### preprocessorConfig?
+
+> `optional` **preprocessorConfig**: `object`
+
+Defined in: [types/objectDetection.ts:61](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L61)
+
+#### normMean?
+
+> `optional` **normMean**: [`Triple`](Triple.md)\<`number`\>
+
+#### normStd?
+
+> `optional` **normStd**: [`Triple`](Triple.md)\<`number`\>
diff --git a/docs/docs/06-api-reference/type-aliases/ObjectDetectionLabels.md b/docs/docs/06-api-reference/type-aliases/ObjectDetectionLabels.md
new file mode 100644
index 000000000..21453f6aa
--- /dev/null
+++ b/docs/docs/06-api-reference/type-aliases/ObjectDetectionLabels.md
@@ -0,0 +1,15 @@
+# Type Alias: ObjectDetectionLabels\
+
+> **ObjectDetectionLabels**\<`M`\> = `ResolveLabelsFor`\<`M`, `ModelConfigsType`\>
+
+Defined in: [modules/computer_vision/ObjectDetectionModule.ts:42](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts#L42)
+
+Resolves the [LabelEnum](LabelEnum.md) for a given built-in object detection model name.
+
+## Type Parameters
+
+### M
+
+`M` _extends_ [`ObjectDetectionModelName`](ObjectDetectionModelName.md)
+
+A built-in model name from [ObjectDetectionModelName](ObjectDetectionModelName.md).
diff --git a/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelName.md b/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelName.md
new file mode 100644
index 000000000..8bfff7d4a
--- /dev/null
+++ b/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelName.md
@@ -0,0 +1,7 @@
+# Type Alias: ObjectDetectionModelName
+
+> **ObjectDetectionModelName** = [`ObjectDetectionModelSources`](ObjectDetectionModelSources.md)\[`"modelName"`\]
+
+Defined in: [types/objectDetection.ts:52](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L52)
+
+Union of all built-in object detection model names.
diff --git a/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelSources.md b/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelSources.md
new file mode 100644
index 000000000..91be33999
--- /dev/null
+++ b/docs/docs/06-api-reference/type-aliases/ObjectDetectionModelSources.md
@@ -0,0 +1,8 @@
+# Type Alias: ObjectDetectionModelSources
+
+> **ObjectDetectionModelSources** = \{ `modelName`: `"ssdlite-320-mobilenet-v3-large"`; `modelSource`: [`ResourceSource`](ResourceSource.md); \} \| \{ `modelName`: `"rf-detr-nano"`; `modelSource`: [`ResourceSource`](ResourceSource.md); \}
+
+Defined in: [types/objectDetection.ts:43](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/types/objectDetection.ts#L43)
+
+Per-model config for [ObjectDetectionModule.fromModelName](../classes/ObjectDetectionModule.md#frommodelname).
+Each model name maps to its required fields.
diff --git a/docs/docs/06-api-reference/type-aliases/SegmentationLabels.md b/docs/docs/06-api-reference/type-aliases/SegmentationLabels.md
index eaa40fe6a..5f62875c0 100644
--- a/docs/docs/06-api-reference/type-aliases/SegmentationLabels.md
+++ b/docs/docs/06-api-reference/type-aliases/SegmentationLabels.md
@@ -2,7 +2,7 @@
> **SegmentationLabels**\<`M`\> = `ModelConfigsType`\[`M`\]\[`"labelMap"`\]
-Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:55](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L55)
+Defined in: [modules/computer_vision/SemanticSegmentationModule.ts:58](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts#L58)
Resolves the [LabelEnum](LabelEnum.md) for a given built-in model name.
diff --git a/docs/docs/06-api-reference/typedoc-sidebar.cjs b/docs/docs/06-api-reference/typedoc-sidebar.cjs
index 00abf2925..faccf365c 100644
--- a/docs/docs/06-api-reference/typedoc-sidebar.cjs
+++ b/docs/docs/06-api-reference/typedoc-sidebar.cjs
@@ -1,4 +1,4 @@
// @ts-check
/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */
-const typedocSidebar = {items:[{type:"category",label:"Hooks",items:[{type:"doc",id:"06-api-reference/functions/useClassification",label:"useClassification"},{type:"doc",id:"06-api-reference/functions/useExecutorchModule",label:"useExecutorchModule"},{type:"doc",id:"06-api-reference/functions/useImageEmbeddings",label:"useImageEmbeddings"},{type:"doc",id:"06-api-reference/functions/useLLM",label:"useLLM"},{type:"doc",id:"06-api-reference/functions/useObjectDetection",label:"useObjectDetection"},{type:"doc",id:"06-api-reference/functions/useOCR",label:"useOCR"},{type:"doc",id:"06-api-reference/functions/useSemanticSegmentation",label:"useSemanticSegmentation"},{type:"doc",id:"06-api-reference/functions/useSpeechToText",label:"useSpeechToText"},{type:"doc",id:"06-api-reference/functions/useStyleTransfer",label:"useStyleTransfer"},{type:"doc",id:"06-api-reference/functions/useTextEmbeddings",label:"useTextEmbeddings"},{type:"doc",id:"06-api-reference/functions/useTextToImage",label:"useTextToImage"},{type:"doc",id:"06-api-reference/functions/useTextToSpeech",label:"useTextToSpeech"},{type:"doc",id:"06-api-reference/functions/useTokenizer",label:"useTokenizer"},{type:"doc",id:"06-api-reference/functions/useVAD",label:"useVAD"},{type:"doc",id:"06-api-reference/functions/useVerticalOCR",label:"useVerticalOCR"}]},{type:"category",label:"Interfaces",items:[{type:"doc",id:"06-api-reference/interfaces/ResourceSourceExtended",label:"ResourceSourceExtended"}]},{type:"category",label:"Models - Classification",items:[{type:"doc",id:"06-api-reference/variables/EFFICIENTNET_V2_S",label:"EFFICIENTNET_V2_S"}]},{type:"category",label:"Models - Image Embeddings",items:[{type:"doc",id:"06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE",label:"CLIP_VIT_BASE_PATCH32_IMAGE"}]},{type:"category",label:"Models - Image Generation",items:[{type:"doc",id:"06-api-reference/variables/BK_SDM_TINY_VPRED_256",label:"BK_SDM_TINY_VPRED_256"},{type:"doc",id:"06-api-reference/variables/BK_SDM_TINY_VPRED_512",label:"BK_SDM_TINY_VPRED_512"}]},{type:"category",label:"Models - LMM",items:[{type:"doc",id:"06-api-reference/variables/HAMMER2_1_0_5B",label:"HAMMER2_1_0_5B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_0_5B_QUANTIZED",label:"HAMMER2_1_0_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_1_5B",label:"HAMMER2_1_1_5B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_1_5B_QUANTIZED",label:"HAMMER2_1_1_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_3B",label:"HAMMER2_1_3B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_3B_QUANTIZED",label:"HAMMER2_1_3B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LFM2_5_1_2B_INSTRUCT",label:"LFM2_5_1_2B_INSTRUCT"},{type:"doc",id:"06-api-reference/variables/LFM2_5_1_2B_INSTRUCT_QUANTIZED",label:"LFM2_5_1_2B_INSTRUCT_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B",label:"LLAMA3_2_1B"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B_QLORA",label:"LLAMA3_2_1B_QLORA"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B_SPINQUANT",label:"LLAMA3_2_1B_SPINQUANT"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B",label:"LLAMA3_2_3B"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B_QLORA",label:"LLAMA3_2_3B_QLORA"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B_SPINQUANT",label:"LLAMA3_2_3B_SPINQUANT"},{type:"doc",id:"06-api-reference/variables/PHI_4_MINI_4B",label:"PHI_4_MINI_4B"},{type:"doc",id:"06-api-reference/variables/PHI_4_MINI_4B_QUANTIZED",label:"PHI_4_MINI_4B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_0_5B",label:"QWEN2_5_0_5B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_0_5B_QUANTIZED",label:"QWEN2_5_0_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_1_5B",label:"QWEN2_5_1_5B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_1_5B_QUANTIZED",label:"QWEN2_5_1_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_3B",label:"QWEN2_5_3B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_3B_QUANTIZED",label:"QWEN2_5_3B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_0_6B",label:"QWEN3_0_6B"},{type:"doc",id:"06-api-reference/variables/QWEN3_0_6B_QUANTIZED",label:"QWEN3_0_6B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_1_7B",label:"QWEN3_1_7B"},{type:"doc",id:"06-api-reference/variables/QWEN3_1_7B_QUANTIZED",label:"QWEN3_1_7B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_4B",label:"QWEN3_4B"},{type:"doc",id:"06-api-reference/variables/QWEN3_4B_QUANTIZED",label:"QWEN3_4B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_1_7B",label:"SMOLLM2_1_1_7B"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_1_7B_QUANTIZED",label:"SMOLLM2_1_1_7B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_135M",label:"SMOLLM2_1_135M"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_135M_QUANTIZED",label:"SMOLLM2_1_135M_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_360M",label:"SMOLLM2_1_360M"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_360M_QUANTIZED",label:"SMOLLM2_1_360M_QUANTIZED"}]},{type:"category",label:"Models - Object Detection",items:[{type:"doc",id:"06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE",label:"SSDLITE_320_MOBILENET_V3_LARGE"}]},{type:"category",label:"Models - Semantic Segmentation",items:[{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE",label:"DEEPLAB_V3_MOBILENET_V3_LARGE"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED",label:"DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET101",label:"DEEPLAB_V3_RESNET101"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED",label:"DEEPLAB_V3_RESNET101_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET50",label:"DEEPLAB_V3_RESNET50"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED",label:"DEEPLAB_V3_RESNET50_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET101",label:"FCN_RESNET101"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET101_QUANTIZED",label:"FCN_RESNET101_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET50",label:"FCN_RESNET50"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET50_QUANTIZED",label:"FCN_RESNET50_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE",label:"LRASPP_MOBILENET_V3_LARGE"},{type:"doc",id:"06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED",label:"LRASPP_MOBILENET_V3_LARGE_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SELFIE_SEGMENTATION",label:"SELFIE_SEGMENTATION"}]},{type:"category",label:"Models - Speech To Text",items:[{type:"doc",id:"06-api-reference/variables/WHISPER_BASE",label:"WHISPER_BASE"},{type:"doc",id:"06-api-reference/variables/WHISPER_BASE_EN",label:"WHISPER_BASE_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_SMALL",label:"WHISPER_SMALL"},{type:"doc",id:"06-api-reference/variables/WHISPER_SMALL_EN",label:"WHISPER_SMALL_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY",label:"WHISPER_TINY"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY_EN",label:"WHISPER_TINY_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED",label:"WHISPER_TINY_EN_QUANTIZED"}]},{type:"category",label:"Models - Style Transfer",items:[{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_CANDY",label:"STYLE_TRANSFER_CANDY"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_MOSAIC",label:"STYLE_TRANSFER_MOSAIC"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS",label:"STYLE_TRANSFER_RAIN_PRINCESS"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_UDNIE",label:"STYLE_TRANSFER_UDNIE"}]},{type:"category",label:"Models - Text Embeddings",items:[{type:"doc",id:"06-api-reference/variables/ALL_MINILM_L6_V2",label:"ALL_MINILM_L6_V2"},{type:"doc",id:"06-api-reference/variables/ALL_MPNET_BASE_V2",label:"ALL_MPNET_BASE_V2"},{type:"doc",id:"06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT",label:"CLIP_VIT_BASE_PATCH32_TEXT"},{type:"doc",id:"06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1",label:"MULTI_QA_MINILM_L6_COS_V1"},{type:"doc",id:"06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1",label:"MULTI_QA_MPNET_BASE_DOT_V1"}]},{type:"category",label:"Models - Text to Speech",items:[{type:"doc",id:"06-api-reference/variables/KOKORO_MEDIUM",label:"KOKORO_MEDIUM"},{type:"doc",id:"06-api-reference/variables/KOKORO_SMALL",label:"KOKORO_SMALL"}]},{type:"category",label:"Models - Voice Activity Detection",items:[{type:"doc",id:"06-api-reference/variables/FSMN_VAD",label:"FSMN_VAD"}]},{type:"category",label:"OCR Supported Alphabets",items:[{type:"doc",id:"06-api-reference/variables/OCR_ABAZA",label:"OCR_ABAZA"},{type:"doc",id:"06-api-reference/variables/OCR_ADYGHE",label:"OCR_ADYGHE"},{type:"doc",id:"06-api-reference/variables/OCR_AFRIKAANS",label:"OCR_AFRIKAANS"},{type:"doc",id:"06-api-reference/variables/OCR_ALBANIAN",label:"OCR_ALBANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_AVAR",label:"OCR_AVAR"},{type:"doc",id:"06-api-reference/variables/OCR_AZERBAIJANI",label:"OCR_AZERBAIJANI"},{type:"doc",id:"06-api-reference/variables/OCR_BELARUSIAN",label:"OCR_BELARUSIAN"},{type:"doc",id:"06-api-reference/variables/OCR_BOSNIAN",label:"OCR_BOSNIAN"},{type:"doc",id:"06-api-reference/variables/OCR_BULGARIAN",label:"OCR_BULGARIAN"},{type:"doc",id:"06-api-reference/variables/OCR_CHECHEN",label:"OCR_CHECHEN"},{type:"doc",id:"06-api-reference/variables/OCR_CROATIAN",label:"OCR_CROATIAN"},{type:"doc",id:"06-api-reference/variables/OCR_CZECH",label:"OCR_CZECH"},{type:"doc",id:"06-api-reference/variables/OCR_DANISH",label:"OCR_DANISH"},{type:"doc",id:"06-api-reference/variables/OCR_DARGWA",label:"OCR_DARGWA"},{type:"doc",id:"06-api-reference/variables/OCR_DUTCH",label:"OCR_DUTCH"},{type:"doc",id:"06-api-reference/variables/OCR_ENGLISH",label:"OCR_ENGLISH"},{type:"doc",id:"06-api-reference/variables/OCR_ESTONIAN",label:"OCR_ESTONIAN"},{type:"doc",id:"06-api-reference/variables/OCR_FRENCH",label:"OCR_FRENCH"},{type:"doc",id:"06-api-reference/variables/OCR_GERMAN",label:"OCR_GERMAN"},{type:"doc",id:"06-api-reference/variables/OCR_HUNGARIAN",label:"OCR_HUNGARIAN"},{type:"doc",id:"06-api-reference/variables/OCR_ICELANDIC",label:"OCR_ICELANDIC"},{type:"doc",id:"06-api-reference/variables/OCR_INDONESIAN",label:"OCR_INDONESIAN"},{type:"doc",id:"06-api-reference/variables/OCR_INGUSH",label:"OCR_INGUSH"},{type:"doc",id:"06-api-reference/variables/OCR_IRISH",label:"OCR_IRISH"},{type:"doc",id:"06-api-reference/variables/OCR_ITALIAN",label:"OCR_ITALIAN"},{type:"doc",id:"06-api-reference/variables/OCR_JAPANESE",label:"OCR_JAPANESE"},{type:"doc",id:"06-api-reference/variables/OCR_KANNADA",label:"OCR_KANNADA"},{type:"doc",id:"06-api-reference/variables/OCR_KARBADIAN",label:"OCR_KARBADIAN"},{type:"doc",id:"06-api-reference/variables/OCR_KOREAN",label:"OCR_KOREAN"},{type:"doc",id:"06-api-reference/variables/OCR_KURDISH",label:"OCR_KURDISH"},{type:"doc",id:"06-api-reference/variables/OCR_LAK",label:"OCR_LAK"},{type:"doc",id:"06-api-reference/variables/OCR_LATIN",label:"OCR_LATIN"},{type:"doc",id:"06-api-reference/variables/OCR_LATVIAN",label:"OCR_LATVIAN"},{type:"doc",id:"06-api-reference/variables/OCR_LEZGHIAN",label:"OCR_LEZGHIAN"},{type:"doc",id:"06-api-reference/variables/OCR_LITHUANIAN",label:"OCR_LITHUANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_MALAY",label:"OCR_MALAY"},{type:"doc",id:"06-api-reference/variables/OCR_MALTESE",label:"OCR_MALTESE"},{type:"doc",id:"06-api-reference/variables/OCR_MAORI",label:"OCR_MAORI"},{type:"doc",id:"06-api-reference/variables/OCR_MONGOLIAN",label:"OCR_MONGOLIAN"},{type:"doc",id:"06-api-reference/variables/OCR_NORWEGIAN",label:"OCR_NORWEGIAN"},{type:"doc",id:"06-api-reference/variables/OCR_OCCITAN",label:"OCR_OCCITAN"},{type:"doc",id:"06-api-reference/variables/OCR_PALI",label:"OCR_PALI"},{type:"doc",id:"06-api-reference/variables/OCR_POLISH",label:"OCR_POLISH"},{type:"doc",id:"06-api-reference/variables/OCR_PORTUGUESE",label:"OCR_PORTUGUESE"},{type:"doc",id:"06-api-reference/variables/OCR_ROMANIAN",label:"OCR_ROMANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_RUSSIAN",label:"OCR_RUSSIAN"},{type:"doc",id:"06-api-reference/variables/OCR_SERBIAN_CYRILLIC",label:"OCR_SERBIAN_CYRILLIC"},{type:"doc",id:"06-api-reference/variables/OCR_SERBIAN_LATIN",label:"OCR_SERBIAN_LATIN"},{type:"doc",id:"06-api-reference/variables/OCR_SIMPLIFIED_CHINESE",label:"OCR_SIMPLIFIED_CHINESE"},{type:"doc",id:"06-api-reference/variables/OCR_SLOVAK",label:"OCR_SLOVAK"},{type:"doc",id:"06-api-reference/variables/OCR_SLOVENIAN",label:"OCR_SLOVENIAN"},{type:"doc",id:"06-api-reference/variables/OCR_SPANISH",label:"OCR_SPANISH"},{type:"doc",id:"06-api-reference/variables/OCR_SWAHILI",label:"OCR_SWAHILI"},{type:"doc",id:"06-api-reference/variables/OCR_SWEDISH",label:"OCR_SWEDISH"},{type:"doc",id:"06-api-reference/variables/OCR_TABASSARAN",label:"OCR_TABASSARAN"},{type:"doc",id:"06-api-reference/variables/OCR_TAGALOG",label:"OCR_TAGALOG"},{type:"doc",id:"06-api-reference/variables/OCR_TAJIK",label:"OCR_TAJIK"},{type:"doc",id:"06-api-reference/variables/OCR_TELUGU",label:"OCR_TELUGU"},{type:"doc",id:"06-api-reference/variables/OCR_TURKISH",label:"OCR_TURKISH"},{type:"doc",id:"06-api-reference/variables/OCR_UKRAINIAN",label:"OCR_UKRAINIAN"},{type:"doc",id:"06-api-reference/variables/OCR_UZBEK",label:"OCR_UZBEK"},{type:"doc",id:"06-api-reference/variables/OCR_VIETNAMESE",label:"OCR_VIETNAMESE"},{type:"doc",id:"06-api-reference/variables/OCR_WELSH",label:"OCR_WELSH"}]},{type:"category",label:"Other",items:[{type:"doc",id:"06-api-reference/enumerations/RnExecutorchErrorCode",label:"RnExecutorchErrorCode"},{type:"doc",id:"06-api-reference/classes/Logger",label:"Logger"},{type:"doc",id:"06-api-reference/classes/RnExecutorchError",label:"RnExecutorchError"},{type:"doc",id:"06-api-reference/interfaces/Frame",label:"Frame"}]},{type:"category",label:"TTS Supported Voices",items:[{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_HEART",label:"KOKORO_VOICE_AF_HEART"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_RIVER",label:"KOKORO_VOICE_AF_RIVER"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_SARAH",label:"KOKORO_VOICE_AF_SARAH"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_ADAM",label:"KOKORO_VOICE_AM_ADAM"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_MICHAEL",label:"KOKORO_VOICE_AM_MICHAEL"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_SANTA",label:"KOKORO_VOICE_AM_SANTA"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_BF_EMMA",label:"KOKORO_VOICE_BF_EMMA"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_BM_DANIEL",label:"KOKORO_VOICE_BM_DANIEL"}]},{type:"category",label:"Types",items:[{type:"doc",id:"06-api-reference/enumerations/CocoLabel",label:"CocoLabel"},{type:"doc",id:"06-api-reference/enumerations/DeeplabLabel",label:"DeeplabLabel"},{type:"doc",id:"06-api-reference/enumerations/DownloadStatus",label:"DownloadStatus"},{type:"doc",id:"06-api-reference/enumerations/HTTP_CODE",label:"HTTP_CODE"},{type:"doc",id:"06-api-reference/enumerations/ScalarType",label:"ScalarType"},{type:"doc",id:"06-api-reference/enumerations/SelfieSegmentationLabel",label:"SelfieSegmentationLabel"},{type:"doc",id:"06-api-reference/enumerations/SourceType",label:"SourceType"},{type:"doc",id:"06-api-reference/interfaces/Bbox",label:"Bbox"},{type:"doc",id:"06-api-reference/interfaces/ChatConfig",label:"ChatConfig"},{type:"doc",id:"06-api-reference/interfaces/ClassificationProps",label:"ClassificationProps"},{type:"doc",id:"06-api-reference/interfaces/ClassificationType",label:"ClassificationType"},{type:"doc",id:"06-api-reference/interfaces/ContextStrategy",label:"ContextStrategy"},{type:"doc",id:"06-api-reference/interfaces/DecodingOptions",label:"DecodingOptions"},{type:"doc",id:"06-api-reference/interfaces/Detection",label:"Detection"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchModuleProps",label:"ExecutorchModuleProps"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchModuleType",label:"ExecutorchModuleType"},{type:"doc",id:"06-api-reference/interfaces/GenerationConfig",label:"GenerationConfig"},{type:"doc",id:"06-api-reference/interfaces/ImageEmbeddingsProps",label:"ImageEmbeddingsProps"},{type:"doc",id:"06-api-reference/interfaces/ImageEmbeddingsType",label:"ImageEmbeddingsType"},{type:"doc",id:"06-api-reference/interfaces/KokoroConfig",label:"KokoroConfig"},{type:"doc",id:"06-api-reference/interfaces/KokoroVoiceExtras",label:"KokoroVoiceExtras"},{type:"doc",id:"06-api-reference/interfaces/LLMConfig",label:"LLMConfig"},{type:"doc",id:"06-api-reference/interfaces/LLMProps",label:"LLMProps"},{type:"doc",id:"06-api-reference/interfaces/LLMType",label:"LLMType"},{type:"doc",id:"06-api-reference/interfaces/Message",label:"Message"},{type:"doc",id:"06-api-reference/interfaces/ObjectDetectionProps",label:"ObjectDetectionProps"},{type:"doc",id:"06-api-reference/interfaces/ObjectDetectionType",label:"ObjectDetectionType"},{type:"doc",id:"06-api-reference/interfaces/OCRDetection",label:"OCRDetection"},{type:"doc",id:"06-api-reference/interfaces/OCRProps",label:"OCRProps"},{type:"doc",id:"06-api-reference/interfaces/OCRType",label:"OCRType"},{type:"doc",id:"06-api-reference/interfaces/PixelData",label:"PixelData"},{type:"doc",id:"06-api-reference/interfaces/Point",label:"Point"},{type:"doc",id:"06-api-reference/interfaces/Segment",label:"Segment"},{type:"doc",id:"06-api-reference/interfaces/SemanticSegmentationProps",label:"SemanticSegmentationProps"},{type:"doc",id:"06-api-reference/interfaces/SemanticSegmentationType",label:"SemanticSegmentationType"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextModelConfig",label:"SpeechToTextModelConfig"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextProps",label:"SpeechToTextProps"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextType",label:"SpeechToTextType"},{type:"doc",id:"06-api-reference/interfaces/StyleTransferProps",label:"StyleTransferProps"},{type:"doc",id:"06-api-reference/interfaces/StyleTransferType",label:"StyleTransferType"},{type:"doc",id:"06-api-reference/interfaces/TensorPtr",label:"TensorPtr"},{type:"doc",id:"06-api-reference/interfaces/TextEmbeddingsProps",label:"TextEmbeddingsProps"},{type:"doc",id:"06-api-reference/interfaces/TextEmbeddingsType",label:"TextEmbeddingsType"},{type:"doc",id:"06-api-reference/interfaces/TextToImageProps",label:"TextToImageProps"},{type:"doc",id:"06-api-reference/interfaces/TextToImageType",label:"TextToImageType"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechConfig",label:"TextToSpeechConfig"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechInput",label:"TextToSpeechInput"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechProps",label:"TextToSpeechProps"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechStreamingInput",label:"TextToSpeechStreamingInput"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechType",label:"TextToSpeechType"},{type:"doc",id:"06-api-reference/interfaces/TokenizerProps",label:"TokenizerProps"},{type:"doc",id:"06-api-reference/interfaces/TokenizerType",label:"TokenizerType"},{type:"doc",id:"06-api-reference/interfaces/ToolCall",label:"ToolCall"},{type:"doc",id:"06-api-reference/interfaces/ToolsConfig",label:"ToolsConfig"},{type:"doc",id:"06-api-reference/interfaces/TranscriptionResult",label:"TranscriptionResult"},{type:"doc",id:"06-api-reference/interfaces/TranscriptionSegment",label:"TranscriptionSegment"},{type:"doc",id:"06-api-reference/interfaces/VADProps",label:"VADProps"},{type:"doc",id:"06-api-reference/interfaces/VADType",label:"VADType"},{type:"doc",id:"06-api-reference/interfaces/VerticalOCRProps",label:"VerticalOCRProps"},{type:"doc",id:"06-api-reference/interfaces/VoiceConfig",label:"VoiceConfig"},{type:"doc",id:"06-api-reference/interfaces/Word",label:"Word"},{type:"doc",id:"06-api-reference/type-aliases/LabelEnum",label:"LabelEnum"},{type:"doc",id:"06-api-reference/type-aliases/LLMTool",label:"LLMTool"},{type:"doc",id:"06-api-reference/type-aliases/MessageRole",label:"MessageRole"},{type:"doc",id:"06-api-reference/type-aliases/ModelNameOf",label:"ModelNameOf"},{type:"doc",id:"06-api-reference/type-aliases/OCRLanguage",label:"OCRLanguage"},{type:"doc",id:"06-api-reference/type-aliases/ResourceSource",label:"ResourceSource"},{type:"doc",id:"06-api-reference/type-aliases/SegmentationLabels",label:"SegmentationLabels"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationConfig",label:"SemanticSegmentationConfig"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationModelName",label:"SemanticSegmentationModelName"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationModelSources",label:"SemanticSegmentationModelSources"},{type:"doc",id:"06-api-reference/type-aliases/SpeechToTextLanguage",label:"SpeechToTextLanguage"},{type:"doc",id:"06-api-reference/type-aliases/TensorBuffer",label:"TensorBuffer"},{type:"doc",id:"06-api-reference/type-aliases/TextToSpeechLanguage",label:"TextToSpeechLanguage"},{type:"doc",id:"06-api-reference/type-aliases/Triple",label:"Triple"},{type:"doc",id:"06-api-reference/variables/SPECIAL_TOKENS",label:"SPECIAL_TOKENS"}]},{type:"category",label:"Typescript API",items:[{type:"doc",id:"06-api-reference/classes/ClassificationModule",label:"ClassificationModule"},{type:"doc",id:"06-api-reference/classes/ExecutorchModule",label:"ExecutorchModule"},{type:"doc",id:"06-api-reference/classes/ImageEmbeddingsModule",label:"ImageEmbeddingsModule"},{type:"doc",id:"06-api-reference/classes/LLMModule",label:"LLMModule"},{type:"doc",id:"06-api-reference/classes/ObjectDetectionModule",label:"ObjectDetectionModule"},{type:"doc",id:"06-api-reference/classes/OCRModule",label:"OCRModule"},{type:"doc",id:"06-api-reference/classes/SemanticSegmentationModule",label:"SemanticSegmentationModule"},{type:"doc",id:"06-api-reference/classes/SpeechToTextModule",label:"SpeechToTextModule"},{type:"doc",id:"06-api-reference/classes/StyleTransferModule",label:"StyleTransferModule"},{type:"doc",id:"06-api-reference/classes/TextEmbeddingsModule",label:"TextEmbeddingsModule"},{type:"doc",id:"06-api-reference/classes/TextToImageModule",label:"TextToImageModule"},{type:"doc",id:"06-api-reference/classes/TextToSpeechModule",label:"TextToSpeechModule"},{type:"doc",id:"06-api-reference/classes/TokenizerModule",label:"TokenizerModule"},{type:"doc",id:"06-api-reference/classes/VADModule",label:"VADModule"},{type:"doc",id:"06-api-reference/classes/VerticalOCRModule",label:"VerticalOCRModule"}]},{type:"category",label:"Utilities - General",items:[{type:"category",label:"ResourceFetcherUtils",items:[{type:"category",label:"Functions",items:[{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/calculateDownloadProgress",label:"calculateDownloadProgress"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/getFilenameFromUri",label:"getFilenameFromUri"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/hashObject",label:"hashObject"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/removeFilePrefix",label:"removeFilePrefix"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/triggerHuggingFaceDownloadCounter",label:"triggerHuggingFaceDownloadCounter"}]}],link:{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/index"}},{type:"doc",id:"06-api-reference/classes/ResourceFetcher",label:"ResourceFetcher"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchConfig",label:"ExecutorchConfig"},{type:"doc",id:"06-api-reference/interfaces/ResourceFetcherAdapter",label:"ResourceFetcherAdapter"},{type:"doc",id:"06-api-reference/functions/cleanupExecutorch",label:"cleanupExecutorch"},{type:"doc",id:"06-api-reference/functions/initExecutorch",label:"initExecutorch"}]},{type:"category",label:"Utilities - LLM",items:[{type:"doc",id:"06-api-reference/variables/DEFAULT_CHAT_CONFIG",label:"DEFAULT_CHAT_CONFIG"},{type:"doc",id:"06-api-reference/variables/DEFAULT_CONTEXT_BUFFER_TOKENS",label:"DEFAULT_CONTEXT_BUFFER_TOKENS"},{type:"doc",id:"06-api-reference/variables/DEFAULT_MESSAGE_HISTORY",label:"DEFAULT_MESSAGE_HISTORY"},{type:"doc",id:"06-api-reference/variables/DEFAULT_SYSTEM_PROMPT",label:"DEFAULT_SYSTEM_PROMPT"},{type:"doc",id:"06-api-reference/variables/parseToolCall",label:"parseToolCall"},{type:"doc",id:"06-api-reference/functions/DEFAULT_STRUCTURED_OUTPUT_PROMPT",label:"DEFAULT_STRUCTURED_OUTPUT_PROMPT"},{type:"doc",id:"06-api-reference/functions/fixAndValidateStructuredOutput",label:"fixAndValidateStructuredOutput"},{type:"doc",id:"06-api-reference/functions/getStructuredOutputPrompt",label:"getStructuredOutputPrompt"}]},{type:"category",label:"Utils",items:[{type:"doc",id:"06-api-reference/classes/MessageCountContextStrategy",label:"MessageCountContextStrategy"},{type:"doc",id:"06-api-reference/classes/NoopContextStrategy",label:"NoopContextStrategy"},{type:"doc",id:"06-api-reference/classes/SlidingWindowContextStrategy",label:"SlidingWindowContextStrategy"}]}]};
+const typedocSidebar = {items:[{type:"category",label:"Hooks",items:[{type:"doc",id:"06-api-reference/functions/useClassification",label:"useClassification"},{type:"doc",id:"06-api-reference/functions/useExecutorchModule",label:"useExecutorchModule"},{type:"doc",id:"06-api-reference/functions/useImageEmbeddings",label:"useImageEmbeddings"},{type:"doc",id:"06-api-reference/functions/useLLM",label:"useLLM"},{type:"doc",id:"06-api-reference/functions/useObjectDetection",label:"useObjectDetection"},{type:"doc",id:"06-api-reference/functions/useOCR",label:"useOCR"},{type:"doc",id:"06-api-reference/functions/useSemanticSegmentation",label:"useSemanticSegmentation"},{type:"doc",id:"06-api-reference/functions/useSpeechToText",label:"useSpeechToText"},{type:"doc",id:"06-api-reference/functions/useStyleTransfer",label:"useStyleTransfer"},{type:"doc",id:"06-api-reference/functions/useTextEmbeddings",label:"useTextEmbeddings"},{type:"doc",id:"06-api-reference/functions/useTextToImage",label:"useTextToImage"},{type:"doc",id:"06-api-reference/functions/useTextToSpeech",label:"useTextToSpeech"},{type:"doc",id:"06-api-reference/functions/useTokenizer",label:"useTokenizer"},{type:"doc",id:"06-api-reference/functions/useVAD",label:"useVAD"},{type:"doc",id:"06-api-reference/functions/useVerticalOCR",label:"useVerticalOCR"}]},{type:"category",label:"Interfaces",items:[{type:"doc",id:"06-api-reference/interfaces/ResourceSourceExtended",label:"ResourceSourceExtended"}]},{type:"category",label:"Models - Classification",items:[{type:"doc",id:"06-api-reference/variables/EFFICIENTNET_V2_S",label:"EFFICIENTNET_V2_S"}]},{type:"category",label:"Models - Image Embeddings",items:[{type:"doc",id:"06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE",label:"CLIP_VIT_BASE_PATCH32_IMAGE"}]},{type:"category",label:"Models - Image Generation",items:[{type:"doc",id:"06-api-reference/variables/BK_SDM_TINY_VPRED_256",label:"BK_SDM_TINY_VPRED_256"},{type:"doc",id:"06-api-reference/variables/BK_SDM_TINY_VPRED_512",label:"BK_SDM_TINY_VPRED_512"}]},{type:"category",label:"Models - LMM",items:[{type:"doc",id:"06-api-reference/variables/HAMMER2_1_0_5B",label:"HAMMER2_1_0_5B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_0_5B_QUANTIZED",label:"HAMMER2_1_0_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_1_5B",label:"HAMMER2_1_1_5B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_1_5B_QUANTIZED",label:"HAMMER2_1_1_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_3B",label:"HAMMER2_1_3B"},{type:"doc",id:"06-api-reference/variables/HAMMER2_1_3B_QUANTIZED",label:"HAMMER2_1_3B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LFM2_5_1_2B_INSTRUCT",label:"LFM2_5_1_2B_INSTRUCT"},{type:"doc",id:"06-api-reference/variables/LFM2_5_1_2B_INSTRUCT_QUANTIZED",label:"LFM2_5_1_2B_INSTRUCT_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B",label:"LLAMA3_2_1B"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B_QLORA",label:"LLAMA3_2_1B_QLORA"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_1B_SPINQUANT",label:"LLAMA3_2_1B_SPINQUANT"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B",label:"LLAMA3_2_3B"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B_QLORA",label:"LLAMA3_2_3B_QLORA"},{type:"doc",id:"06-api-reference/variables/LLAMA3_2_3B_SPINQUANT",label:"LLAMA3_2_3B_SPINQUANT"},{type:"doc",id:"06-api-reference/variables/PHI_4_MINI_4B",label:"PHI_4_MINI_4B"},{type:"doc",id:"06-api-reference/variables/PHI_4_MINI_4B_QUANTIZED",label:"PHI_4_MINI_4B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_0_5B",label:"QWEN2_5_0_5B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_0_5B_QUANTIZED",label:"QWEN2_5_0_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_1_5B",label:"QWEN2_5_1_5B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_1_5B_QUANTIZED",label:"QWEN2_5_1_5B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_3B",label:"QWEN2_5_3B"},{type:"doc",id:"06-api-reference/variables/QWEN2_5_3B_QUANTIZED",label:"QWEN2_5_3B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_0_6B",label:"QWEN3_0_6B"},{type:"doc",id:"06-api-reference/variables/QWEN3_0_6B_QUANTIZED",label:"QWEN3_0_6B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_1_7B",label:"QWEN3_1_7B"},{type:"doc",id:"06-api-reference/variables/QWEN3_1_7B_QUANTIZED",label:"QWEN3_1_7B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/QWEN3_4B",label:"QWEN3_4B"},{type:"doc",id:"06-api-reference/variables/QWEN3_4B_QUANTIZED",label:"QWEN3_4B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_1_7B",label:"SMOLLM2_1_1_7B"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_1_7B_QUANTIZED",label:"SMOLLM2_1_1_7B_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_135M",label:"SMOLLM2_1_135M"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_135M_QUANTIZED",label:"SMOLLM2_1_135M_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_360M",label:"SMOLLM2_1_360M"},{type:"doc",id:"06-api-reference/variables/SMOLLM2_1_360M_QUANTIZED",label:"SMOLLM2_1_360M_QUANTIZED"}]},{type:"category",label:"Models - Object Detection",items:[{type:"doc",id:"06-api-reference/variables/RF_DETR_NANO",label:"RF_DETR_NANO"},{type:"doc",id:"06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE",label:"SSDLITE_320_MOBILENET_V3_LARGE"}]},{type:"category",label:"Models - Semantic Segmentation",items:[{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE",label:"DEEPLAB_V3_MOBILENET_V3_LARGE"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED",label:"DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET101",label:"DEEPLAB_V3_RESNET101"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED",label:"DEEPLAB_V3_RESNET101_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET50",label:"DEEPLAB_V3_RESNET50"},{type:"doc",id:"06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED",label:"DEEPLAB_V3_RESNET50_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET101",label:"FCN_RESNET101"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET101_QUANTIZED",label:"FCN_RESNET101_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET50",label:"FCN_RESNET50"},{type:"doc",id:"06-api-reference/variables/FCN_RESNET50_QUANTIZED",label:"FCN_RESNET50_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE",label:"LRASPP_MOBILENET_V3_LARGE"},{type:"doc",id:"06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED",label:"LRASPP_MOBILENET_V3_LARGE_QUANTIZED"},{type:"doc",id:"06-api-reference/variables/SELFIE_SEGMENTATION",label:"SELFIE_SEGMENTATION"}]},{type:"category",label:"Models - Speech To Text",items:[{type:"doc",id:"06-api-reference/variables/WHISPER_BASE",label:"WHISPER_BASE"},{type:"doc",id:"06-api-reference/variables/WHISPER_BASE_EN",label:"WHISPER_BASE_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_SMALL",label:"WHISPER_SMALL"},{type:"doc",id:"06-api-reference/variables/WHISPER_SMALL_EN",label:"WHISPER_SMALL_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY",label:"WHISPER_TINY"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY_EN",label:"WHISPER_TINY_EN"},{type:"doc",id:"06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED",label:"WHISPER_TINY_EN_QUANTIZED"}]},{type:"category",label:"Models - Style Transfer",items:[{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_CANDY",label:"STYLE_TRANSFER_CANDY"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_MOSAIC",label:"STYLE_TRANSFER_MOSAIC"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS",label:"STYLE_TRANSFER_RAIN_PRINCESS"},{type:"doc",id:"06-api-reference/variables/STYLE_TRANSFER_UDNIE",label:"STYLE_TRANSFER_UDNIE"}]},{type:"category",label:"Models - Text Embeddings",items:[{type:"doc",id:"06-api-reference/variables/ALL_MINILM_L6_V2",label:"ALL_MINILM_L6_V2"},{type:"doc",id:"06-api-reference/variables/ALL_MPNET_BASE_V2",label:"ALL_MPNET_BASE_V2"},{type:"doc",id:"06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT",label:"CLIP_VIT_BASE_PATCH32_TEXT"},{type:"doc",id:"06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1",label:"MULTI_QA_MINILM_L6_COS_V1"},{type:"doc",id:"06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1",label:"MULTI_QA_MPNET_BASE_DOT_V1"}]},{type:"category",label:"Models - Text to Speech",items:[{type:"doc",id:"06-api-reference/variables/KOKORO_MEDIUM",label:"KOKORO_MEDIUM"},{type:"doc",id:"06-api-reference/variables/KOKORO_SMALL",label:"KOKORO_SMALL"}]},{type:"category",label:"Models - Voice Activity Detection",items:[{type:"doc",id:"06-api-reference/variables/FSMN_VAD",label:"FSMN_VAD"}]},{type:"category",label:"OCR Supported Alphabets",items:[{type:"doc",id:"06-api-reference/variables/OCR_ABAZA",label:"OCR_ABAZA"},{type:"doc",id:"06-api-reference/variables/OCR_ADYGHE",label:"OCR_ADYGHE"},{type:"doc",id:"06-api-reference/variables/OCR_AFRIKAANS",label:"OCR_AFRIKAANS"},{type:"doc",id:"06-api-reference/variables/OCR_ALBANIAN",label:"OCR_ALBANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_AVAR",label:"OCR_AVAR"},{type:"doc",id:"06-api-reference/variables/OCR_AZERBAIJANI",label:"OCR_AZERBAIJANI"},{type:"doc",id:"06-api-reference/variables/OCR_BELARUSIAN",label:"OCR_BELARUSIAN"},{type:"doc",id:"06-api-reference/variables/OCR_BOSNIAN",label:"OCR_BOSNIAN"},{type:"doc",id:"06-api-reference/variables/OCR_BULGARIAN",label:"OCR_BULGARIAN"},{type:"doc",id:"06-api-reference/variables/OCR_CHECHEN",label:"OCR_CHECHEN"},{type:"doc",id:"06-api-reference/variables/OCR_CROATIAN",label:"OCR_CROATIAN"},{type:"doc",id:"06-api-reference/variables/OCR_CZECH",label:"OCR_CZECH"},{type:"doc",id:"06-api-reference/variables/OCR_DANISH",label:"OCR_DANISH"},{type:"doc",id:"06-api-reference/variables/OCR_DARGWA",label:"OCR_DARGWA"},{type:"doc",id:"06-api-reference/variables/OCR_DUTCH",label:"OCR_DUTCH"},{type:"doc",id:"06-api-reference/variables/OCR_ENGLISH",label:"OCR_ENGLISH"},{type:"doc",id:"06-api-reference/variables/OCR_ESTONIAN",label:"OCR_ESTONIAN"},{type:"doc",id:"06-api-reference/variables/OCR_FRENCH",label:"OCR_FRENCH"},{type:"doc",id:"06-api-reference/variables/OCR_GERMAN",label:"OCR_GERMAN"},{type:"doc",id:"06-api-reference/variables/OCR_HUNGARIAN",label:"OCR_HUNGARIAN"},{type:"doc",id:"06-api-reference/variables/OCR_ICELANDIC",label:"OCR_ICELANDIC"},{type:"doc",id:"06-api-reference/variables/OCR_INDONESIAN",label:"OCR_INDONESIAN"},{type:"doc",id:"06-api-reference/variables/OCR_INGUSH",label:"OCR_INGUSH"},{type:"doc",id:"06-api-reference/variables/OCR_IRISH",label:"OCR_IRISH"},{type:"doc",id:"06-api-reference/variables/OCR_ITALIAN",label:"OCR_ITALIAN"},{type:"doc",id:"06-api-reference/variables/OCR_JAPANESE",label:"OCR_JAPANESE"},{type:"doc",id:"06-api-reference/variables/OCR_KANNADA",label:"OCR_KANNADA"},{type:"doc",id:"06-api-reference/variables/OCR_KARBADIAN",label:"OCR_KARBADIAN"},{type:"doc",id:"06-api-reference/variables/OCR_KOREAN",label:"OCR_KOREAN"},{type:"doc",id:"06-api-reference/variables/OCR_KURDISH",label:"OCR_KURDISH"},{type:"doc",id:"06-api-reference/variables/OCR_LAK",label:"OCR_LAK"},{type:"doc",id:"06-api-reference/variables/OCR_LATIN",label:"OCR_LATIN"},{type:"doc",id:"06-api-reference/variables/OCR_LATVIAN",label:"OCR_LATVIAN"},{type:"doc",id:"06-api-reference/variables/OCR_LEZGHIAN",label:"OCR_LEZGHIAN"},{type:"doc",id:"06-api-reference/variables/OCR_LITHUANIAN",label:"OCR_LITHUANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_MALAY",label:"OCR_MALAY"},{type:"doc",id:"06-api-reference/variables/OCR_MALTESE",label:"OCR_MALTESE"},{type:"doc",id:"06-api-reference/variables/OCR_MAORI",label:"OCR_MAORI"},{type:"doc",id:"06-api-reference/variables/OCR_MONGOLIAN",label:"OCR_MONGOLIAN"},{type:"doc",id:"06-api-reference/variables/OCR_NORWEGIAN",label:"OCR_NORWEGIAN"},{type:"doc",id:"06-api-reference/variables/OCR_OCCITAN",label:"OCR_OCCITAN"},{type:"doc",id:"06-api-reference/variables/OCR_PALI",label:"OCR_PALI"},{type:"doc",id:"06-api-reference/variables/OCR_POLISH",label:"OCR_POLISH"},{type:"doc",id:"06-api-reference/variables/OCR_PORTUGUESE",label:"OCR_PORTUGUESE"},{type:"doc",id:"06-api-reference/variables/OCR_ROMANIAN",label:"OCR_ROMANIAN"},{type:"doc",id:"06-api-reference/variables/OCR_RUSSIAN",label:"OCR_RUSSIAN"},{type:"doc",id:"06-api-reference/variables/OCR_SERBIAN_CYRILLIC",label:"OCR_SERBIAN_CYRILLIC"},{type:"doc",id:"06-api-reference/variables/OCR_SERBIAN_LATIN",label:"OCR_SERBIAN_LATIN"},{type:"doc",id:"06-api-reference/variables/OCR_SIMPLIFIED_CHINESE",label:"OCR_SIMPLIFIED_CHINESE"},{type:"doc",id:"06-api-reference/variables/OCR_SLOVAK",label:"OCR_SLOVAK"},{type:"doc",id:"06-api-reference/variables/OCR_SLOVENIAN",label:"OCR_SLOVENIAN"},{type:"doc",id:"06-api-reference/variables/OCR_SPANISH",label:"OCR_SPANISH"},{type:"doc",id:"06-api-reference/variables/OCR_SWAHILI",label:"OCR_SWAHILI"},{type:"doc",id:"06-api-reference/variables/OCR_SWEDISH",label:"OCR_SWEDISH"},{type:"doc",id:"06-api-reference/variables/OCR_TABASSARAN",label:"OCR_TABASSARAN"},{type:"doc",id:"06-api-reference/variables/OCR_TAGALOG",label:"OCR_TAGALOG"},{type:"doc",id:"06-api-reference/variables/OCR_TAJIK",label:"OCR_TAJIK"},{type:"doc",id:"06-api-reference/variables/OCR_TELUGU",label:"OCR_TELUGU"},{type:"doc",id:"06-api-reference/variables/OCR_TURKISH",label:"OCR_TURKISH"},{type:"doc",id:"06-api-reference/variables/OCR_UKRAINIAN",label:"OCR_UKRAINIAN"},{type:"doc",id:"06-api-reference/variables/OCR_UZBEK",label:"OCR_UZBEK"},{type:"doc",id:"06-api-reference/variables/OCR_VIETNAMESE",label:"OCR_VIETNAMESE"},{type:"doc",id:"06-api-reference/variables/OCR_WELSH",label:"OCR_WELSH"}]},{type:"category",label:"Other",items:[{type:"doc",id:"06-api-reference/enumerations/RnExecutorchErrorCode",label:"RnExecutorchErrorCode"},{type:"doc",id:"06-api-reference/classes/Logger",label:"Logger"},{type:"doc",id:"06-api-reference/classes/RnExecutorchError",label:"RnExecutorchError"},{type:"doc",id:"06-api-reference/interfaces/Frame",label:"Frame"},{type:"doc",id:"06-api-reference/variables/IMAGENET1K_MEAN",label:"IMAGENET1K_MEAN"},{type:"doc",id:"06-api-reference/variables/IMAGENET1K_STD",label:"IMAGENET1K_STD"}]},{type:"category",label:"TTS Supported Voices",items:[{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_HEART",label:"KOKORO_VOICE_AF_HEART"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_RIVER",label:"KOKORO_VOICE_AF_RIVER"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AF_SARAH",label:"KOKORO_VOICE_AF_SARAH"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_ADAM",label:"KOKORO_VOICE_AM_ADAM"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_MICHAEL",label:"KOKORO_VOICE_AM_MICHAEL"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_AM_SANTA",label:"KOKORO_VOICE_AM_SANTA"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_BF_EMMA",label:"KOKORO_VOICE_BF_EMMA"},{type:"doc",id:"06-api-reference/variables/KOKORO_VOICE_BM_DANIEL",label:"KOKORO_VOICE_BM_DANIEL"}]},{type:"category",label:"Types",items:[{type:"doc",id:"06-api-reference/enumerations/CocoLabel",label:"CocoLabel"},{type:"doc",id:"06-api-reference/enumerations/DeeplabLabel",label:"DeeplabLabel"},{type:"doc",id:"06-api-reference/enumerations/DownloadStatus",label:"DownloadStatus"},{type:"doc",id:"06-api-reference/enumerations/HTTP_CODE",label:"HTTP_CODE"},{type:"doc",id:"06-api-reference/enumerations/ScalarType",label:"ScalarType"},{type:"doc",id:"06-api-reference/enumerations/SelfieSegmentationLabel",label:"SelfieSegmentationLabel"},{type:"doc",id:"06-api-reference/enumerations/SourceType",label:"SourceType"},{type:"doc",id:"06-api-reference/interfaces/Bbox",label:"Bbox"},{type:"doc",id:"06-api-reference/interfaces/ChatConfig",label:"ChatConfig"},{type:"doc",id:"06-api-reference/interfaces/ClassificationProps",label:"ClassificationProps"},{type:"doc",id:"06-api-reference/interfaces/ClassificationType",label:"ClassificationType"},{type:"doc",id:"06-api-reference/interfaces/ContextStrategy",label:"ContextStrategy"},{type:"doc",id:"06-api-reference/interfaces/DecodingOptions",label:"DecodingOptions"},{type:"doc",id:"06-api-reference/interfaces/Detection",label:"Detection"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchModuleProps",label:"ExecutorchModuleProps"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchModuleType",label:"ExecutorchModuleType"},{type:"doc",id:"06-api-reference/interfaces/GenerationConfig",label:"GenerationConfig"},{type:"doc",id:"06-api-reference/interfaces/ImageEmbeddingsProps",label:"ImageEmbeddingsProps"},{type:"doc",id:"06-api-reference/interfaces/ImageEmbeddingsType",label:"ImageEmbeddingsType"},{type:"doc",id:"06-api-reference/interfaces/KokoroConfig",label:"KokoroConfig"},{type:"doc",id:"06-api-reference/interfaces/KokoroVoiceExtras",label:"KokoroVoiceExtras"},{type:"doc",id:"06-api-reference/interfaces/LLMConfig",label:"LLMConfig"},{type:"doc",id:"06-api-reference/interfaces/LLMProps",label:"LLMProps"},{type:"doc",id:"06-api-reference/interfaces/LLMType",label:"LLMType"},{type:"doc",id:"06-api-reference/interfaces/Message",label:"Message"},{type:"doc",id:"06-api-reference/interfaces/ObjectDetectionProps",label:"ObjectDetectionProps"},{type:"doc",id:"06-api-reference/interfaces/ObjectDetectionType",label:"ObjectDetectionType"},{type:"doc",id:"06-api-reference/interfaces/OCRDetection",label:"OCRDetection"},{type:"doc",id:"06-api-reference/interfaces/OCRProps",label:"OCRProps"},{type:"doc",id:"06-api-reference/interfaces/OCRType",label:"OCRType"},{type:"doc",id:"06-api-reference/interfaces/PixelData",label:"PixelData"},{type:"doc",id:"06-api-reference/interfaces/Point",label:"Point"},{type:"doc",id:"06-api-reference/interfaces/Segment",label:"Segment"},{type:"doc",id:"06-api-reference/interfaces/SemanticSegmentationProps",label:"SemanticSegmentationProps"},{type:"doc",id:"06-api-reference/interfaces/SemanticSegmentationType",label:"SemanticSegmentationType"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextModelConfig",label:"SpeechToTextModelConfig"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextProps",label:"SpeechToTextProps"},{type:"doc",id:"06-api-reference/interfaces/SpeechToTextType",label:"SpeechToTextType"},{type:"doc",id:"06-api-reference/interfaces/StyleTransferProps",label:"StyleTransferProps"},{type:"doc",id:"06-api-reference/interfaces/StyleTransferType",label:"StyleTransferType"},{type:"doc",id:"06-api-reference/interfaces/TensorPtr",label:"TensorPtr"},{type:"doc",id:"06-api-reference/interfaces/TextEmbeddingsProps",label:"TextEmbeddingsProps"},{type:"doc",id:"06-api-reference/interfaces/TextEmbeddingsType",label:"TextEmbeddingsType"},{type:"doc",id:"06-api-reference/interfaces/TextToImageProps",label:"TextToImageProps"},{type:"doc",id:"06-api-reference/interfaces/TextToImageType",label:"TextToImageType"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechConfig",label:"TextToSpeechConfig"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechInput",label:"TextToSpeechInput"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechProps",label:"TextToSpeechProps"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechStreamingInput",label:"TextToSpeechStreamingInput"},{type:"doc",id:"06-api-reference/interfaces/TextToSpeechType",label:"TextToSpeechType"},{type:"doc",id:"06-api-reference/interfaces/TokenizerProps",label:"TokenizerProps"},{type:"doc",id:"06-api-reference/interfaces/TokenizerType",label:"TokenizerType"},{type:"doc",id:"06-api-reference/interfaces/ToolCall",label:"ToolCall"},{type:"doc",id:"06-api-reference/interfaces/ToolsConfig",label:"ToolsConfig"},{type:"doc",id:"06-api-reference/interfaces/TranscriptionResult",label:"TranscriptionResult"},{type:"doc",id:"06-api-reference/interfaces/TranscriptionSegment",label:"TranscriptionSegment"},{type:"doc",id:"06-api-reference/interfaces/VADProps",label:"VADProps"},{type:"doc",id:"06-api-reference/interfaces/VADType",label:"VADType"},{type:"doc",id:"06-api-reference/interfaces/VerticalOCRProps",label:"VerticalOCRProps"},{type:"doc",id:"06-api-reference/interfaces/VoiceConfig",label:"VoiceConfig"},{type:"doc",id:"06-api-reference/interfaces/Word",label:"Word"},{type:"doc",id:"06-api-reference/type-aliases/LabelEnum",label:"LabelEnum"},{type:"doc",id:"06-api-reference/type-aliases/LLMTool",label:"LLMTool"},{type:"doc",id:"06-api-reference/type-aliases/MessageRole",label:"MessageRole"},{type:"doc",id:"06-api-reference/type-aliases/ModelNameOf",label:"ModelNameOf"},{type:"doc",id:"06-api-reference/type-aliases/ObjectDetectionConfig",label:"ObjectDetectionConfig"},{type:"doc",id:"06-api-reference/type-aliases/ObjectDetectionLabels",label:"ObjectDetectionLabels"},{type:"doc",id:"06-api-reference/type-aliases/ObjectDetectionModelName",label:"ObjectDetectionModelName"},{type:"doc",id:"06-api-reference/type-aliases/ObjectDetectionModelSources",label:"ObjectDetectionModelSources"},{type:"doc",id:"06-api-reference/type-aliases/OCRLanguage",label:"OCRLanguage"},{type:"doc",id:"06-api-reference/type-aliases/ResourceSource",label:"ResourceSource"},{type:"doc",id:"06-api-reference/type-aliases/SegmentationLabels",label:"SegmentationLabels"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationConfig",label:"SemanticSegmentationConfig"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationModelName",label:"SemanticSegmentationModelName"},{type:"doc",id:"06-api-reference/type-aliases/SemanticSegmentationModelSources",label:"SemanticSegmentationModelSources"},{type:"doc",id:"06-api-reference/type-aliases/SpeechToTextLanguage",label:"SpeechToTextLanguage"},{type:"doc",id:"06-api-reference/type-aliases/TensorBuffer",label:"TensorBuffer"},{type:"doc",id:"06-api-reference/type-aliases/TextToSpeechLanguage",label:"TextToSpeechLanguage"},{type:"doc",id:"06-api-reference/type-aliases/Triple",label:"Triple"},{type:"doc",id:"06-api-reference/variables/SPECIAL_TOKENS",label:"SPECIAL_TOKENS"}]},{type:"category",label:"Typescript API",items:[{type:"doc",id:"06-api-reference/classes/ClassificationModule",label:"ClassificationModule"},{type:"doc",id:"06-api-reference/classes/ExecutorchModule",label:"ExecutorchModule"},{type:"doc",id:"06-api-reference/classes/ImageEmbeddingsModule",label:"ImageEmbeddingsModule"},{type:"doc",id:"06-api-reference/classes/LLMModule",label:"LLMModule"},{type:"doc",id:"06-api-reference/classes/ObjectDetectionModule",label:"ObjectDetectionModule"},{type:"doc",id:"06-api-reference/classes/OCRModule",label:"OCRModule"},{type:"doc",id:"06-api-reference/classes/SemanticSegmentationModule",label:"SemanticSegmentationModule"},{type:"doc",id:"06-api-reference/classes/SpeechToTextModule",label:"SpeechToTextModule"},{type:"doc",id:"06-api-reference/classes/StyleTransferModule",label:"StyleTransferModule"},{type:"doc",id:"06-api-reference/classes/TextEmbeddingsModule",label:"TextEmbeddingsModule"},{type:"doc",id:"06-api-reference/classes/TextToImageModule",label:"TextToImageModule"},{type:"doc",id:"06-api-reference/classes/TextToSpeechModule",label:"TextToSpeechModule"},{type:"doc",id:"06-api-reference/classes/TokenizerModule",label:"TokenizerModule"},{type:"doc",id:"06-api-reference/classes/VADModule",label:"VADModule"},{type:"doc",id:"06-api-reference/classes/VerticalOCRModule",label:"VerticalOCRModule"}]},{type:"category",label:"Utilities - General",items:[{type:"category",label:"ResourceFetcherUtils",items:[{type:"category",label:"Functions",items:[{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/calculateDownloadProgress",label:"calculateDownloadProgress"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/getFilenameFromUri",label:"getFilenameFromUri"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/hashObject",label:"hashObject"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/removeFilePrefix",label:"removeFilePrefix"},{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/functions/triggerHuggingFaceDownloadCounter",label:"triggerHuggingFaceDownloadCounter"}]}],link:{type:"doc",id:"06-api-reference/react-native-executorch/namespaces/ResourceFetcherUtils/index"}},{type:"doc",id:"06-api-reference/classes/ResourceFetcher",label:"ResourceFetcher"},{type:"doc",id:"06-api-reference/interfaces/ExecutorchConfig",label:"ExecutorchConfig"},{type:"doc",id:"06-api-reference/interfaces/ResourceFetcherAdapter",label:"ResourceFetcherAdapter"},{type:"doc",id:"06-api-reference/functions/cleanupExecutorch",label:"cleanupExecutorch"},{type:"doc",id:"06-api-reference/functions/initExecutorch",label:"initExecutorch"}]},{type:"category",label:"Utilities - LLM",items:[{type:"doc",id:"06-api-reference/variables/DEFAULT_CHAT_CONFIG",label:"DEFAULT_CHAT_CONFIG"},{type:"doc",id:"06-api-reference/variables/DEFAULT_CONTEXT_BUFFER_TOKENS",label:"DEFAULT_CONTEXT_BUFFER_TOKENS"},{type:"doc",id:"06-api-reference/variables/DEFAULT_MESSAGE_HISTORY",label:"DEFAULT_MESSAGE_HISTORY"},{type:"doc",id:"06-api-reference/variables/DEFAULT_SYSTEM_PROMPT",label:"DEFAULT_SYSTEM_PROMPT"},{type:"doc",id:"06-api-reference/variables/parseToolCall",label:"parseToolCall"},{type:"doc",id:"06-api-reference/functions/DEFAULT_STRUCTURED_OUTPUT_PROMPT",label:"DEFAULT_STRUCTURED_OUTPUT_PROMPT"},{type:"doc",id:"06-api-reference/functions/fixAndValidateStructuredOutput",label:"fixAndValidateStructuredOutput"},{type:"doc",id:"06-api-reference/functions/getStructuredOutputPrompt",label:"getStructuredOutputPrompt"}]},{type:"category",label:"Utils",items:[{type:"doc",id:"06-api-reference/classes/MessageCountContextStrategy",label:"MessageCountContextStrategy"},{type:"doc",id:"06-api-reference/classes/NoopContextStrategy",label:"NoopContextStrategy"},{type:"doc",id:"06-api-reference/classes/SlidingWindowContextStrategy",label:"SlidingWindowContextStrategy"}]}]};
module.exports = typedocSidebar.items;
\ No newline at end of file
diff --git a/docs/docs/06-api-reference/variables/ALL_MINILM_L6_V2.md b/docs/docs/06-api-reference/variables/ALL_MINILM_L6_V2.md
index 7bd9749d6..dfd9f2891 100644
--- a/docs/docs/06-api-reference/variables/ALL_MINILM_L6_V2.md
+++ b/docs/docs/06-api-reference/variables/ALL_MINILM_L6_V2.md
@@ -2,7 +2,7 @@
> `const` **ALL_MINILM_L6_V2**: `object`
-Defined in: [constants/modelUrls.ts:685](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L685)
+Defined in: [constants/modelUrls.ts:695](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L695)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/ALL_MPNET_BASE_V2.md b/docs/docs/06-api-reference/variables/ALL_MPNET_BASE_V2.md
index 64af2c816..cb51bee2d 100644
--- a/docs/docs/06-api-reference/variables/ALL_MPNET_BASE_V2.md
+++ b/docs/docs/06-api-reference/variables/ALL_MPNET_BASE_V2.md
@@ -2,7 +2,7 @@
> `const` **ALL_MPNET_BASE_V2**: `object`
-Defined in: [constants/modelUrls.ts:693](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L693)
+Defined in: [constants/modelUrls.ts:703](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L703)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_256.md b/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_256.md
index b52fa6de3..bd2a89eba 100644
--- a/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_256.md
+++ b/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_256.md
@@ -2,7 +2,7 @@
> `const` **BK_SDM_TINY_VPRED_256**: `object`
-Defined in: [constants/modelUrls.ts:738](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L738)
+Defined in: [constants/modelUrls.ts:748](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L748)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_512.md b/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_512.md
index 68be8ecdf..ec21972f1 100644
--- a/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_512.md
+++ b/docs/docs/06-api-reference/variables/BK_SDM_TINY_VPRED_512.md
@@ -2,7 +2,7 @@
> `const` **BK_SDM_TINY_VPRED_512**: `object`
-Defined in: [constants/modelUrls.ts:727](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L727)
+Defined in: [constants/modelUrls.ts:737](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L737)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE.md b/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE.md
index c186e0d7b..0dc8afce7 100644
--- a/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE.md
+++ b/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_IMAGE.md
@@ -2,7 +2,7 @@
> `const` **CLIP_VIT_BASE_PATCH32_IMAGE**: `object`
-Defined in: [constants/modelUrls.ts:666](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L666)
+Defined in: [constants/modelUrls.ts:676](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L676)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT.md b/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT.md
index 4f769e47b..94fc574b3 100644
--- a/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT.md
+++ b/docs/docs/06-api-reference/variables/CLIP_VIT_BASE_PATCH32_TEXT.md
@@ -2,7 +2,7 @@
> `const` **CLIP_VIT_BASE_PATCH32_TEXT**: `object`
-Defined in: [constants/modelUrls.ts:717](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L717)
+Defined in: [constants/modelUrls.ts:727](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L727)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE.md
index 3b4b97699..e2154c4ac 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_MOBILENET_V3_LARGE**: `object`
-Defined in: [constants/modelUrls.ts:574](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L574)
+Defined in: [constants/modelUrls.ts:584](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L584)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED.md
index bf0da7ea7..341d3f629 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_MOBILENET_V3_LARGE_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:622](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L622)
+Defined in: [constants/modelUrls.ts:632](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L632)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101.md
index 9b0294dff..e40e1170b 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_RESNET101**: `object`
-Defined in: [constants/modelUrls.ts:566](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L566)
+Defined in: [constants/modelUrls.ts:576](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L576)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED.md
index b2ce1f2d5..4d7cf7498 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET101_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_RESNET101_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:614](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L614)
+Defined in: [constants/modelUrls.ts:624](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L624)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50.md
index 55ed0b222..b71326026 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_RESNET50**: `object`
-Defined in: [constants/modelUrls.ts:558](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L558)
+Defined in: [constants/modelUrls.ts:568](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L568)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED.md b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED.md
index 552e3ec18..c82d5bf26 100644
--- a/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/DEEPLAB_V3_RESNET50_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **DEEPLAB_V3_RESNET50_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:606](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L606)
+Defined in: [constants/modelUrls.ts:616](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L616)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/FCN_RESNET101.md b/docs/docs/06-api-reference/variables/FCN_RESNET101.md
index 83529c803..07f4783d3 100644
--- a/docs/docs/06-api-reference/variables/FCN_RESNET101.md
+++ b/docs/docs/06-api-reference/variables/FCN_RESNET101.md
@@ -2,7 +2,7 @@
> `const` **FCN_RESNET101**: `object`
-Defined in: [constants/modelUrls.ts:598](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L598)
+Defined in: [constants/modelUrls.ts:608](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L608)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/FCN_RESNET101_QUANTIZED.md b/docs/docs/06-api-reference/variables/FCN_RESNET101_QUANTIZED.md
index 11a0bc65d..377dc667a 100644
--- a/docs/docs/06-api-reference/variables/FCN_RESNET101_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/FCN_RESNET101_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **FCN_RESNET101_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:646](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L646)
+Defined in: [constants/modelUrls.ts:656](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L656)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/FCN_RESNET50.md b/docs/docs/06-api-reference/variables/FCN_RESNET50.md
index d47b40a2b..2546001f3 100644
--- a/docs/docs/06-api-reference/variables/FCN_RESNET50.md
+++ b/docs/docs/06-api-reference/variables/FCN_RESNET50.md
@@ -2,7 +2,7 @@
> `const` **FCN_RESNET50**: `object`
-Defined in: [constants/modelUrls.ts:590](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L590)
+Defined in: [constants/modelUrls.ts:600](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L600)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/FCN_RESNET50_QUANTIZED.md b/docs/docs/06-api-reference/variables/FCN_RESNET50_QUANTIZED.md
index 3a1acaaf9..b24a1757e 100644
--- a/docs/docs/06-api-reference/variables/FCN_RESNET50_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/FCN_RESNET50_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **FCN_RESNET50_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:638](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L638)
+Defined in: [constants/modelUrls.ts:648](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L648)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/FSMN_VAD.md b/docs/docs/06-api-reference/variables/FSMN_VAD.md
index f8a961a7b..646e2dbae 100644
--- a/docs/docs/06-api-reference/variables/FSMN_VAD.md
+++ b/docs/docs/06-api-reference/variables/FSMN_VAD.md
@@ -2,7 +2,7 @@
> `const` **FSMN_VAD**: `object`
-Defined in: [constants/modelUrls.ts:752](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L752)
+Defined in: [constants/modelUrls.ts:762](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L762)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/IMAGENET1K_MEAN.md b/docs/docs/06-api-reference/variables/IMAGENET1K_MEAN.md
new file mode 100644
index 000000000..6bd352c29
--- /dev/null
+++ b/docs/docs/06-api-reference/variables/IMAGENET1K_MEAN.md
@@ -0,0 +1,5 @@
+# Variable: IMAGENET1K_MEAN
+
+> `const` **IMAGENET1K_MEAN**: [`Triple`](../type-aliases/Triple.md)\<`number`\>
+
+Defined in: [constants/commonVision.ts:3](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L3)
diff --git a/docs/docs/06-api-reference/variables/IMAGENET1K_STD.md b/docs/docs/06-api-reference/variables/IMAGENET1K_STD.md
new file mode 100644
index 000000000..4d7e72b62
--- /dev/null
+++ b/docs/docs/06-api-reference/variables/IMAGENET1K_STD.md
@@ -0,0 +1,5 @@
+# Variable: IMAGENET1K_STD
+
+> `const` **IMAGENET1K_STD**: [`Triple`](../type-aliases/Triple.md)\<`number`\>
+
+Defined in: [constants/commonVision.ts:4](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/commonVision.ts#L4)
diff --git a/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE.md b/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE.md
index 93518b723..1ad79ff02 100644
--- a/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE.md
+++ b/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE.md
@@ -2,7 +2,7 @@
> `const` **LRASPP_MOBILENET_V3_LARGE**: `object`
-Defined in: [constants/modelUrls.ts:582](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L582)
+Defined in: [constants/modelUrls.ts:592](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L592)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED.md b/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED.md
index a95ad31b5..0f5e16f41 100644
--- a/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/LRASPP_MOBILENET_V3_LARGE_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **LRASPP_MOBILENET_V3_LARGE_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:630](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L630)
+Defined in: [constants/modelUrls.ts:640](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L640)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1.md b/docs/docs/06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1.md
index 5bde1d509..a7378ea8a 100644
--- a/docs/docs/06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1.md
+++ b/docs/docs/06-api-reference/variables/MULTI_QA_MINILM_L6_COS_V1.md
@@ -2,7 +2,7 @@
> `const` **MULTI_QA_MINILM_L6_COS_V1**: `object`
-Defined in: [constants/modelUrls.ts:701](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L701)
+Defined in: [constants/modelUrls.ts:711](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L711)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1.md b/docs/docs/06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1.md
index 7ab08cb1d..0c22cb2b9 100644
--- a/docs/docs/06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1.md
+++ b/docs/docs/06-api-reference/variables/MULTI_QA_MPNET_BASE_DOT_V1.md
@@ -2,7 +2,7 @@
> `const` **MULTI_QA_MPNET_BASE_DOT_V1**: `object`
-Defined in: [constants/modelUrls.ts:709](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L709)
+Defined in: [constants/modelUrls.ts:719](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L719)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/RF_DETR_NANO.md b/docs/docs/06-api-reference/variables/RF_DETR_NANO.md
new file mode 100644
index 000000000..7a27c149d
--- /dev/null
+++ b/docs/docs/06-api-reference/variables/RF_DETR_NANO.md
@@ -0,0 +1,15 @@
+# Variable: RF_DETR_NANO
+
+> `const` **RF_DETR_NANO**: `object`
+
+Defined in: [constants/modelUrls.ts:402](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L402)
+
+## Type Declaration
+
+### modelName
+
+> `readonly` **modelName**: `"rf-detr-nano"` = `'rf-detr-nano'`
+
+### modelSource
+
+> `readonly` **modelSource**: `"https://huggingface.co/software-mansion/react-native-executorch-rfdetr-nano-detector/resolve/v0.8.0/rfdetr_detector.pte"` = `RF_DETR_NANO_MODEL`
diff --git a/docs/docs/06-api-reference/variables/SELFIE_SEGMENTATION.md b/docs/docs/06-api-reference/variables/SELFIE_SEGMENTATION.md
index 5ecb1b70d..bc6f0eeef 100644
--- a/docs/docs/06-api-reference/variables/SELFIE_SEGMENTATION.md
+++ b/docs/docs/06-api-reference/variables/SELFIE_SEGMENTATION.md
@@ -2,7 +2,7 @@
> `const` **SELFIE_SEGMENTATION**: `object`
-Defined in: [constants/modelUrls.ts:655](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L655)
+Defined in: [constants/modelUrls.ts:665](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L665)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE.md b/docs/docs/06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE.md
index 3c7e92612..4c28e4ff4 100644
--- a/docs/docs/06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE.md
+++ b/docs/docs/06-api-reference/variables/SSDLITE_320_MOBILENET_V3_LARGE.md
@@ -2,10 +2,14 @@
> `const` **SSDLITE_320_MOBILENET_V3_LARGE**: `object`
-Defined in: [constants/modelUrls.ts:393](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L393)
+Defined in: [constants/modelUrls.ts:394](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L394)
## Type Declaration
+### modelName
+
+> `readonly` **modelName**: `"ssdlite-320-mobilenet-v3-large"` = `'ssdlite-320-mobilenet-v3-large'`
+
### modelSource
-> **modelSource**: `string` = `SSDLITE_320_MOBILENET_V3_LARGE_MODEL`
+> `readonly` **modelSource**: `"https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/resolve/v0.7.0/ssdlite320-mobilenetv3-large.pte"` = `SSDLITE_320_MOBILENET_V3_LARGE_MODEL`
diff --git a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_CANDY.md b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_CANDY.md
index 1816ba019..c82979642 100644
--- a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_CANDY.md
+++ b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_CANDY.md
@@ -2,7 +2,7 @@
> `const` **STYLE_TRANSFER_CANDY**: `object`
-Defined in: [constants/modelUrls.ts:418](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L418)
+Defined in: [constants/modelUrls.ts:428](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L428)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_MOSAIC.md b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_MOSAIC.md
index a0e662ebf..f57bb8859 100644
--- a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_MOSAIC.md
+++ b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_MOSAIC.md
@@ -2,7 +2,7 @@
> `const` **STYLE_TRANSFER_MOSAIC**: `object`
-Defined in: [constants/modelUrls.ts:425](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L425)
+Defined in: [constants/modelUrls.ts:435](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L435)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS.md b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS.md
index 495456d46..8cf07fd19 100644
--- a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS.md
+++ b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_RAIN_PRINCESS.md
@@ -2,7 +2,7 @@
> `const` **STYLE_TRANSFER_RAIN_PRINCESS**: `object`
-Defined in: [constants/modelUrls.ts:432](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L432)
+Defined in: [constants/modelUrls.ts:442](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L442)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_UDNIE.md b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_UDNIE.md
index 9a75aa0b4..20cd7cb3b 100644
--- a/docs/docs/06-api-reference/variables/STYLE_TRANSFER_UDNIE.md
+++ b/docs/docs/06-api-reference/variables/STYLE_TRANSFER_UDNIE.md
@@ -2,7 +2,7 @@
> `const` **STYLE_TRANSFER_UDNIE**: `object`
-Defined in: [constants/modelUrls.ts:439](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L439)
+Defined in: [constants/modelUrls.ts:449](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L449)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_BASE.md b/docs/docs/06-api-reference/variables/WHISPER_BASE.md
index 9c3ddcf7c..c48856a93 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_BASE.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_BASE.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_BASE**: `object`
-Defined in: [constants/modelUrls.ts:524](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L524)
+Defined in: [constants/modelUrls.ts:534](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L534)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_BASE_EN.md b/docs/docs/06-api-reference/variables/WHISPER_BASE_EN.md
index 6e3d13151..ab44fad16 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_BASE_EN.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_BASE_EN.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_BASE_EN**: `object`
-Defined in: [constants/modelUrls.ts:494](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L494)
+Defined in: [constants/modelUrls.ts:504](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L504)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_SMALL.md b/docs/docs/06-api-reference/variables/WHISPER_SMALL.md
index 73af6e193..dde353ccc 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_SMALL.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_SMALL.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_SMALL**: `object`
-Defined in: [constants/modelUrls.ts:534](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L534)
+Defined in: [constants/modelUrls.ts:544](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L544)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_SMALL_EN.md b/docs/docs/06-api-reference/variables/WHISPER_SMALL_EN.md
index d3efa2af5..b832832c3 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_SMALL_EN.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_SMALL_EN.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_SMALL_EN**: `object`
-Defined in: [constants/modelUrls.ts:504](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L504)
+Defined in: [constants/modelUrls.ts:514](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L514)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_TINY.md b/docs/docs/06-api-reference/variables/WHISPER_TINY.md
index 1922e8578..27f0abd75 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_TINY.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_TINY.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_TINY**: `object`
-Defined in: [constants/modelUrls.ts:514](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L514)
+Defined in: [constants/modelUrls.ts:524](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L524)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_TINY_EN.md b/docs/docs/06-api-reference/variables/WHISPER_TINY_EN.md
index 6d37a6f8c..b54b13ba8 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_TINY_EN.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_TINY_EN.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_TINY_EN**: `object`
-Defined in: [constants/modelUrls.ts:474](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L474)
+Defined in: [constants/modelUrls.ts:484](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L484)
## Type Declaration
diff --git a/docs/docs/06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED.md b/docs/docs/06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED.md
index f0e86324e..29266d1b7 100644
--- a/docs/docs/06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED.md
+++ b/docs/docs/06-api-reference/variables/WHISPER_TINY_EN_QUANTIZED.md
@@ -2,7 +2,7 @@
> `const` **WHISPER_TINY_EN_QUANTIZED**: `object`
-Defined in: [constants/modelUrls.ts:484](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L484)
+Defined in: [constants/modelUrls.ts:494](https://github.com/software-mansion/react-native-executorch/blob/main/packages/react-native-executorch/src/constants/modelUrls.ts#L494)
## Type Declaration
diff --git a/packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h b/packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h
index 7b97108b9..187bb2792 100644
--- a/packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h
+++ b/packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h
@@ -15,7 +15,6 @@
#include
#include
-#include
#include
#include
#include
@@ -443,9 +442,7 @@ inline jsi::Value getJsiValue(
detection.setProperty(runtime, "bbox", bbox);
detection.setProperty(
runtime, "label",
- jsi::String::createFromAscii(
- runtime, models::object_detection::constants::kCocoLablesMap.at(
- detections[i].label)));
+ jsi::String::createFromUtf8(runtime, detections[i].label));
detection.setProperty(runtime, "score", detections[i].score);
array.setValueAtIndex(runtime, i, detection);
}
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Constants.h b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Constants.h
index 555a5977c..95d58d596 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Constants.h
+++ b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Constants.h
@@ -1,41 +1,5 @@
#pragma once
-#include
-#include
-
namespace rnexecutorch::models::object_detection::constants {
-inline constexpr float IOU_THRESHOLD = 0.55;
-
-inline const std::unordered_map kCocoLablesMap = {
- {1, "PERSON"}, {2, "BICYCLE"}, {3, "CAR"},
- {4, "MOTORCYCLE"}, {5, "AIRPLANE"}, {6, "BUS"},
- {7, "TRAIN"}, {8, "TRUCK"}, {9, "BOAT"},
- {10, "TRAFFIC_LIGHT"}, {11, "FIRE_HYDRANT"}, {12, "STREET_SIGN"},
- {13, "STOP_SIGN"}, {14, "PARKING"}, {15, "BENCH"},
- {16, "BIRD"}, {17, "CAT"}, {18, "DOG"},
- {19, "HORSE"}, {20, "SHEEP"}, {21, "COW"},
- {22, "ELEPHANT"}, {23, "BEAR"}, {24, "ZEBRA"},
- {25, "GIRAFFE"}, {26, "HAT"}, {27, "BACKPACK"},
- {28, "UMBRELLA"}, {29, "SHOE"}, {30, "EYE"},
- {31, "HANDBAG"}, {32, "TIE"}, {33, "SUITCASE"},
- {34, "FRISBEE"}, {35, "SKIS"}, {36, "SNOWBOARD"},
- {37, "SPORTS"}, {38, "KITE"}, {39, "BASEBALL"},
- {40, "BASEBALL"}, {41, "SKATEBOARD"}, {42, "SURFBOARD"},
- {43, "TENNIS_RACKET"}, {44, "BOTTLE"}, {45, "PLATE"},
- {46, "WINE_GLASS"}, {47, "CUP"}, {48, "FORK"},
- {49, "KNIFE"}, {50, "SPOON"}, {51, "BOWL"},
- {52, "BANANA"}, {53, "APPLE"}, {54, "SANDWICH"},
- {55, "ORANGE"}, {56, "BROCCOLI"}, {57, "CARROT"},
- {58, "HOT_DOG"}, {59, "PIZZA"}, {60, "DONUT"},
- {61, "CAKE"}, {62, "CHAIR"}, {63, "COUCH"},
- {64, "POTTED_PLANT"}, {65, "BED"}, {66, "MIRROR"},
- {67, "DINING_TABLE"}, {68, "WINDOW"}, {69, "DESK"},
- {70, "TOILET"}, {71, "DOOR"}, {72, "TV"},
- {73, "LAPTOP"}, {74, "MOUSE"}, {75, "REMOTE"},
- {76, "KEYBOARD"}, {77, "CELL_PHONE"}, {78, "MICROWAVE"},
- {79, "OVEN"}, {80, "TOASTER"}, {81, "SINK"},
- {82, "REFRIGERATOR"}, {83, "BLENDER"}, {84, "BOOK"},
- {85, "CLOCK"}, {86, "VASE"}, {87, "SCISSORS"},
- {88, "TEDDY_BEAR"}, {89, "HAIR_DRIER"}, {90, "TOOTHBRUSH"},
- {91, "HAIR_BRUSH"}};
+inline constexpr float IOU_THRESHOLD = 0.55f;
} // namespace rnexecutorch::models::object_detection::constants
\ No newline at end of file
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.cpp b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.cpp
index 2670cf9dd..1dad1a61a 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.cpp
@@ -10,11 +10,13 @@
namespace rnexecutorch::models::object_detection {
ObjectDetection::ObjectDetection(
- const std::string &modelSource,
+ const std::string &modelSource, std::vector normMean,
+ std::vector normStd, std::vector labelNames,
std::shared_ptr callInvoker)
- : VisionModel(modelSource, callInvoker) {
+ : VisionModel(modelSource, callInvoker),
+ labelNames_(std::move(labelNames)) {
auto inputTensors = getAllInputShapes();
- if (inputTensors.size() == 0) {
+ if (inputTensors.empty()) {
throw RnExecutorchError(RnExecutorchErrorCode::UnexpectedNumInputs,
"Model seems to not take any input tensors.");
}
@@ -30,6 +32,18 @@ ObjectDetection::ObjectDetection(
}
modelImageSize = cv::Size(modelInputShape[modelInputShape.size() - 1],
modelInputShape[modelInputShape.size() - 2]);
+ if (normMean.size() == 3) {
+ normMean_ = cv::Scalar(normMean[0], normMean[1], normMean[2]);
+ } else if (!normMean.empty()) {
+ log(LOG_LEVEL::Warn,
+ "normMean must have 3 elements — ignoring provided value.");
+ }
+ if (normStd.size() == 3) {
+ normStd_ = cv::Scalar(normStd[0], normStd[1], normStd[2]);
+ } else if (!normStd.empty()) {
+ log(LOG_LEVEL::Warn,
+ "normStd must have 3 elements — ignoring provided value.");
+ }
}
cv::Mat ObjectDetection::preprocessFrame(const cv::Mat &frame) const {
@@ -97,8 +111,15 @@ ObjectDetection::postprocess(const std::vector &tensors,
float y1 = bboxes[i * 4 + 1] * heightRatio;
float x2 = bboxes[i * 4 + 2] * widthRatio;
float y2 = bboxes[i * 4 + 3] * heightRatio;
- detections.emplace_back(x1, y1, x2, y2, static_cast(labels[i]),
- scores[i]);
+ auto labelIdx = static_cast(labels[i]);
+ if (labelIdx >= labelNames_.size()) {
+ throw RnExecutorchError(
+ RnExecutorchErrorCode::InvalidConfig,
+ "Model output class index " + std::to_string(labelIdx) +
+ " exceeds labelNames size " + std::to_string(labelNames_.size()) +
+ ". Ensure the labelMap covers all model output classes.");
+ }
+ detections.emplace_back(x1, y1, x2, y2, labelNames_[labelIdx], scores[i]);
}
return utils::nonMaxSuppression(detections);
@@ -117,7 +138,10 @@ ObjectDetection::runInference(cv::Mat image, double detectionThreshold) {
const std::vector tensorDims = getAllInputShapes()[0];
auto inputTensor =
- image_processing::getTensorFromMatrix(tensorDims, preprocessed);
+ (normMean_ && normStd_)
+ ? image_processing::getTensorFromMatrix(tensorDims, preprocessed,
+ *normMean_, *normStd_)
+ : image_processing::getTensorFromMatrix(tensorDims, preprocessed);
auto forwardResult = BaseModel::forward(inputTensor);
if (!forwardResult.ok()) {
@@ -157,4 +181,4 @@ ObjectDetection::generateFromPixels(JSTensorViewIn pixelData,
return runInference(image, detectionThreshold);
}
-} // namespace rnexecutorch::models::object_detection
\ No newline at end of file
+} // namespace rnexecutorch::models::object_detection
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.h b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.h
index d32eea95e..f1159d88e 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.h
+++ b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.h
@@ -1,10 +1,9 @@
#pragma once
-#include
-
#include
#include
#include
+#include
#include "Types.h"
#include "rnexecutorch/metaprogramming/ConstructorHelpers.h"
@@ -16,10 +15,57 @@ namespace models::object_detection {
using executorch::extension::TensorPtr;
using executorch::runtime::EValue;
+/**
+ * @brief Object detection model that detects and localises objects in images.
+ *
+ * Wraps an ExecuTorch model and exposes a single @ref generate call that
+ * preprocesses an input image, runs the forward pass, and returns a filtered,
+ * non-max-suppressed list of @ref types::Detection results.
+ */
class ObjectDetection : public VisionModel {
public:
- ObjectDetection(const std::string &modelSource,
+ /**
+ * @brief Constructs an ObjectDetection model and loads it from disk.
+ *
+ * @param modelSource Path to the `.pte` model file.
+ * @param normMean Per-channel mean values used for input normalisation
+ * (must be exactly 3 elements, or empty to skip).
+ * @param normStd Per-channel standard-deviation values used for input
+ * normalisation (must be exactly 3 elements, or empty to
+ * skip).
+ * @param labelNames Ordered list of class label strings. Index @c i must
+ * correspond to class index @c i produced by the model.
+ * This is a runtime value passed from JS side,
+ * dependant the model. The user can pass his own, custom
+ * labels.
+ * @param callInvoker JSI call invoker used to marshal results back to JS.
+ *
+ * @throws RnExecutorchError if the model cannot be loaded or its input shape
+ * is incompatible.
+ */
+ ObjectDetection(const std::string &modelSource, std::vector normMean,
+ std::vector normStd,
+ std::vector labelNames,
std::shared_ptr callInvoker);
+
+ /**
+ * @brief Runs object detection on a single image.
+ *
+ * Preprocesses the image, executes the model's forward pass, and returns
+ * all detections whose confidence score meets @p detectionThreshold after
+ * non-maximum suppression.
+ *
+ * @param imageSource URI or file path of the input image.
+ * @param detectionThreshold Minimum confidence score in (0, 1] for a
+ * detection to be included in the output.
+ *
+ * @return A vector of @ref types::Detection objects with bounding boxes,
+ * label strings (resolved via the label names passed to the
+ * constructor), and confidence scores.
+ *
+ * @throws RnExecutorchError if the image cannot be read or the forward pass
+ * fails.
+ */
[[nodiscard("Registered non-void function")]] std::vector
generateFromString(std::string imageSource, double detectionThreshold);
[[nodiscard("Registered non-void function")]] std::vector
@@ -34,14 +80,42 @@ class ObjectDetection : public VisionModel {
cv::Mat preprocessFrame(const cv::Mat &frame) const override;
private:
+ /**
+ * @brief Decodes raw model output tensors into a list of detections.
+ *
+ * @param tensors Raw EValue outputs from the forward pass
+ * (bboxes at index 0, scores at index 1,
+ * labels at index 2).
+ * @param originalSize Original image dimensions used to scale
+ * bounding boxes back to input coordinates.
+ * @param detectionThreshold Confidence threshold below which detections
+ * are discarded.
+ *
+ * @return Non-max-suppressed detections above the threshold.
+ *
+ * @throws RnExecutorchError if the model outputs a class index that exceeds
+ * the size of @ref labelNames_.
+ */
std::vector postprocess(const std::vector &tensors,
cv::Size originalSize,
double detectionThreshold);
+ /// Expected input image dimensions derived from the model's input shape.
cv::Size modelImageSize{0, 0};
+
+ /// Optional per-channel mean for input normalisation (set in constructor).
+ std::optional normMean_;
+
+ /// Optional per-channel standard deviation for input normalisation.
+ std::optional normStd_;
+
+ /// Ordered label strings mapping class indices to human-readable names.
+ std::vector labelNames_;
};
} // namespace models::object_detection
REGISTER_CONSTRUCTOR(models::object_detection::ObjectDetection, std::string,
+ std::vector, std::vector,
+ std::vector,
std::shared_ptr);
-} // namespace rnexecutorch
\ No newline at end of file
+} // namespace rnexecutorch
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Types.h b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Types.h
index 58c910a5c..075ae91e0 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Types.h
+++ b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Types.h
@@ -1,12 +1,14 @@
#pragma once
+#include
+
namespace rnexecutorch::models::object_detection::types {
struct Detection {
float x1;
float y1;
float x2;
float y2;
- int label;
+ std::string label;
float score;
};
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Utils.cpp b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Utils.cpp
index 1e32dcc29..198fe1fe5 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Utils.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/models/object_detection/Utils.cpp
@@ -35,7 +35,7 @@ nonMaxSuppression(std::vector detections) {
std::vector result;
// Apply NMS for each label
for (size_t i = 0; i < detections.size();) {
- float currentLabel = detections[i].label;
+ std::string currentLabel = detections[i].label;
std::vector labelDetections;
while (i < detections.size() && detections[i].label == currentLabel) {
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.cpp b/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.cpp
index 740e78d43..fc6a04ebc 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.cpp
@@ -11,27 +11,21 @@
namespace rnexecutorch::models::semantic_segmentation {
-BaseSemanticSegmentation::BaseSemanticSegmentation(
- const std::string &modelSource,
- std::shared_ptr callInvoker)
- : BaseModel(modelSource, callInvoker) {
- initModelImageSize();
-}
-
BaseSemanticSegmentation::BaseSemanticSegmentation(
const std::string &modelSource, std::vector normMean,
- std::vector normStd, std::shared_ptr callInvoker)
- : BaseModel(modelSource, callInvoker) {
+ std::vector normStd, std::vector allClasses,
+ std::shared_ptr callInvoker)
+ : BaseModel(modelSource, callInvoker), allClasses_(std::move(allClasses)) {
initModelImageSize();
if (normMean.size() == 3) {
normMean_ = cv::Scalar(normMean[0], normMean[1], normMean[2]);
- } else {
+ } else if (!normMean.empty()) {
log(LOG_LEVEL::Warn,
"normMean must have 3 elements — ignoring provided value.");
}
if (normStd.size() == 3) {
normStd_ = cv::Scalar(normStd[0], normStd[1], normStd[2]);
- } else {
+ } else if (!normStd.empty()) {
log(LOG_LEVEL::Warn,
"normStd must have 3 elements — ignoring provided value.");
}
@@ -64,7 +58,7 @@ TensorPtr BaseSemanticSegmentation::preprocess(const std::string &imageSource,
}
std::shared_ptr BaseSemanticSegmentation::generate(
- std::string imageSource, std::vector allClasses,
+ std::string imageSource,
std::set> classesOfInterest, bool resize) {
cv::Size originalSize;
@@ -78,7 +72,7 @@ std::shared_ptr BaseSemanticSegmentation::generate(
"Ensure the model input is correct.");
}
- return postprocess(forwardResult->at(0).toTensor(), originalSize, allClasses,
+ return postprocess(forwardResult->at(0).toTensor(), originalSize, allClasses_,
classesOfInterest, resize);
}
diff --git a/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.h b/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.h
index 16a9ecfe7..d39a7e5d4 100644
--- a/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.h
+++ b/packages/react-native-executorch/common/rnexecutorch/models/semantic_segmentation/BaseSemanticSegmentation.h
@@ -19,16 +19,14 @@ using executorch::extension::TensorPtr;
class BaseSemanticSegmentation : public BaseModel {
public:
- BaseSemanticSegmentation(const std::string &modelSource,
- std::shared_ptr callInvoker);
-
BaseSemanticSegmentation(const std::string &modelSource,
std::vector normMean,
std::vector normStd,
+ std::vector allClasses,
std::shared_ptr callInvoker);
[[nodiscard("Registered non-void function")]] std::shared_ptr
- generate(std::string imageSource, std::vector allClasses,
+ generate(std::string imageSource,
std::set> classesOfInterest, bool resize);
protected:
@@ -44,6 +42,7 @@ class BaseSemanticSegmentation : public BaseModel {
std::size_t numModelPixels;
std::optional normMean_;
std::optional normStd_;
+ std::vector allClasses_;
std::shared_ptr populateDictionary(
std::shared_ptr argmax,
@@ -58,5 +57,6 @@ class BaseSemanticSegmentation : public BaseModel {
REGISTER_CONSTRUCTOR(models::semantic_segmentation::BaseSemanticSegmentation,
std::string, std::vector, std::vector,
+ std::vector,
std::shared_ptr);
} // namespace rnexecutorch
diff --git a/packages/react-native-executorch/common/rnexecutorch/tests/integration/BaseModelTest.cpp b/packages/react-native-executorch/common/rnexecutorch/tests/integration/BaseModelTest.cpp
index faf21f5b5..efee033be 100644
--- a/packages/react-native-executorch/common/rnexecutorch/tests/integration/BaseModelTest.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/tests/integration/BaseModelTest.cpp
@@ -13,7 +13,7 @@ using namespace model_tests;
using executorch::runtime::EValue;
constexpr auto kValidStyleTransferModelPath =
- "style_transfer_candy_xnnpack.pte";
+ "style_transfer_candy_xnnpack_fp32.pte";
// ============================================================================
// Common tests via typed test suite
diff --git a/packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp b/packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp
index 76c838ca1..8964f2013 100644
--- a/packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp
@@ -15,6 +15,23 @@ constexpr auto kValidObjectDetectionModelPath =
constexpr auto kValidTestImagePath =
"file:///data/local/tmp/rnexecutorch_tests/test_image.jpg";
+// clang-format off
+const std::vector kCocoLabels = {
+ "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"
+};
+// clang-format on
+
// ============================================================================
// Common tests via typed test suite
// ============================================================================
@@ -23,11 +40,12 @@ template <> struct ModelTraits {
using ModelType = ObjectDetection;
static ModelType createValid() {
- return ModelType(kValidObjectDetectionModelPath, nullptr);
+ return ModelType(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
}
static ModelType createInvalid() {
- return ModelType("nonexistent.pte", nullptr);
+ return ModelType("nonexistent.pte", {}, {}, {}, nullptr);
}
static void callGenerate(ModelType &model) {
@@ -44,42 +62,49 @@ INSTANTIATE_TYPED_TEST_SUITE_P(ObjectDetection, CommonModelTest,
// Model-specific tests
// ============================================================================
TEST(ObjectDetectionGenerateTests, InvalidImagePathThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
EXPECT_THROW((void)model.generateFromString("nonexistent_image.jpg", 0.5),
RnExecutorchError);
}
TEST(ObjectDetectionGenerateTests, EmptyImagePathThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
EXPECT_THROW((void)model.generateFromString("", 0.5), RnExecutorchError);
}
TEST(ObjectDetectionGenerateTests, MalformedURIThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
EXPECT_THROW((void)model.generateFromString("not_a_valid_uri://bad", 0.5),
RnExecutorchError);
}
TEST(ObjectDetectionGenerateTests, NegativeThresholdThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
EXPECT_THROW((void)model.generateFromString(kValidTestImagePath, -0.1),
RnExecutorchError);
}
TEST(ObjectDetectionGenerateTests, ThresholdAboveOneThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
EXPECT_THROW((void)model.generateFromString(kValidTestImagePath, 1.1),
RnExecutorchError);
}
TEST(ObjectDetectionGenerateTests, ValidImageReturnsResults) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto results = model.generateFromString(kValidTestImagePath, 0.3);
EXPECT_GE(results.size(), 0u);
}
TEST(ObjectDetectionGenerateTests, HighThresholdReturnsFewerResults) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto lowThresholdResults = model.generateFromString(kValidTestImagePath, 0.1);
auto highThresholdResults =
model.generateFromString(kValidTestImagePath, 0.9);
@@ -87,7 +112,8 @@ TEST(ObjectDetectionGenerateTests, HighThresholdReturnsFewerResults) {
}
TEST(ObjectDetectionGenerateTests, DetectionsHaveValidBoundingBoxes) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto results = model.generateFromString(kValidTestImagePath, 0.3);
for (const auto &detection : results) {
@@ -99,7 +125,8 @@ TEST(ObjectDetectionGenerateTests, DetectionsHaveValidBoundingBoxes) {
}
TEST(ObjectDetectionGenerateTests, DetectionsHaveValidScores) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto results = model.generateFromString(kValidTestImagePath, 0.3);
for (const auto &detection : results) {
@@ -109,11 +136,15 @@ TEST(ObjectDetectionGenerateTests, DetectionsHaveValidScores) {
}
TEST(ObjectDetectionGenerateTests, DetectionsHaveValidLabels) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto results = model.generateFromString(kValidTestImagePath, 0.3);
for (const auto &detection : results) {
- EXPECT_GE(detection.label, 0);
+ const auto &label = detection.label;
+ EXPECT_FALSE(label.empty());
+ EXPECT_NE(std::find(kCocoLabels.begin(), kCocoLabels.end(), label),
+ kCocoLabels.end());
}
}
@@ -121,7 +152,8 @@ TEST(ObjectDetectionGenerateTests, DetectionsHaveValidLabels) {
// generateFromPixels tests
// ============================================================================
TEST(ObjectDetectionPixelTests, ValidPixelDataReturnsResults) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
constexpr int32_t width = 4, height = 4, channels = 3;
std::vector pixelData(width * height * channels, 128);
JSTensorViewIn tensorView{pixelData.data(),
@@ -132,7 +164,8 @@ TEST(ObjectDetectionPixelTests, ValidPixelDataReturnsResults) {
}
TEST(ObjectDetectionPixelTests, WrongSizesLengthThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
std::vector pixelData(16, 0);
JSTensorViewIn tensorView{
pixelData.data(), {4, 4}, executorch::aten::ScalarType::Byte};
@@ -141,7 +174,8 @@ TEST(ObjectDetectionPixelTests, WrongSizesLengthThrows) {
}
TEST(ObjectDetectionPixelTests, WrongChannelCountThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
constexpr int32_t width = 4, height = 4, channels = 4;
std::vector pixelData(width * height * channels, 0);
JSTensorViewIn tensorView{pixelData.data(),
@@ -152,7 +186,8 @@ TEST(ObjectDetectionPixelTests, WrongChannelCountThrows) {
}
TEST(ObjectDetectionPixelTests, WrongScalarTypeThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
constexpr int32_t width = 4, height = 4, channels = 3;
std::vector pixelData(width * height * channels, 0);
JSTensorViewIn tensorView{pixelData.data(),
@@ -163,7 +198,8 @@ TEST(ObjectDetectionPixelTests, WrongScalarTypeThrows) {
}
TEST(ObjectDetectionPixelTests, NegativeThresholdThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
constexpr int32_t width = 4, height = 4, channels = 3;
std::vector pixelData(width * height * channels, 128);
JSTensorViewIn tensorView{pixelData.data(),
@@ -174,7 +210,8 @@ TEST(ObjectDetectionPixelTests, NegativeThresholdThrows) {
}
TEST(ObjectDetectionPixelTests, ThresholdAboveOneThrows) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
constexpr int32_t width = 4, height = 4, channels = 3;
std::vector pixelData(width * height * channels, 128);
JSTensorViewIn tensorView{pixelData.data(),
@@ -185,7 +222,8 @@ TEST(ObjectDetectionPixelTests, ThresholdAboveOneThrows) {
}
TEST(ObjectDetectionInheritedTests, GetInputShapeWorks) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto shape = model.getInputShape("forward", 0);
EXPECT_EQ(shape.size(), 4);
EXPECT_EQ(shape[0], 1);
@@ -193,13 +231,44 @@ TEST(ObjectDetectionInheritedTests, GetInputShapeWorks) {
}
TEST(ObjectDetectionInheritedTests, GetAllInputShapesWorks) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto shapes = model.getAllInputShapes("forward");
EXPECT_FALSE(shapes.empty());
}
TEST(ObjectDetectionInheritedTests, GetMethodMetaWorks) {
- ObjectDetection model(kValidObjectDetectionModelPath, nullptr);
+ ObjectDetection model(kValidObjectDetectionModelPath, {}, {}, kCocoLabels,
+ nullptr);
auto result = model.getMethodMeta("forward");
EXPECT_TRUE(result.ok());
}
+
+// ============================================================================
+// Normalisation tests
+// ============================================================================
+TEST(ObjectDetectionNormTests, ValidNormParamsDoesntThrow) {
+ const std::vector mean = {0.485f, 0.456f, 0.406f};
+ const std::vector std = {0.229f, 0.224f, 0.225f};
+ EXPECT_NO_THROW(
+ ObjectDetection(kValidObjectDetectionModelPath, mean, std, {}, nullptr));
+}
+
+TEST(ObjectDetectionNormTests, InvalidNormMeanSizeDoesntThrow) {
+ EXPECT_NO_THROW(ObjectDetection(kValidObjectDetectionModelPath, {0.5f},
+ {0.229f, 0.224f, 0.225f}, {}, nullptr));
+}
+
+TEST(ObjectDetectionNormTests, InvalidNormStdSizeDoesntThrow) {
+ EXPECT_NO_THROW(ObjectDetection(kValidObjectDetectionModelPath,
+ {0.485f, 0.456f, 0.406f}, {0.5f}, {},
+ nullptr));
+}
+
+TEST(ObjectDetectionNormTests, ValidNormParamsGenerateSucceeds) {
+ const std::vector mean = {0.485f, 0.456f, 0.406f};
+ const std::vector std = {0.229f, 0.224f, 0.225f};
+ ObjectDetection model(kValidObjectDetectionModelPath, mean, std, kCocoLabels,
+ nullptr);
+ EXPECT_NO_THROW((void)model.generateFromString(kValidTestImagePath, 0.5));
+}
diff --git a/packages/react-native-executorch/common/rnexecutorch/tests/integration/StyleTransferTest.cpp b/packages/react-native-executorch/common/rnexecutorch/tests/integration/StyleTransferTest.cpp
index 3e6951617..d5427ce61 100644
--- a/packages/react-native-executorch/common/rnexecutorch/tests/integration/StyleTransferTest.cpp
+++ b/packages/react-native-executorch/common/rnexecutorch/tests/integration/StyleTransferTest.cpp
@@ -10,7 +10,7 @@ using namespace rnexecutorch::models::style_transfer;
using namespace model_tests;
constexpr auto kValidStyleTransferModelPath =
- "style_transfer_candy_xnnpack.pte";
+ "style_transfer_candy_xnnpack_fp32.pte";
constexpr auto kValidTestImagePath =
"file:///data/local/tmp/rnexecutorch_tests/test_image.jpg";
diff --git a/packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh b/packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh
index 360aa9d11..63d738eb3 100755
--- a/packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh
+++ b/packages/react-native-executorch/common/rnexecutorch/tests/run_tests.sh
@@ -29,7 +29,6 @@ TEST_EXECUTABLES=(
"TokenizerModuleTests"
"SpeechToTextTests"
"LLMTests"
- "ImageSegmentationTests"
"TextToImageTests"
"OCRTests"
"VerticalOCRTests"
@@ -47,7 +46,7 @@ TEST_ASSETS=(
# Models to download (format: "filename|url")
# ============================================================================
MODELS=(
- "style_transfer_candy_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/main/xnnpack/style_transfer_candy_xnnpack.pte"
+ "style_transfer_candy_xnnpack_fp32.pte|https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/main/xnnpack/style_transfer_candy_xnnpack_fp32.pte"
"efficientnet_v2_s_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s/resolve/v0.6.0/xnnpack/efficientnet_v2_s_xnnpack.pte"
"ssdlite320-mobilenetv3-large.pte|https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/resolve/v0.6.0/ssdlite320-mobilenetv3-large.pte"
"test_image.jpg|https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/1200px-Cat_November_2010-1a.jpg"
@@ -55,8 +54,8 @@ MODELS=(
"all-MiniLM-L6-v2_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/resolve/v0.6.0/all-MiniLM-L6-v2_xnnpack.pte"
"tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-all-MiniLM-L6-v2/resolve/v0.6.0/tokenizer.json"
"fsmn-vad_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-fsmn-vad/resolve/main/xnnpack/fsmn-vad_xnnpack.pte"
- "whisper_tiny_en_encoder_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/main/xnnpack/whisper_tiny_en_encoder_xnnpack.pte"
- "whisper_tiny_en_decoder_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/main/xnnpack/whisper_tiny_en_decoder_xnnpack.pte"
+ "whisper_tiny_en_encoder_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/v0.7.0/xnnpack/whisper_tiny_en_encoder_xnnpack.pte"
+ "whisper_tiny_en_decoder_xnnpack.pte|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/v0.7.0/xnnpack/whisper_tiny_en_decoder_xnnpack.pte"
"whisper_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-whisper-tiny.en/resolve/v0.6.0/tokenizer.json"
"smolLm2_135M_8da4w.pte|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/resolve/v0.6.0/smolLm-2-135M/quantized/smolLm2_135M_8da4w.pte"
"smollm_tokenizer.json|https://huggingface.co/software-mansion/react-native-executorch-smolLm-2/resolve/v0.6.0/tokenizer.json"
diff --git a/packages/react-native-executorch/src/constants/commonVision.ts b/packages/react-native-executorch/src/constants/commonVision.ts
index 05eeba759..ba89c9f84 100644
--- a/packages/react-native-executorch/src/constants/commonVision.ts
+++ b/packages/react-native-executorch/src/constants/commonVision.ts
@@ -2,3 +2,101 @@ import { Triple } from '../types/common';
export const IMAGENET1K_MEAN: Triple = [0.485, 0.456, 0.406];
export const IMAGENET1K_STD: Triple = [0.229, 0.224, 0.225];
+
+/**
+ * COCO dataset class labels used for object detection.
+ *
+ * @category Types
+ */
+export enum CocoLabel {
+ PERSON = 1,
+ BICYCLE = 2,
+ CAR = 3,
+ MOTORCYCLE = 4,
+ AIRPLANE = 5,
+ BUS = 6,
+ TRAIN = 7,
+ TRUCK = 8,
+ BOAT = 9,
+ TRAFFIC_LIGHT = 10,
+ FIRE_HYDRANT = 11,
+ STREET_SIGN = 12,
+ STOP_SIGN = 13,
+ PARKING = 14,
+ BENCH = 15,
+ BIRD = 16,
+ CAT = 17,
+ DOG = 18,
+ HORSE = 19,
+ SHEEP = 20,
+ COW = 21,
+ ELEPHANT = 22,
+ BEAR = 23,
+ ZEBRA = 24,
+ GIRAFFE = 25,
+ HAT = 26,
+ BACKPACK = 27,
+ UMBRELLA = 28,
+ SHOE = 29,
+ EYE = 30,
+ HANDBAG = 31,
+ TIE = 32,
+ SUITCASE = 33,
+ FRISBEE = 34,
+ SKIS = 35,
+ SNOWBOARD = 36,
+ SPORTS = 37,
+ KITE = 38,
+ BASEBALL = 39,
+ SKATEBOARD = 41,
+ SURFBOARD = 42,
+ TENNIS_RACKET = 43,
+ BOTTLE = 44,
+ PLATE = 45,
+ WINE_GLASS = 46,
+ CUP = 47,
+ FORK = 48,
+ KNIFE = 49,
+ SPOON = 50,
+ BOWL = 51,
+ BANANA = 52,
+ APPLE = 53,
+ SANDWICH = 54,
+ ORANGE = 55,
+ BROCCOLI = 56,
+ CARROT = 57,
+ HOT_DOG = 58,
+ PIZZA = 59,
+ DONUT = 60,
+ CAKE = 61,
+ CHAIR = 62,
+ COUCH = 63,
+ POTTED_PLANT = 64,
+ BED = 65,
+ MIRROR = 66,
+ DINING_TABLE = 67,
+ WINDOW = 68,
+ DESK = 69,
+ TOILET = 70,
+ DOOR = 71,
+ TV = 72,
+ LAPTOP = 73,
+ MOUSE = 74,
+ REMOTE = 75,
+ KEYBOARD = 76,
+ CELL_PHONE = 77,
+ MICROWAVE = 78,
+ OVEN = 79,
+ TOASTER = 80,
+ SINK = 81,
+ REFRIGERATOR = 82,
+ BLENDER = 83,
+ BOOK = 84,
+ CLOCK = 85,
+ VASE = 86,
+ SCISSORS = 87,
+ TEDDY_BEAR = 88,
+ HAIR_DRIER = 89,
+ TOOTHBRUSH = 90,
+ HAIR_BRUSH = 91,
+}
diff --git a/packages/react-native-executorch/src/constants/modelUrls.ts b/packages/react-native-executorch/src/constants/modelUrls.ts
index 499abf63a..e19801cfd 100644
--- a/packages/react-native-executorch/src/constants/modelUrls.ts
+++ b/packages/react-native-executorch/src/constants/modelUrls.ts
@@ -386,13 +386,23 @@ export const EFFICIENTNET_V2_S = {
// Object detection
const SSDLITE_320_MOBILENET_V3_LARGE_MODEL = `${URL_PREFIX}-ssdlite320-mobilenet-v3-large/${VERSION_TAG}/ssdlite320-mobilenetv3-large.pte`;
+const RF_DETR_NANO_MODEL = `${URL_PREFIX}-rfdetr-nano-detector/${NEXT_VERSION_TAG}/rfdetr_detector.pte`;
/**
* @category Models - Object Detection
*/
export const SSDLITE_320_MOBILENET_V3_LARGE = {
+ modelName: 'ssdlite-320-mobilenet-v3-large',
modelSource: SSDLITE_320_MOBILENET_V3_LARGE_MODEL,
-};
+} as const;
+
+/**
+ * @category Models - Object Detection
+ */
+export const RF_DETR_NANO = {
+ modelName: 'rf-detr-nano',
+ modelSource: RF_DETR_NANO_MODEL,
+} as const;
// Style transfer
const STYLE_TRANSFER_CANDY_MODEL =
diff --git a/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts b/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts
index 27be7478c..5333b8a32 100644
--- a/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts
+++ b/packages/react-native-executorch/src/hooks/computer_vision/useObjectDetection.ts
@@ -1,24 +1,55 @@
-import { useModule } from '../useModule';
-import { ObjectDetectionModule } from '../../modules/computer_vision/ObjectDetectionModule';
import {
+ ObjectDetectionModule,
+ ObjectDetectionLabels,
+} from '../../modules/computer_vision/ObjectDetectionModule';
+import {
+ ObjectDetectionModelSources,
ObjectDetectionProps,
ObjectDetectionType,
} from '../../types/objectDetection';
+import { useMemo } from 'react';
+import { PixelData } from '../../types/common';
+import { useModuleFactory } from '../useModuleFactory';
/**
* React hook for managing an Object Detection model instance.
*
+ * @typeParam C - A {@link ObjectDetectionModelSources} config specifying which built-in model to load.
* @category Hooks
- * @param ObjectDetectionProps - Configuration object containing `model` source and optional `preventLoad` flag.
- * @returns Ready to use Object Detection model.
+ * @param props - Configuration object containing `model` config and optional `preventLoad` flag.
+ * @returns An object with model state (`error`, `isReady`, `isGenerating`, `downloadProgress`) and typed `forward` and `runOnFrame` functions.
*/
-export const useObjectDetection = ({
+export const useObjectDetection = ({
model,
preventLoad = false,
-}: ObjectDetectionProps): ObjectDetectionType => {
- return useModule({
- module: ObjectDetectionModule,
- model,
- preventLoad: preventLoad,
+}: ObjectDetectionProps): ObjectDetectionType<
+ ObjectDetectionLabels
+> => {
+ const {
+ error,
+ isReady,
+ isGenerating,
+ downloadProgress,
+ runForward,
+ instance,
+ } = useModuleFactory({
+ factory: (config, onProgress) =>
+ ObjectDetectionModule.fromModelName(config, onProgress),
+ config: model,
+ preventLoad,
});
+
+ const forward = (input: string | PixelData, detectionThreshold?: number) =>
+ runForward((inst) => inst.forward(input, detectionThreshold));
+
+ const runOnFrame = useMemo(() => instance?.runOnFrame ?? null, [instance]);
+
+ return {
+ error,
+ isReady,
+ isGenerating,
+ downloadProgress,
+ forward,
+ runOnFrame,
+ };
};
diff --git a/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts b/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts
index 5cfd1af18..cad249110 100644
--- a/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts
+++ b/packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts
@@ -1,4 +1,3 @@
-import { useState, useEffect } from 'react';
import {
SemanticSegmentationModule,
SegmentationLabels,
@@ -9,8 +8,7 @@ import {
ModelNameOf,
SemanticSegmentationModelSources,
} from '../../types/semanticSegmentation';
-import { RnExecutorchErrorCode } from '../../errors/ErrorCodes';
-import { RnExecutorchError, parseUnknownError } from '../../errors/errorUtils';
+import { useModuleFactory } from '../useModuleFactory';
/**
* React hook for managing a Semantic Segmentation model instance.
@@ -36,83 +34,22 @@ export const useSemanticSegmentation = <
}: SemanticSegmentationProps): SemanticSegmentationType<
SegmentationLabels>
> => {
- const [error, setError] = useState(null);
- const [isReady, setIsReady] = useState(false);
- const [isGenerating, setIsGenerating] = useState(false);
- const [downloadProgress, setDownloadProgress] = useState(0);
- const [instance, setInstance] = useState
- > | null>(null);
-
- useEffect(() => {
- if (preventLoad) return;
-
- let isMounted = true;
- let currentInstance: SemanticSegmentationModule> | null =
- null;
-
- (async () => {
- setDownloadProgress(0);
- setError(null);
- setIsReady(false);
- try {
- currentInstance = await SemanticSegmentationModule.fromModelName(
- model,
- (progress) => {
- if (isMounted) setDownloadProgress(progress);
- }
- );
- if (isMounted) {
- setInstance(currentInstance);
- setIsReady(true);
- }
- } catch (err) {
- if (isMounted) setError(parseUnknownError(err));
- }
- })();
-
- return () => {
- isMounted = false;
- currentInstance?.delete();
- };
-
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [model.modelName, model.modelSource, preventLoad]);
-
- const forward = async >>(
+ const { error, isReady, isGenerating, downloadProgress, runForward } =
+ useModuleFactory({
+ factory: (config, onProgress) =>
+ SemanticSegmentationModule.fromModelName(config, onProgress),
+ config: model,
+ preventLoad,
+ });
+
+ const forward = >>(
imageSource: string,
classesOfInterest: K[] = [],
resizeToInput: boolean = true
- ) => {
- if (!isReady || !instance) {
- throw new RnExecutorchError(
- RnExecutorchErrorCode.ModuleNotLoaded,
- 'The model is currently not loaded. Please load the model before calling forward().'
- );
- }
- if (isGenerating) {
- throw new RnExecutorchError(
- RnExecutorchErrorCode.ModelGenerating,
- 'The model is currently generating. Please wait until previous model run is complete.'
- );
- }
- try {
- setIsGenerating(true);
- return await instance.forward(
- imageSource,
- classesOfInterest,
- resizeToInput
- );
- } finally {
- setIsGenerating(false);
- }
- };
+ ) =>
+ runForward((inst) =>
+ inst.forward(imageSource, classesOfInterest, resizeToInput)
+ );
- return {
- error,
- isReady,
- isGenerating,
- downloadProgress,
- forward,
- };
+ return { error, isReady, isGenerating, downloadProgress, forward };
};
diff --git a/packages/react-native-executorch/src/hooks/useModuleFactory.ts b/packages/react-native-executorch/src/hooks/useModuleFactory.ts
new file mode 100644
index 000000000..2be882126
--- /dev/null
+++ b/packages/react-native-executorch/src/hooks/useModuleFactory.ts
@@ -0,0 +1,92 @@
+import { useState, useEffect } from 'react';
+import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
+import { RnExecutorchError, parseUnknownError } from '../errors/errorUtils';
+
+type Deletable = { delete: () => void };
+
+/**
+ * Shared hook for modules that are instantiated via an async static factory
+ * (i.e. `SomeModule.fromModelName(config, onProgress)`).
+ *
+ * Handles model loading, download progress, error state, and enforces the
+ * not-loaded / already-generating guards so individual hooks only need to
+ * define their typed `forward` wrapper.
+ *
+ * @internal
+ */
+export function useModuleFactory<
+ M extends Deletable,
+ Config extends { modelName: string; modelSource: unknown },
+>({
+ factory,
+ config,
+ preventLoad = false,
+}: {
+ factory: (
+ config: Config,
+ onProgress: (progress: number) => void
+ ) => Promise;
+ config: Config;
+ preventLoad?: boolean;
+}) {
+ const [error, setError] = useState(null);
+ const [isReady, setIsReady] = useState(false);
+ const [isGenerating, setIsGenerating] = useState(false);
+ const [downloadProgress, setDownloadProgress] = useState(0);
+ const [instance, setInstance] = useState(null);
+
+ useEffect(() => {
+ if (preventLoad) return;
+
+ let currentInstance: M | null = null;
+
+ (async () => {
+ setDownloadProgress(0);
+ setError(null);
+ setIsReady(false);
+ try {
+ currentInstance = await factory(config, setDownloadProgress);
+ setInstance(currentInstance);
+ setIsReady(true);
+ } catch (err) {
+ setError(parseUnknownError(err));
+ }
+ })();
+
+ return () => {
+ currentInstance?.delete();
+ };
+
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [config.modelName, config.modelSource, preventLoad]);
+
+ const runForward = async (fn: (instance: M) => Promise): Promise => {
+ if (!isReady || !instance) {
+ throw new RnExecutorchError(
+ RnExecutorchErrorCode.ModuleNotLoaded,
+ 'The model is currently not loaded. Please load the model before calling forward().'
+ );
+ }
+ if (isGenerating) {
+ throw new RnExecutorchError(
+ RnExecutorchErrorCode.ModelGenerating,
+ 'The model is currently generating. Please wait until previous model run is complete.'
+ );
+ }
+ try {
+ setIsGenerating(true);
+ return await fn(instance);
+ } finally {
+ setIsGenerating(false);
+ }
+ };
+
+ return {
+ error,
+ isReady,
+ isGenerating,
+ downloadProgress,
+ runForward,
+ instance,
+ };
+}
diff --git a/packages/react-native-executorch/src/index.ts b/packages/react-native-executorch/src/index.ts
index dd7557ca2..2febddda0 100644
--- a/packages/react-native-executorch/src/index.ts
+++ b/packages/react-native-executorch/src/index.ts
@@ -39,10 +39,16 @@ declare global {
var loadSemanticSegmentation: (
source: string,
normMean: Triple | [],
- normStd: Triple | []
+ normStd: Triple | [],
+ allClasses: string[]
) => any;
var loadClassification: (source: string) => any;
- var loadObjectDetection: (source: string) => any;
+ var loadObjectDetection: (
+ source: string,
+ normMean: Triple | [],
+ normStd: Triple | [],
+ labelNames: string[]
+ ) => any;
var loadExecutorchModule: (source: string) => any;
var loadTokenizerModule: (source: string) => any;
var loadImageEmbeddings: (source: string) => any;
@@ -173,6 +179,7 @@ export * from './types/styleTransfer';
export * from './types/tti';
// constants
+export * from './constants/commonVision';
export * from './constants/modelUrls';
export * from './constants/ocr/models';
export * from './constants/tts/models';
diff --git a/packages/react-native-executorch/src/modules/BaseLabeledModule.ts b/packages/react-native-executorch/src/modules/BaseLabeledModule.ts
new file mode 100644
index 000000000..6d8719b65
--- /dev/null
+++ b/packages/react-native-executorch/src/modules/BaseLabeledModule.ts
@@ -0,0 +1,62 @@
+import { ResourceFetcher } from '../utils/ResourceFetcher';
+import { LabelEnum, ResourceSource } from '../types/common';
+import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
+import { RnExecutorchError } from '../errors/errorUtils';
+import { BaseModule } from './BaseModule';
+
+/**
+ * Fetches a model binary and returns its local path, throwing if the download
+ * was interrupted (paused or cancelled).
+ *
+ * @internal
+ */
+export async function fetchModelPath(
+ source: ResourceSource,
+ onDownloadProgress: (progress: number) => void
+): Promise {
+ const paths = await ResourceFetcher.fetch(onDownloadProgress, source);
+ if (!paths?.[0]) {
+ throw new RnExecutorchError(
+ RnExecutorchErrorCode.DownloadInterrupted,
+ 'The download has been interrupted. Please retry.'
+ );
+ }
+ return paths[0];
+}
+
+/**
+ * Given a model configs record (mapping model names to `{ labelMap }`) and a
+ * type `T` (either a model name key or a raw {@link LabelEnum}), resolves to
+ * the label map for that model or `T` itself.
+ *
+ * @internal
+ */
+export type ResolveLabels<
+ T,
+ Configs extends Record,
+> = T extends keyof Configs
+ ? Configs[T]['labelMap']
+ : T extends LabelEnum
+ ? T
+ : never;
+
+/**
+ * Base class for vision modules that carry a type-safe label map.
+ *
+ * @typeParam LabelMap - The resolved {@link LabelEnum} for the model's output classes.
+ * @internal
+ */
+export abstract class BaseLabeledModule<
+ LabelMap extends LabelEnum,
+> extends BaseModule {
+ protected readonly labelMap: LabelMap;
+
+ protected constructor(labelMap: LabelMap, nativeModule: unknown) {
+ super();
+ this.labelMap = labelMap;
+ this.nativeModule = nativeModule;
+ }
+
+ // TODO: figure it out so we can delete this (we need this because of basemodule inheritance)
+ override async load() {}
+}
diff --git a/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts b/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts
index f056cff62..e15f6981f 100644
--- a/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts
+++ b/packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts
@@ -1,52 +1,151 @@
-import { ResourceFetcher } from '../../utils/ResourceFetcher';
-import { ResourceSource, PixelData } from '../../types/common';
-import { Detection } from '../../types/objectDetection';
-import { RnExecutorchErrorCode } from '../../errors/ErrorCodes';
-import { parseUnknownError, RnExecutorchError } from '../../errors/errorUtils';
-import { Logger } from '../../common/Logger';
-import { VisionModule } from './VisionModule';
+import { LabelEnum, PixelData, ResourceSource } from '../../types/common';
+import {
+ Detection,
+ ObjectDetectionConfig,
+ ObjectDetectionModelName,
+ ObjectDetectionModelSources,
+} from '../../types/objectDetection';
+import {
+ CocoLabel,
+ IMAGENET1K_MEAN,
+ IMAGENET1K_STD,
+} from '../../constants/commonVision';
+import {
+ fetchModelPath,
+ ResolveLabels as ResolveLabelsFor,
+} from '../BaseLabeledModule';
+import { VisionLabeledModule } from './VisionLabeledModule';
+
+const ModelConfigs = {
+ 'ssdlite-320-mobilenet-v3-large': {
+ labelMap: CocoLabel,
+ preprocessorConfig: undefined,
+ },
+ 'rf-detr-nano': {
+ labelMap: CocoLabel,
+ preprocessorConfig: { normMean: IMAGENET1K_MEAN, normStd: IMAGENET1K_STD },
+ },
+} as const satisfies Record<
+ ObjectDetectionModelName,
+ ObjectDetectionConfig
+>;
+
+type ModelConfigsType = typeof ModelConfigs;
+
+/**
+ * Resolves the {@link LabelEnum} for a given built-in object detection model name.
+ *
+ * @typeParam M - A built-in model name from {@link ObjectDetectionModelName}.
+ *
+ * @category Types
+ */
+export type ObjectDetectionLabels =
+ ResolveLabelsFor;
+
+type ModelNameOf = C['modelName'];
+
+/** @internal */
+type ResolveLabels =
+ ResolveLabelsFor;
/**
- * Module for object detection tasks.
+ * Generic object detection module with type-safe label maps.
+ *
+ * @typeParam T - Either a built-in model name (e.g. `'ssdlite-320-mobilenet-v3-large'`)
+ * or a custom {@link LabelEnum} label map.
*
* @category Typescript API
*/
-export class ObjectDetectionModule extends VisionModule {
+export class ObjectDetectionModule<
+ T extends ObjectDetectionModelName | LabelEnum,
+> extends VisionLabeledModule>[], ResolveLabels> {
+ private constructor(labelMap: ResolveLabels, nativeModule: unknown) {
+ super(labelMap, nativeModule);
+ }
+
/**
- * Loads the model, where `modelSource` is a string that specifies the location of the model binary.
- * To track the download progress, supply a callback function `onDownloadProgressCallback`.
+ * Creates an object detection instance for a built-in model.
*
- * @param model - Object containing `modelSource`.
- * @param onDownloadProgressCallback - Optional callback to monitor download progress.
+ * @param config - A {@link ObjectDetectionModelSources} object specifying which model to load and where to fetch it from.
+ * @param onDownloadProgress - Optional callback to monitor download progress, receiving a value between 0 and 1.
+ * @returns A Promise resolving to an `ObjectDetectionModule` instance typed to the chosen model's label map.
*/
- async load(
- model: { modelSource: ResourceSource },
- onDownloadProgressCallback: (progress: number) => void = () => {}
- ): Promise {
- try {
- const paths = await ResourceFetcher.fetch(
- onDownloadProgressCallback,
- model.modelSource
- );
-
- if (!paths?.[0]) {
- throw new RnExecutorchError(
- RnExecutorchErrorCode.DownloadInterrupted,
- 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
- );
- }
-
- this.nativeModule = global.loadObjectDetection(paths[0]);
- } catch (error) {
- Logger.error('Load failed:', error);
- throw parseUnknownError(error);
+ static async fromModelName(
+ config: C,
+ onDownloadProgress: (progress: number) => void = () => {}
+ ): Promise>> {
+ const { modelSource } = config;
+ const { labelMap, preprocessorConfig } = ModelConfigs[
+ config.modelName
+ ] as ObjectDetectionConfig;
+ const normMean = preprocessorConfig?.normMean ?? [];
+ const normStd = preprocessorConfig?.normStd ?? [];
+ const allLabelNames: string[] = [];
+ for (const [name, value] of Object.entries(labelMap)) {
+ if (typeof value === 'number') allLabelNames[value] = name;
}
+ for (let i = 0; i < allLabelNames.length; i++) {
+ if (allLabelNames[i] == null) allLabelNames[i] = '';
+ }
+ const modelPath = await fetchModelPath(modelSource, onDownloadProgress);
+ const nativeModule = global.loadObjectDetection(
+ modelPath,
+ normMean,
+ normStd,
+ allLabelNames
+ );
+ return new ObjectDetectionModule>(
+ labelMap as ResolveLabels>,
+ nativeModule
+ );
}
- async forward(
+ /**
+ * Creates an object detection instance with a user-provided label map and custom config.
+ *
+ * @param modelSource - A fetchable resource pointing to the model binary.
+ * @param config - A {@link ObjectDetectionConfig} object with the label map.
+ * @param onDownloadProgress - Optional callback to monitor download progress, receiving a value between 0 and 1.
+ * @returns A Promise resolving to an `ObjectDetectionModule` instance typed to the provided label map.
+ */
+ /**
+ * Executes the model's forward pass to detect objects within the provided image.
+ *
+ * @param input - A string image source (file path, URI, or Base64) or a {@link PixelData} object.
+ * @param detectionThreshold - Minimum confidence score for a detection to be included. Default is 0.7.
+ * @returns A Promise resolving to an array of {@link Detection} objects.
+ */
+ override async forward(
input: string | PixelData,
- detectionThreshold: number = 0.5
- ): Promise {
+ detectionThreshold = 0.7
+ ): Promise>[]> {
return super.forward(input, detectionThreshold);
}
+
+ static async fromCustomConfig(
+ modelSource: ResourceSource,
+ config: ObjectDetectionConfig,
+ onDownloadProgress: (progress: number) => void = () => {}
+ ): Promise> {
+ const normMean = config.preprocessorConfig?.normMean ?? [];
+ const normStd = config.preprocessorConfig?.normStd ?? [];
+ const allLabelNames: string[] = [];
+ for (const [name, value] of Object.entries(config.labelMap)) {
+ if (typeof value === 'number') allLabelNames[value] = name;
+ }
+ for (let i = 0; i < allLabelNames.length; i++) {
+ if (allLabelNames[i] == null) allLabelNames[i] = '';
+ }
+ const modelPath = await fetchModelPath(modelSource, onDownloadProgress);
+ const nativeModule = global.loadObjectDetection(
+ modelPath,
+ normMean,
+ normStd,
+ allLabelNames
+ );
+ return new ObjectDetectionModule(
+ config.labelMap as ResolveLabels,
+ nativeModule
+ );
+ }
}
diff --git a/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts b/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts
index b3b7030b3..b2d08e6f5 100644
--- a/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts
+++ b/packages/react-native-executorch/src/modules/computer_vision/SemanticSegmentationModule.ts
@@ -1,4 +1,3 @@
-import { ResourceFetcher } from '../../utils/ResourceFetcher';
import { ResourceSource, LabelEnum } from '../../types/common';
import {
DeeplabLabel,
@@ -10,8 +9,12 @@ import {
} from '../../types/semanticSegmentation';
import { RnExecutorchErrorCode } from '../../errors/ErrorCodes';
import { RnExecutorchError } from '../../errors/errorUtils';
-import { BaseModule } from '../BaseModule';
import { IMAGENET1K_MEAN, IMAGENET1K_STD } from '../../constants/commonVision';
+import {
+ BaseLabeledModule,
+ fetchModelPath,
+ ResolveLabels as ResolveLabelsFor,
+} from '../BaseLabeledModule';
const PascalVocSegmentationConfig = {
labelMap: DeeplabLabel,
@@ -55,13 +58,9 @@ type ModelConfigsType = typeof ModelConfigs;
export type SegmentationLabels =
ModelConfigsType[M]['labelMap'];
-/**
- * @internal
- * Resolves the label type: if `T` is a {@link SemanticSegmentationModelName}, looks up its labels
- * from the built-in config; otherwise uses `T` directly as a {@link LabelEnum}.
- */
+/** @internal */
type ResolveLabels =
- T extends SemanticSegmentationModelName ? SegmentationLabels : T;
+ ResolveLabelsFor;
/**
* Generic semantic segmentation module with type-safe label maps.
@@ -80,22 +79,11 @@ type ResolveLabels =
*/
export class SemanticSegmentationModule<
T extends SemanticSegmentationModelName | LabelEnum,
-> extends BaseModule {
- private labelMap: ResolveLabels;
- private allClassNames: string[];
-
+> extends BaseLabeledModule> {
private constructor(labelMap: ResolveLabels, nativeModule: unknown) {
- super();
- this.labelMap = labelMap;
- this.allClassNames = Object.keys(this.labelMap).filter((k) =>
- isNaN(Number(k))
- );
- this.nativeModule = nativeModule;
+ super(labelMap, nativeModule);
}
- // TODO: figure it out so we can delete this (we need this because of basemodule inheritance)
- override async load() {}
-
/**
* Creates a segmentation instance for a built-in model.
* The config object is discriminated by `modelName` — each model can require different fields.
@@ -124,17 +112,13 @@ export class SemanticSegmentationModule<
] as SemanticSegmentationConfig;
const normMean = preprocessorConfig?.normMean ?? [];
const normStd = preprocessorConfig?.normStd ?? [];
- const paths = await ResourceFetcher.fetch(onDownloadProgress, modelSource);
- if (!paths?.[0]) {
- throw new RnExecutorchError(
- RnExecutorchErrorCode.DownloadInterrupted,
- 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
- );
- }
+ const allClassNames = Object.keys(labelMap).filter((k) => isNaN(Number(k)));
+ const modelPath = await fetchModelPath(modelSource, onDownloadProgress);
const nativeModule = global.loadSemanticSegmentation(
- paths[0],
+ modelPath,
normMean,
- normStd
+ normStd,
+ allClassNames
);
return new SemanticSegmentationModule>(
labelMap as ResolveLabels>,
@@ -165,19 +149,17 @@ export class SemanticSegmentationModule<
config: SemanticSegmentationConfig,
onDownloadProgress: (progress: number) => void = () => {}
): Promise> {
- const paths = await ResourceFetcher.fetch(onDownloadProgress, modelSource);
- if (!paths?.[0]) {
- throw new RnExecutorchError(
- RnExecutorchErrorCode.DownloadInterrupted,
- 'The download has been interrupted. Please retry.'
- );
- }
const normMean = config.preprocessorConfig?.normMean ?? [];
const normStd = config.preprocessorConfig?.normStd ?? [];
+ const allClassNames = Object.keys(config.labelMap).filter((k) =>
+ isNaN(Number(k))
+ );
+ const modelPath = await fetchModelPath(modelSource, onDownloadProgress);
const nativeModule = global.loadSemanticSegmentation(
- paths[0],
+ modelPath,
normMean,
- normStd
+ normStd,
+ allClassNames
);
return new SemanticSegmentationModule(
config.labelMap as ResolveLabels,
@@ -212,7 +194,6 @@ export class SemanticSegmentationModule<
const nativeResult = await this.nativeModule.generate(
imageSource,
- this.allClassNames,
classesOfInterestNames,
resizeToInput
);
diff --git a/packages/react-native-executorch/src/modules/computer_vision/VisionLabeledModule.ts b/packages/react-native-executorch/src/modules/computer_vision/VisionLabeledModule.ts
new file mode 100644
index 000000000..914ea6195
--- /dev/null
+++ b/packages/react-native-executorch/src/modules/computer_vision/VisionLabeledModule.ts
@@ -0,0 +1,26 @@
+import { LabelEnum } from '../../types/common';
+import { VisionModule } from './VisionModule';
+
+/**
+ * Base class for computer vision modules that carry a type-safe label map
+ * and support the full VisionModule API (string/PixelData forward + runOnFrame).
+ *
+ * @typeParam TOutput - The model's output type.
+ * @typeParam LabelMap - The resolved {@link LabelEnum} for the model's output classes.
+ * @internal
+ */
+export abstract class VisionLabeledModule<
+ TOutput,
+ LabelMap extends LabelEnum,
+> extends VisionModule {
+ protected readonly labelMap: LabelMap;
+
+ protected constructor(labelMap: LabelMap, nativeModule: unknown) {
+ super();
+ this.labelMap = labelMap;
+ this.nativeModule = nativeModule;
+ }
+
+ // TODO: figure it out so we can delete this (we need this because of basemodule inheritance)
+ override async load() {}
+}
diff --git a/packages/react-native-executorch/src/types/objectDetection.ts b/packages/react-native-executorch/src/types/objectDetection.ts
index 5aaf81833..aa25e9c41 100644
--- a/packages/react-native-executorch/src/types/objectDetection.ts
+++ b/packages/react-native-executorch/src/types/objectDetection.ts
@@ -1,5 +1,7 @@
import { RnExecutorchError } from '../errors/errorUtils';
-import { ResourceSource, PixelData, Frame } from './common';
+import { LabelEnum, Triple, ResourceSource, PixelData, Frame } from './common';
+import { CocoLabel } from '../constants/commonVision';
+export { CocoLabel };
/**
* Represents a bounding box for a detected object in an image.
@@ -21,124 +23,54 @@ export interface Bbox {
* Represents a detected object within an image, including its bounding box, label, and confidence score.
*
* @category Types
+ * @typeParam L - The label enum type for the detected object. Defaults to {@link CocoLabel}.
* @property {Bbox} bbox - The bounding box of the detected object, defined by its top-left (x1, y1) and bottom-right (x2, y2) coordinates.
- * @property {keyof typeof CocoLabel} label - The class label of the detected object, represented as a key from the `CocoLabel` enum.
+ * @property {keyof L} label - The class label of the detected object.
* @property {number} score - The confidence score of the detection, typically ranging from 0 to 1.
*/
-export interface Detection {
+export interface Detection {
bbox: Bbox;
- label: keyof typeof CocoLabel;
+ label: keyof L;
score: number;
}
/**
- * COCO dataset class labels used for object detection.
+ * Per-model config for {@link ObjectDetectionModule.fromModelName}.
+ * Each model name maps to its required fields.
*
* @category Types
*/
-export enum CocoLabel {
- PERSON = 1,
- BICYCLE = 2,
- CAR = 3,
- MOTORCYCLE = 4,
- AIRPLANE = 5,
- BUS = 6,
- TRAIN = 7,
- TRUCK = 8,
- BOAT = 9,
- TRAFFIC_LIGHT = 10,
- FIRE_HYDRANT = 11,
- STREET_SIGN = 12,
- STOP_SIGN = 13,
- PARKING = 14,
- BENCH = 15,
- BIRD = 16,
- CAT = 17,
- DOG = 18,
- HORSE = 19,
- SHEEP = 20,
- COW = 21,
- ELEPHANT = 22,
- BEAR = 23,
- ZEBRA = 24,
- GIRAFFE = 25,
- HAT = 26,
- BACKPACK = 27,
- UMBRELLA = 28,
- SHOE = 29,
- EYE = 30,
- HANDBAG = 31,
- TIE = 32,
- SUITCASE = 33,
- FRISBEE = 34,
- SKIS = 35,
- SNOWBOARD = 36,
- SPORTS = 37,
- KITE = 38,
- BASEBALL = 39,
- SKATEBOARD = 41,
- SURFBOARD = 42,
- TENNIS_RACKET = 43,
- BOTTLE = 44,
- PLATE = 45,
- WINE_GLASS = 46,
- CUP = 47,
- FORK = 48,
- KNIFE = 49,
- SPOON = 50,
- BOWL = 51,
- BANANA = 52,
- APPLE = 53,
- SANDWICH = 54,
- ORANGE = 55,
- BROCCOLI = 56,
- CARROT = 57,
- HOT_DOG = 58,
- PIZZA = 59,
- DONUT = 60,
- CAKE = 61,
- CHAIR = 62,
- COUCH = 63,
- POTTED_PLANT = 64,
- BED = 65,
- MIRROR = 66,
- DINING_TABLE = 67,
- WINDOW = 68,
- DESK = 69,
- TOILET = 70,
- DOOR = 71,
- TV = 72,
- LAPTOP = 73,
- MOUSE = 74,
- REMOTE = 75,
- KEYBOARD = 76,
- CELL_PHONE = 77,
- MICROWAVE = 78,
- OVEN = 79,
- TOASTER = 80,
- SINK = 81,
- REFRIGERATOR = 82,
- BLENDER = 83,
- BOOK = 84,
- CLOCK = 85,
- VASE = 86,
- SCISSORS = 87,
- TEDDY_BEAR = 88,
- HAIR_DRIER = 89,
- TOOTHBRUSH = 90,
- HAIR_BRUSH = 91,
-}
+export type ObjectDetectionModelSources =
+ | { modelName: 'ssdlite-320-mobilenet-v3-large'; modelSource: ResourceSource }
+ | { modelName: 'rf-detr-nano'; modelSource: ResourceSource };
+
+/**
+ * Union of all built-in object detection model names.
+ *
+ * @category Types
+ */
+export type ObjectDetectionModelName = ObjectDetectionModelSources['modelName'];
+
+/**
+ * Configuration for a custom object detection model.
+ *
+ * @category Types
+ */
+export type ObjectDetectionConfig = {
+ labelMap: T;
+ preprocessorConfig?: { normMean?: Triple; normStd?: Triple };
+};
/**
* Props for the `useObjectDetection` hook.
*
+ * @typeParam C - A {@link ObjectDetectionModelSources} config specifying which built-in model to load.
* @category Types
- * @property {Object} model - An object containing the model source.
- * @property {ResourceSource} model.modelSource - The source of the object detection model binary.
+ * @property model - The model config containing `modelName` and `modelSource`.
* @property {boolean} [preventLoad] - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
*/
-export interface ObjectDetectionProps {
- model: { modelSource: ResourceSource };
+export interface ObjectDetectionProps {
+ model: C;
preventLoad?: boolean;
}
@@ -146,9 +78,11 @@ export interface ObjectDetectionProps {
* Return type for the `useObjectDetection` hook.
* Manages the state and operations for Computer Vision object detection tasks.
*
+ * @typeParam L - The {@link LabelEnum} representing the model's class labels.
+ *
* @category Types
*/
-export interface ObjectDetectionType {
+export interface ObjectDetectionType {
/**
* Contains the error object if the model failed to load, download, or encountered a runtime error during detection.
*/
@@ -172,34 +106,15 @@ export interface ObjectDetectionType {
/**
* Executes the model's forward pass with automatic input type detection.
*
- * Supports two input types:
- * 1. **String path/URI**: File path, URL, or Base64-encoded string
- * 2. **PixelData**: Raw pixel data from image libraries (e.g., NitroImage)
- *
- * **Note**: For VisionCamera frame processing, use `runOnFrame` instead.
- *
- * @param input - Image source (string or PixelData object)
- * @param detectionThreshold - An optional number between 0 and 1 representing the minimum confidence score. Default is 0.5.
+ * @param input - Image source (string path/URI or PixelData object)
+ * @param detectionThreshold - An optional number between 0 and 1 representing the minimum confidence score. Default is 0.7.
* @returns A Promise that resolves to an array of `Detection` objects.
* @throws {RnExecutorchError} If the model is not loaded or is currently processing another image.
- *
- * @example
- * ```typescript
- * // String path
- * const detections1 = await model.forward('file:///path/to/image.jpg');
- *
- * // Pixel data
- * const detections2 = await model.forward({
- * dataPtr: new Uint8Array(rgbPixels),
- * sizes: [480, 640, 3],
- * scalarType: ScalarType.BYTE
- * });
- * ```
*/
forward: (
input: string | PixelData,
detectionThreshold?: number
- ) => Promise;
+ ) => Promise[]>;
/**
* Synchronous worklet function for real-time VisionCamera frame processing.
@@ -210,25 +125,11 @@ export interface ObjectDetectionType {
*
* Available after model is loaded (`isReady: true`).
*
- * @example
- * ```typescript
- * const { runOnFrame, isReady } = useObjectDetection({ model: MODEL });
- *
- * const frameOutput = useFrameOutput({
- * onFrame(frame) {
- * 'worklet';
- * if (!runOnFrame) return;
- * const detections = runOnFrame(frame, 0.5);
- * frame.dispose();
- * }
- * });
- * ```
- *
* @param frame - VisionCamera Frame object
* @param detectionThreshold - The threshold for detection sensitivity.
* @returns Array of Detection objects representing detected items in the frame.
*/
runOnFrame:
- | ((frame: Frame, detectionThreshold: number) => Detection[])
+ | ((frame: Frame, detectionThreshold: number) => Detection[])
| null;
}