feat: add integration with vision camera v5#810
feat: add integration with vision camera v5#810NorbertKlockiewicz wants to merge 26 commits intomainfrom
Conversation
96f2c14 to
f3e17e2
Compare
packages/react-native-executorch/common/rnexecutorch/host_objects/JsiConversions.h
Outdated
Show resolved
Hide resolved
packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h
Show resolved
Hide resolved
packages/react-native-executorch/common/rnexecutorch/metaprogramming/TypeConcepts.h
Show resolved
Hide resolved
packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp
Outdated
Show resolved
Hide resolved
c1ff490 to
983242e
Compare
msluszniak
left a comment
There was a problem hiding this comment.
LGTM, but I would wait for a review from someone that knows TS more than me ;)
| /** | ||
| * Thrown when a feature or platform is not supported in the current environment. | ||
| */ | ||
| PlatformNotSupported = 119, |
There was a problem hiding this comment.
Make sure to add this to error handling docs
| model, | ||
| preventLoad: preventLoad, | ||
| }); | ||
| }) as ObjectDetectionType; |
There was a problem hiding this comment.
do we need the type assertion here?
| const [isGenerating, setIsGenerating] = useState(false); | ||
| const [downloadProgress, setDownloadProgress] = useState(0); | ||
| const [moduleInstance] = useState(() => new module()); | ||
| const [runOnFrame, setRunOnFrame] = useState<any>(null); |
| // Use "state trick" to make the worklet serializable for VisionCamera | ||
| if ('runOnFrame' in moduleInstance) { | ||
| const worklet = moduleInstance.runOnFrame; | ||
| if (worklet) { | ||
| setRunOnFrame(() => worklet); | ||
| } | ||
| } |
There was a problem hiding this comment.
Maybe it would be explaining what the state trick is and why we need it
| export interface PixelData extends Omit<TensorPtr, 'dataPtr' | 'scalarType'> { | ||
| /** | ||
| * RGB pixel data as Uint8Array. | ||
| * Expected format: RGB (3 channels), not RGBA or BGRA. | ||
| * Size must equal: width * height * 3 | ||
| */ | ||
| dataPtr: Uint8Array; |
There was a problem hiding this comment.
I think this should be Pick instead
74be0c6 to
28a7bad
Compare
|
I think you need to rebase because your changes to auto-generated api is as for the older code (before my commit with packages bump). |
02bb7aa to
6ee9f4d
Compare
packages/react-native-executorch/common/rnexecutorch/models/VisionModel.h
Outdated
Show resolved
Hide resolved
|
The memory leak we've catched is caused by vision camera and hopefully will be fixed soon. The PR should be now ready to merge, just need an approve from @chmjkb |
Description
This PR adds real-time camera frame processing capabilities to React Native ExecuTorch by integrating with VisionCamera v5. It introduces a new VisionModule base class and extends ObjectDetectionModule to support three input methods: image URLs/paths, raw pixel data (PixelData), and live camera frames.
This PR includes:
Introduces a breaking change?
Type of change
Tested on
Testing instructions
Run the computer vision example app and test object detection and object detection (live)
Screenshots
Related issues
Checklist
Additional notes