Skip to content

Commit a3b5725

Browse files
committed
Adjust segmentation docs
1 parent 1ed03b5 commit a3b5725

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

docs/docs/computer-vision/useClassification.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Usually, the class with the highest probability is the one that is assigned to a
1010
:::
1111

1212
:::caution
13-
It is recommended to use models provided by us, which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s). You can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library
13+
It is recommended to use models provided by us, which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s). You can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library.
1414
:::
1515

1616
## Reference

docs/docs/computer-vision/useImageSegmentation.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ title: useImageSegmentation
33
sidebar_position: 2
44
---
55

6-
Semantic image segmentation, akin to image classification, tries to assign the content of the image to one of the predefined classes. However, in case of segmentation this classification is done on a per-pixel basis, so as the result the model provides an image-sized array of scores for each of the classes. React Native ExecuTorch offers a dedicated hook `useImageSegmentation` for this task. However, before you start you'll need to obtain ExecuTorch-compatible model binary.
6+
Semantic image segmentation, akin to image classification, tries to assign the content of the image to one of the predefined classes. However, in case of segmentation this classification is done on a per-pixel basis, so as the result the model provides an image-sized array of scores for each of the classes. You can then use this information to detect objects on a per-pixel basis. React Native ExecuTorch offers a dedicated hook `useImageSegmentation` for this task.
77

88
:::caution
9-
It is recommended to use models provided by us which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy), you can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library
9+
It is recommended to use models provided by us which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy), you can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library.
1010
:::
1111

1212
## Reference
@@ -37,13 +37,13 @@ A string that specifies the location of the model binary. For more information,
3737

3838
### Returns
3939

40-
| Field | Type | Description |
41-
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42-
| `forward` | `(input: string, classesOfInterest?: DeeplabLabel[], resize?: boolean) => Promise<{[key in DeeplabLabel]?: number[]}>` | Executes the model's forward pass, where: <br> \* `input` can be a fetchable resource or a Base64-encoded string. <br> \* `classesOfInterest` is an optional list of `DeeplabLabel` used to indicate additional arrays of probabilities to output (see section "Running the model"). The default is an empty list. <br> \* `resize` is an optional boolean to indicate whether the output should be resized to the original image dimensions, or left in the size of the model (see section "Running the model"). The default is `false`. <br> <br> The return is a dictionary containing: <br> \* for the key `DeeplabLabel.ARGMAX` an array of integers corresponding to the most probable class for each pixel <br> \* an array of floats for each class from `classesOfInterest` corresponding to the probabilities for this class. |
43-
| `error` | <code>string &#124; null</code> | Contains the error message if the model failed to load. |
44-
| `isGenerating` | `boolean` | Indicates whether the model is currently processing an inference. |
45-
| `isReady` | `boolean` | Indicates whether the model has successfully loaded and is ready for inference. |
46-
| `downloadProgress` | `number` | Represents the download progress as a value between 0 and 1. |
40+
| Field | Type | Description |
41+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42+
| `forward` | `(input: string, classesOfInterest?: DeeplabLabel[], resize?: boolean) => Promise<{[key in DeeplabLabel]?: number[]}>` | Executes the model's forward pass, where: <br/> \* `input` can be a fetchable resource or a Base64-encoded string. <br/> \* `classesOfInterest` is an optional list of `DeeplabLabel` used to indicate additional arrays of probabilities to output (see section "Running the model"). The default is an empty list. <br/> \* `resize` is an optional boolean to indicate whether the output should be resized to the original image dimensions, or left in the size of the model (see section "Running the model"). The default is `false`. <br/> <br/> The return is a dictionary containing: <br/> \* for the key `DeeplabLabel.ARGMAX` an array of integers corresponding to the most probable class for each pixel <br/> \* an array of floats for each class from `classesOfInterest` corresponding to the probabilities for this class. |
43+
| `error` | <code>string &#124; null</code> | Contains the error message if the model failed to load. |
44+
| `isGenerating` | `boolean` | Indicates whether the model is currently processing an inference. |
45+
| `isReady` | `boolean` | Indicates whether the model has successfully loaded and is ready for inference. |
46+
| `downloadProgress` | `number` | Represents the download progress as a value between 0 and 1. |
4747

4848
## Running the model
4949

@@ -54,7 +54,7 @@ To run the model, you can use the `forward` method. It accepts three arguments:
5454
- The `resize` flag says whether the output will be rescaled back to the size of the image you put in. The default is `false`. The model runs inference on a scaled (probably smaller) version of your image (224x224 for `DEEPLABV3_RESNET50`). If you choose to resize, the output will be `number[]` of size `width * height` of your original image.
5555

5656
:::caution
57-
Setting `resize` to true will make `forward` slower
57+
Setting `resize` to true will make `forward` slower.
5858
:::
5959

6060
`forward` returns a promise which can resolve either to an error or a dictionary containing number arrays with size depending on `resize`:

docs/docs/computer-vision/useStyleTransfer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 2
66
Style transfer is a technique used in computer graphics and machine learning where the visual style of one image is applied to the content of another. This is achieved using algorithms that manipulate data from both images, typically with the aid of a neural network. The result is a new image that combines the artistic elements of one picture with the structural details of another, effectively merging art with traditional imagery. React Native ExecuTorch offers a dedicated hook `useStyleTransfer`, for this task. However before you start you'll need to obtain ExecuTorch-compatible model binary.
77

88
:::caution
9-
It is recommended to use models provided by us which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy), you can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library
9+
It is recommended to use models provided by us which are available at our [Hugging Face repository](https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy), you can also use [constants](https://github.com/software-mansion/react-native-executorch/tree/main/src/constants/modelUrls.ts) shipped with our library.
1010
:::
1111

1212
## Reference

0 commit comments

Comments
 (0)