Skip to content

Commit 25e795c

Browse files
committed
Change rfdetr naming, apply suggestions
1 parent b2fa3be commit 25e795c

9 files changed

Lines changed: 38 additions & 38 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,3 @@ packages/react-native-executorch/common/rnexecutorch/tests/integration/assets/mo
103103
Makefile
104104
*.pte
105105

106-
# Test assets
107-
packages/react-native-executorch/common/rnexecutorch/tests/integration/assets/models/

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import Svg, { Path, Polygon } from 'react-native-svg';
2828
import { GeneratingContext } from '../../context';
2929
import Spinner from '../../components/Spinner';
3030
import ColorPalette from '../../colors';
31-
import ClassificationTask from './tasks/ClassificationTask';
32-
import ObjectDetectionTask from './tasks/ObjectDetectionTask';
33-
import SegmentationTask from './tasks/SegmentationTask';
34-
import InstanceSegmentationTask from './tasks/InstanceSegmentationTask';
31+
import ClassificationTask from '../../components/vision_camera/tasks/ClassificationTask';
32+
import ObjectDetectionTask from '../../components/vision_camera/tasks/ObjectDetectionTask';
33+
import SegmentationTask from '../../components/vision_camera/tasks/SegmentationTask';
34+
import InstanceSegmentationTask from '../../components/vision_camera/tasks/InstanceSegmentationTask';
3535

3636
type TaskId =
3737
| 'classification'
@@ -40,15 +40,15 @@ type TaskId =
4040
| 'instanceSegmentation';
4141
type ModelId =
4242
| 'classification'
43-
| 'objectDetection_ssdlite'
44-
| 'objectDetection_rfdetr'
45-
| 'segmentation_deeplab_resnet50'
46-
| 'segmentation_deeplab_resnet101'
47-
| 'segmentation_deeplab_mobilenet'
48-
| 'segmentation_lraspp'
49-
| 'segmentation_fcn_resnet50'
50-
| 'segmentation_fcn_resnet101'
51-
| 'segmentation_selfie'
43+
| 'objectDetectionSsdlite'
44+
| 'objectDetectionRfdetr'
45+
| 'segmentationDeeplabResnet50'
46+
| 'segmentationDeeplabResnet101'
47+
| 'segmentationDeeplabMobilenet'
48+
| 'segmentationLraspp'
49+
| 'segmentationFcnResnet50'
50+
| 'segmentationFcnResnet101'
51+
| 'segmentationSelfie'
5252
| 'instanceSegmentation_yolo26n'
5353
| 'instanceSegmentation_rfdetr';
5454

@@ -87,7 +87,7 @@ const TASKS: Task[] = [
8787
label: 'Inst Seg',
8888
variants: [
8989
{ id: 'instanceSegmentation_yolo26n', label: 'YOLO26N Seg' },
90-
{ id: 'instanceSegmentation_rfdetr', label: 'RF-DETR Seg' },
90+
{ id: 'instanceSegmentation_rfdetr', label: 'RF-DETR Nano Seg' },
9191
],
9292
},
9393
];
@@ -216,7 +216,7 @@ export default function VisionCameraScreen() {
216216
<ObjectDetectionTask
217217
{...taskProps}
218218
activeModel={
219-
activeModel as 'objectDetection_ssdlite' | 'objectDetection_rfdetr'
219+
activeModel as 'objectDetectionSsdlite' | 'objectDetectionRfdetr'
220220
}
221221
/>
222222
)}
@@ -225,13 +225,13 @@ export default function VisionCameraScreen() {
225225
{...taskProps}
226226
activeModel={
227227
activeModel as
228-
| 'segmentation_deeplab_resnet50'
229-
| 'segmentation_deeplab_resnet101'
230-
| 'segmentation_deeplab_mobilenet'
231-
| 'segmentation_lraspp'
232-
| 'segmentation_fcn_resnet50'
233-
| 'segmentation_fcn_resnet101'
234-
| 'segmentation_selfie'
228+
| 'segmentationDeeplabResnet50'
229+
| 'segmentationDeeplabResnet101'
230+
| 'segmentationDeeplabMobilenet'
231+
| 'segmentationLraspp'
232+
| 'segmentationFcnResnet50'
233+
| 'segmentationFcnResnet101'
234+
| 'segmentationSelfie'
235235
}
236236
/>
237237
)}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { scheduleOnRN } from 'react-native-worklets';
55
import {
66
SegmentedInstance,
77
YOLO26N_SEG,
8-
RF_DETR_SEG,
8+
RF_DETR_NANO_SEG,
99
useInstanceSegmentation,
1010
CocoLabel,
1111
CocoLabelYolo,
@@ -40,7 +40,7 @@ export default function InstanceSegmentationTask({
4040
preventLoad: activeModel !== 'instanceSegmentation_yolo26n',
4141
});
4242
const rfdetr = useInstanceSegmentation({
43-
model: RF_DETR_SEG,
43+
model: RF_DETR_NANO_SEG,
4444
preventLoad: activeModel !== 'instanceSegmentation_rfdetr',
4545
});
4646

packages/react-native-executorch/common/rnexecutorch/utils/computer_vision/Processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ float computeIoU(const BBox &a, const BBox &b) {
1919
}
2020

2121
BBox scaleBBox(const BBox &box, float widthRatio, float heightRatio) {
22-
return BBox{
22+
return {
2323
.x1 = box.x1 * widthRatio,
2424
.y1 = box.y1 * heightRatio,
2525
.x2 = box.x2 * widthRatio,
@@ -28,7 +28,7 @@ BBox scaleBBox(const BBox &box, float widthRatio, float heightRatio) {
2828
}
2929

3030
BBox clipBBox(const BBox &box, float maxWidth, float maxHeight) {
31-
return BBox{
31+
return {
3232
.x1 = std::max(0.0f, box.x1),
3333
.y1 = std::max(0.0f, box.y1),
3434
.x2 = std::min(maxWidth, box.x2),

packages/react-native-executorch/common/rnexecutorch/utils/computer_vision/Processing.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Types.h"
44
#include <algorithm>
5+
#include <ranges>
56
#include <vector>
67

78
namespace rnexecutorch::utils::computer_vision {
@@ -18,8 +19,8 @@ std::vector<T> nonMaxSuppression(std::vector<T> items, double iouThreshold) {
1819
return {};
1920
}
2021

21-
std::sort(items.begin(), items.end(),
22-
[](const T &a, const T &b) { return a.score > b.score; });
22+
std::ranges::sort(items,
23+
[](const T &a, const T &b) { return a.score > b.score; });
2324

2425
std::vector<T> result;
2526
std::vector<bool> suppressed(items.size(), false);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ const YOLO26S_SEG_MODEL = `${URL_PREFIX}-yolo26-seg/${NEXT_VERSION_TAG}/yolo26s-
814814
const YOLO26M_SEG_MODEL = `${URL_PREFIX}-yolo26-seg/${NEXT_VERSION_TAG}/yolo26m-seg/xnnpack/yolo26m-seg.pte`;
815815
const YOLO26L_SEG_MODEL = `${URL_PREFIX}-yolo26-seg/${NEXT_VERSION_TAG}/yolo26l-seg/xnnpack/yolo26l-seg.pte`;
816816
const YOLO26X_SEG_MODEL = `${URL_PREFIX}-yolo26-seg/${NEXT_VERSION_TAG}/yolo26x-seg/xnnpack/yolo26x-seg.pte`;
817-
const RF_DETR_SEG_MODEL = `${URL_PREFIX}-rfdetr-nano-segmentation/${NEXT_VERSION_TAG}/rfdetr_segmentation.pte`;
817+
const RF_DETR_NANO_SEG_MODEL = `${URL_PREFIX}-rfdetr-nano-segmentation/${NEXT_VERSION_TAG}/rfdetr_segmentation.pte`;
818818
/**
819819
* @category Models - Instance Segmentation
820820
*/
@@ -858,9 +858,9 @@ export const YOLO26X_SEG = {
858858
/**
859859
* @category Models - Instance Segmentation
860860
*/
861-
export const RF_DETR_SEG = {
862-
modelName: 'rfdetr-seg',
863-
modelSource: RF_DETR_SEG_MODEL,
861+
export const RF_DETR_NANO_SEG = {
862+
modelName: 'rfdetr-nano-seg',
863+
modelSource: RF_DETR_NANO_SEG_MODEL,
864864
} as const;
865865

866866
// Image Embeddings

packages/react-native-executorch/src/hooks/computer_vision/useSemanticSegmentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { useModuleFactory } from '../useModuleFactory';
2121
* @example
2222
* ```ts
2323
* const { isReady, forward } = useSemanticSegmentation({
24-
* model: { modelName: 'deeplab-v3', modelSource: DEEPLAB_V3_RESNET50 },
24+
* model: { modelName: 'deeplab-v3-resnet50', modelSource: DEEPLAB_V3_RESNET50 },
2525
* });
2626
* ```
2727
*

packages/react-native-executorch/src/modules/computer_vision/InstanceSegmentationModule.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const YOLO_SEG_CONFIG = {
3434
},
3535
} satisfies InstanceSegmentationConfig<typeof CocoLabelYolo>;
3636

37-
const RF_DETR_SEG_CONFIG = {
37+
const RF_DETR_NANO_SEG_CONFIG = {
3838
preprocessorConfig: { normMean: IMAGENET1K_MEAN, normStd: IMAGENET1K_STD },
3939
labelMap: CocoLabel,
4040
availableInputSizes: undefined,
@@ -73,7 +73,7 @@ const ModelConfigs = {
7373
'yolo26m-seg': YOLO_SEG_CONFIG,
7474
'yolo26l-seg': YOLO_SEG_CONFIG,
7575
'yolo26x-seg': YOLO_SEG_CONFIG,
76-
'rfdetr-seg': RF_DETR_SEG_CONFIG,
76+
'rfdetr-nano-seg': RF_DETR_NANO_SEG_CONFIG,
7777
} as const satisfies Record<
7878
InstanceSegmentationModelName,
7979
| InstanceSegmentationConfig<typeof CocoLabel>
@@ -109,6 +109,7 @@ type ResolveLabels<T extends InstanceSegmentationModelName | LabelEnum> =
109109
*
110110
* Supported models (download from HuggingFace):
111111
* - `yolo26n-seg`, `yolo26s-seg`, `yolo26m-seg`, `yolo26l-seg`, `yolo26x-seg` - YOLO models with COCO labels (80 classes)
112+
* - `rfdetr-nano-seg` - RF-DETR Nano model with COCO labels (80 classes)
112113
*
113114
* @typeParam T - Either a pre-configured model name from {@link InstanceSegmentationModelName}
114115
* or a custom label map conforming to {@link LabelEnum}.

packages/react-native-executorch/src/types/instanceSegmentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export type InstanceSegmentationModelSources =
120120
| { modelName: 'yolo26m-seg'; modelSource: ResourceSource }
121121
| { modelName: 'yolo26l-seg'; modelSource: ResourceSource }
122122
| { modelName: 'yolo26x-seg'; modelSource: ResourceSource }
123-
| { modelName: 'rfdetr-seg'; modelSource: ResourceSource };
123+
| { modelName: 'rfdetr-nano-seg'; modelSource: ResourceSource };
124124

125125
/**
126126
* Union of all built-in instance segmentation model names.

0 commit comments

Comments
 (0)