Open jolo-dev opened 4 weeks ago
hey @jolo-dev can you try switching that item that isn't found to RNMLKitObjectDetectionObject
and the hook should just return the model directly, not an object.
You can use the Example App for reference.
Hi @frankcalise,
Thanks for commenting. I adjusted the code accordingly.
Now, I get following error when I want to use the ObjectDetectionModelContextProvider
.
ERROR Error: Cannot find native module 'RNMLKitObjectDetection', js engine: hermes
at ContextNavigator
I am on expo SDK 51. My client has version 2.31.2
Here my very simplified code
import React from 'react';
import { View, Button, Text } from 'react-native';
import {
useObjectDetectionModels,
} from "@infinitered/react-native-mlkit-object-detection";
export function CameraScreen() {
const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({
loadDefaultModel: true,
defaultModelOptions: {
shouldEnableMultipleObjects: true,
shouldEnableClassification: true,
detectorMode: "stream",
},
});
return (
<View style={styles.container}>
<ObjectDetectionModelContextProvider>
<MyComponent />
</ObjectDetectionModelContextProvider>
</View>
);
}
I took the example from the docs here and noticed many errors which I cannot make work :/
https://github.com/user-attachments/assets/d09daf3e-c09b-4be0-b487-21201ca99902