-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 2.0.1 seems to fail on Expo 50 and 1.0.0 seems to hang #170
Comments
We have our own Tensor Flow Lite model and this library seems to work very well on iOS for object detection using this model. We call Code snippet:
Have we missed some important configuration? |
I am unable to get results of my TFLite model, which was previously used successfully with the const MODELS: AssetRecord = {
// the name you'll use to refer to the model
mfi: {
// the relative path to the model file
model: require('../src/assets/tflite/model.tflite'),
options: {
// the options you want to use for this model
shouldEnableMultipleObjects: false,
shouldEnableClassification: false,
detectorMode: 'stream',
// maxPerObjectLabelCount: 1,
},
},
};
const { ObjectDetectionModelContextProvider } = useObjectDetectionModels({
assets: MODELS,
loadDefaultModel: false,
});
<ObjectDetectionModelContextProvider>
<Stack
initialRouteName="(app)/(auth)/home"
screenOptions={{
headerShown: false,
presentation: 'fullScreenModal',
}}
/> Then, I consume the model: const model = useObjectDetector('mfi');
const [modelLoaded, setModelLoaded] = useState(model?.isLoaded() ?? false);
useEffect(() => {
async function loadModel() {
if (!model || modelLoaded) return;
await model.load();
setModelLoaded(true);
}
loadModel();
}, [model, modelLoaded]); and invoke the detection from camera photo: const capturePhoto = async () => {
if (!cameraRef?.current) {
setMessage([
'error',
'Something went wrong. Unable to capture photo. Please reload & try again.',
]);
return;
}
const photo = await cameraRef.current?.takePhoto({
flash: flash,
});
const detectionResult = await model?.detectObjects(photo.path);
console.log(JSON.stringify(detectionResult));
setResult(detectionResult);
setPhoto(photo.path);
}; my output of the So there are no |
There were some underlying issues with the types. I'll have to see if we can release a maintenance patch for 1.0, but in the meantime the issues will be fixed in v3.0 when it gets released. |
Background
We have an Expo 50 React Native app written in Typescript that makes use of our backend API for object detection in images captured by our users. We wanted to try out your library to see if we can do this on-device (iOS and Android devices).
Our app uses these relevant libs in
package.json
:Issue
We installed the latest version of your library (v2.0.1) and then tried a simple thing where we just added your provider into our
App.tsx
file as follows:We built a new dev client for iOS on expo but it failed with this error:
We then checked you releases and found that v1.0.0 is where you first added support for Expo 50 so installed that version instead. With v1.0.0, the Expo build succeeded.
We then installed the dev client on an iPhone 11 Pro with iOS v17.7 and ran the app using
yarn start
and then scanned the QR code. The app started up and then immediately exited.We then tried the same thing but on a Google Pixel 4a with Android v34. On that device it seemed to hang on our splash screen.
We tried to investigate your code and found that the function
useObjectDetectionModels
innode_modules/@infinitered/react-native-mlkit-object-detection/build/useObjectDetectionModels.js
seemed to be stuck in a recursive call toloadModels
. We added this patch to this file:and that seemed to have resolved the issue.
We are reporting this issue to you in the hope that you can fix it in the latest version of your library. In the meantime, we are continuing to investigate your library to see if it meets our needs.
The text was updated successfully, but these errors were encountered: