Skip to content

Commit 190d38b

Browse files
committed
refactor(models): drop redundant _seg suffix from instance_segmentation accessors
The instance_segmentation namespace already implies segmentation, so the _seg suffix on yolo26* and rf_detr_nano was redundant and inconsistent with pose_estimation.yolo26n (no _pose suffix). Drop the suffix and update demo apps and docs accordingly.
1 parent c32623c commit 190d38b

6 files changed

Lines changed: 20 additions & 22 deletions

File tree

apps/computer-vision/app/instance_segmentation/index.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,22 @@ const instanceSegmentation = models.instance_segmentation;
2626
const objectDetection = models.object_detection;
2727

2828
const MODELS: ModelOption<InstanceSegmentationModelSources>[] = [
29-
{ label: 'Yolo26N', value: instanceSegmentation.yolo26n_seg() },
30-
{ label: 'Yolo26S', value: instanceSegmentation.yolo26s_seg() },
31-
{ label: 'Yolo26M', value: instanceSegmentation.yolo26m_seg() },
32-
{ label: 'Yolo26L', value: instanceSegmentation.yolo26l_seg() },
33-
{ label: 'Yolo26X', value: instanceSegmentation.yolo26x_seg() },
29+
{ label: 'Yolo26N', value: instanceSegmentation.yolo26n() },
30+
{ label: 'Yolo26S', value: instanceSegmentation.yolo26s() },
31+
{ label: 'Yolo26M', value: instanceSegmentation.yolo26m() },
32+
{ label: 'Yolo26L', value: instanceSegmentation.yolo26l() },
33+
{ label: 'Yolo26X', value: instanceSegmentation.yolo26x() },
3434
{
3535
label: 'RF-DeTR Nano',
36-
value: instanceSegmentation.rf_detr_nano_seg(),
36+
value: instanceSegmentation.rf_detr_nano(),
3737
},
3838
{ label: 'FastSAM-S', value: objectDetection.fastsam_s() },
3939
{ label: 'FastSAM-X', value: objectDetection.fastsam_x() },
4040
];
4141

