DEV Community

Discussion on: Setup Tensorflow.js to React Native Expo project

Collapse
 
subodha profile image
Subodha Pathiraja • Edited

This is really cool.
I have tried to do the same and integrate mobilenet modle into react-native.
But getting some errors.

dev-to-uploads.s3.amazonaws.com/i/...

Could you please help me on this

Collapse
 
agiledom profile image
Agiledom

I believe bundleResourceIO cannot be used by managed expo apps. See API docs here:-
js.tensorflow.org/api_react_native...

@subodha Pathiraja - this might explain the error you have highlighted.

Collapse
 
stpov profile image
Stanislav
Collapse
 
lankinen profile image
Lankinen

I actually started to use this for a different model and got the same error. Mobilenet actually works when you use it certain way (if I remember correctly). Try if you use this code

import * as mobilenet from '@tensorflow-models/mobilenet';
...
const model = await mobilenet.load();
const predictions = await model.classify(img);

I just created a new issue github.com/tensorflow/tfjs/issues/... which hopefully is noticed by someone for tf team and not deleted as I'm always bad at following issue templates. I started looking this problem on my own and tried to fix it without success. I try to have more time in the near future. Please let everyone know if you solve it and I will do the same.

Collapse
 
subodha profile image
Subodha Pathiraja

Hi, Thanks for the quick reply. I just try to use mobilenet like you have mentioned above but it still giving me the same error.

If you have any working code related to this could you please share with me to get an idea. I really appreciate your help since this is really helpful to continue my research. Thanks again