Skip to content

Commit

Permalink
spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
chmjkb committed Dec 17, 2024
1 parent 2a543b5 commit 55d0862
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/docs/hooks/useObjectDetection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: useObjectDetection
sidebar_position: 1
---

`useObjectDetection` is a hook that lets you seamlessly integrate object detection into your React Native application. Currently, the SSDLite320Large model with MobileNetv3 backbone is supported.
`useObjectDetection` is a hook that allows you to seamlessly integrate object detection into your React Native application. Currently, the SSDLite320Large model with a MobileNetv3 backbone is supported.

## Reference
```jsx
Expand Down Expand Up @@ -52,17 +52,16 @@ interface ObjectDetectionModule {

### Running the model

To run the model, you can use the `forward` method. It accepts one argument, which is the image. It can be either a remote URL,
a local file, URI or base64 encoded image. The function returns an array of `Detection` objects. Each one contains coordinates
of the bounding box, the label of the detected object and confidence score. For more information, please refer to the reference or type.
To run the model, you can use the `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. The function returns an array of `Detection` 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.

### Arguments

`modelSource`

A String that specifies the path to the model file. You can download the model from our [HuggingFace repository](https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/tree/main).
As the .pte file for this model is less than 512MB you can add it to your assets directory, and use `require()`. If you prefer to download the model
the model in runtime instead of bundling it, you can use the constants that we ship with the library.
A string that specifies the path to the model file. You can download the model from our [HuggingFace repository](https://huggingface.co/software-mansion/react-native-executorch-ssdlite320-mobilenet-v3-large/tree/main).

Since the `.pte` file for this model is less than 512MB, you can add it to your assets directory and use `require()`. Alternatively, if you prefer to download the model at runtime instead of bundling it, you can use the constants provided with the library.


### Returns

Expand All @@ -71,7 +70,7 @@ The hook returns an object with the following properties:

| **Field** | **Type** | **Description** |
|-----------------------|---------------------------------------|------------------------------------------------------------------------------------------------------------------|
| `forward` | `(input: string) => Promise<Detection[]>` | A function that accepts an image and returns an array of `Detection` objects. |
| `forward` | `(input: string) => Promise<Detection[]>` | A function that accepts an image (url, b64) and returns an array of `Detection` objects. |
| `error` | <code>string &#124; null</code> | Contains the error message if the model failed to load or encountered an error during the generation process. |
| `isModelGenerating` | `boolean` | Indicates whether the model is currently processing an inference. |
| `isModelReady` | `boolean` | Indicates whether the model has successfully loaded and is ready for inference. |
Expand All @@ -94,8 +93,9 @@ interface Detection {
score: number;
}
```
The `bbox` property contains information about the bounding box of detected objects. It is represented as two points, one on the left bottom part of the bounding box (x1, y1), the second one as the top right part (x2, y2).
The label property contains the name of the detected object, which is one of `CocoLabels`. The `score` is a confidence score of the detected object.
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`. The `score` represents the confidence score of the detected object.


### Example
```tsx
Expand Down

0 comments on commit 55d0862

Please sign in to comment.