4242
export default function InstanceSegmentationScreen() {
4343
const [selectedModel, setSelectedModel] =
44-
useState<InstanceSegmentationModelSources>(
45-
instanceSegmentation.yolo26n_seg()
46-
);
44+
useState<InstanceSegmentationModelSources>(instanceSegmentation.yolo26n());
4745
const [inferenceTime, setInferenceTime] = useState<number | null>(null);
4846

4947
const { setGlobalGenerating } = useContext(GeneratingContext);

apps/computer-vision/components/vision_camera/tasks/InstanceSegmentationTask.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ export default function InstanceSegmentationTask({
4141
onErrorChange,
4242
}: Props) {
4343
const yolo26n = useInstanceSegmentation({
44-
model: instanceSegmentation.yolo26n_seg(),
44+
model: instanceSegmentation.yolo26n(),
4545
preventLoad: activeModel !== 'instanceSegmentationYolo26n',
4646
});
4747
const rfdetr = useInstanceSegmentation({
48-
model: instanceSegmentation.rf_detr_nano_seg(),
48+
model: instanceSegmentation.rf_detr_nano(),
4949
preventLoad: activeModel !== 'instanceSegmentationRfdetr',
5050
});
5151
const fastsamS = useInstanceSegmentation({

docs/docs/03-hooks/02-computer-vision/useInstanceSegmentation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It is recommended to use models provided by us, which are available at our [Hugg
1717
```typescript
1818
import { models, useInstanceSegmentation } from 'react-native-executorch';
1919
const model = useInstanceSegmentation({
20-
model: models.instance_segmentation.yolo26n_seg(),
20+
model: models.instance_segmentation.yolo26n(),
2121
});
2222

2323
const imageUri = 'file:///Users/.../photo.jpg';
@@ -83,7 +83,7 @@ To run the model, use the [`forward`](../../06-api-reference/interfaces/Instance
8383
import { models, useInstanceSegmentation } from 'react-native-executorch';
8484
function App() {
8585
const model = useInstanceSegmentation({
86-
model: models.instance_segmentation.yolo26n_seg(),
86+
model: models.instance_segmentation.yolo26n(),
8787
});
8888

8989
const handleSegment = async () => {

docs/docs/04-typescript-api/02-computer-vision/InstanceSegmentationModule.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const imageUri = 'path/to/image.png';
1616

1717
// Creating an instance from a built-in model
1818
const segmentation = await InstanceSegmentationModule.fromModelName(
19-
models.instance_segmentation.yolo26n_seg()
19+
models.instance_segmentation.yolo26n()
2020
);
2121

2222
// Running the model
@@ -43,7 +43,7 @@ Use [`fromModelName`](../../06-api-reference/classes/InstanceSegmentationModule.
4343
```typescript
4444
import { models, InstanceSegmentationModule } from 'react-native-executorch';
4545
const segmentation = await InstanceSegmentationModule.fromModelName(
46-
models.instance_segmentation.yolo26n_seg()
46+
models.instance_segmentation.yolo26n()
4747
);
4848
```
4949

docs/docs/05-utilities/model-registry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Each leaf is a **function**. Call it (optionally with `{ quant, backend }`) to g
2828
| `object_detection` | `ssdlite_320_mobilenet_v3_large`, `yolo26n``yolo26x`, `rf_detr_nano`, `fastsam_s`, `fastsam_x` |
2929
| `pose_estimation` | `yolo26n` |
3030
| `semantic_segmentation` | `deeplab_v3_resnet50`, `lraspp_mobilenet_v3_large`, `fcn_resnet101`, `selfie_segmentation`, … |
31-
| `instance_segmentation` | `yolo26n_seg``yolo26x_seg`, `rf_detr_nano_seg` |
31+
| `instance_segmentation` | `yolo26n``yolo26x`, `rf_detr_nano` |
3232
| `style_transfer` | `candy`, `mosaic`, `rain_princess`, `udnie` |
3333
| `speech_to_text` | `whisper_tiny_en`, `whisper_base`, `whisper_small_en`, … |
3434
| `text_to_speech` | nested by model family + language: `kokoro.en_us.{heart, river, sarah, adam, …}`, `kokoro.en_gb.{emma, daniel}`, `kokoro.fr.siwis`, `kokoro.es.{dora, alex}`, `kokoro.it.{sara, nicola}`, `kokoro.pt.{dora, santa}`, `kokoro.hi.{alpha, omega, psi}`, `kokoro.pl.mateusz`, `kokoro.de.anna` |

packages/react-native-executorch/src/constants/modelRegistry.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,12 @@ export const models = {
534534
selfie_segmentation: base(M.SELFIE_SEGMENTATION),
535535
},
536536
instance_segmentation: {
537-
yolo26n_seg: base(M.YOLO26N_SEG),
538-
yolo26s_seg: base(M.YOLO26S_SEG),
539-
yolo26m_seg: base(M.YOLO26M_SEG),
540-
yolo26l_seg: base(M.YOLO26L_SEG),
541-
yolo26x_seg: base(M.YOLO26X_SEG),
542-
rf_detr_nano_seg: variant(RF_DETR_NANO_SEG_VARIANTS),
537+
yolo26n: base(M.YOLO26N_SEG),
538+
yolo26s: base(M.YOLO26S_SEG),
539+
yolo26m: base(M.YOLO26M_SEG),
540+
yolo26l: base(M.YOLO26L_SEG),
541+
yolo26x: base(M.YOLO26X_SEG),
542+
rf_detr_nano: variant(RF_DETR_NANO_SEG_VARIANTS),
543543
},
544544
style_transfer: {
545545
candy: variant(STYLE_TRANSFER_CANDY_VARIANTS),

0 commit comments

Comments
 (0)