tfjs-react-native: Error ‘func is not a function’

Created on 6 Sep 2020  Â·  15Comments  Â·  Source: tensorflow/tfjs

TensorFlow.js version

"@tensorflow/tfjs": "^2.3.0"
"@tensorflow/tfjs-react-native": "^0.3.0"

Describe the problem or feature request

Hi. I'm trying to run tfjs-react-native project realtime_demo with my android smartphone, but I'm stuck with TensorCamera.

My project directory is here, and if you need more files to inspect error just ask. The error I’m getting is this.

error2

When I debugged my project, I found out that when TensorCamera triggers onReady and calls handleImageTensorReady, the first argument of handleImageTensorReady - which is images - are not passed properly thus undefined. That's why my code gets stuck when const imageTensor = images.next().value; is called.

I'm using bare workflow with react-native-unimodules attached manually, but just to check I also tried using expo-managed-example. It throws the same func is not a function error.

What is causing this problem? Is it because the testing device I'm using too old to run tensorflow modules? Plz help.

ps1.

I'm sure this error is not related to loading tensorflow models (blazeface, posenet) because when I comment out all model-related codes from the demo project, I still get same func is not a function error.

I'm sure TensorCamera is the problem because when I changed TensorCamera to ordinary Camera module from "expo-camera", no error occurred.

ps2.

I've borrowed Galazy S20 from one of my friends and test the project, and I got the some error. The problem was not with smartphone itself.

react-native stalled awaiting response bug

Most helpful comment

I think we have a bug in 2.3.0, so I would suggest downgrading to an earlier version until our next release is out (should be this week).

All 15 comments

After days of research, I found out it was problem with version. In my project where error occurred, I just installed packages using yarn, so I used "@tensorflow/tfjs": "^2.3.0" and "@tensorflow/tfjs-react-native": "^0.3.0".

When I changed my module dependencies (in package.json) as listed in here, finally everything started to work correctly.

I'm kind of beginner to react-native, so I don't know which modules resulted crush exactly. Maybe most recent version of tfjs-react-native broke capabilities with some libraries. Hope Amazing contributers of this repo finds out error soon and fit it.

Same problem over here - how to fix this?

Same for me, the TensorCamera component does not render properly and give the error described above.

    "@tensorflow/tfjs": "^2.3.0",
    "@tensorflow/tfjs-automl": "^1.0.0",
    "@tensorflow/tfjs-react-native": "^0.3.0",
    "expo-av": "^8.4.0",
    "expo-camera": "^8.3.1",
    "expo-gl": "^8.4.0",
    "expo-gl-cpp": "^8.4.0",
    "expo-image-manipulator": "^8.2.1",
    "expo-permissions": "^9.1.0",

I had the same issue then I upgraded tf-backend-webgl and it worked.

I think we have a bug in 2.3.0, so I would suggest downgrading to an earlier version until our next release is out (should be this week).

@tafsiri thanks for the quick info, we are working around this issue for now, looking forward to the bugfix release

@tafsiri were you referring to the recent 2.4.0 release? Unfortunately just updating tfjs from 2.3.0 to 2.4.0 did not fix this for me.

Having the same issue. Interestingly, upgrading to tfjs 2.4.0 and to the newest expo-camera, expo-gl and expo-gl-cpp packages solved the issue for a while, but then I had the laptop shutdown while the react native server was running, restarted the laptop, built the app again and the issue returned.

It's a far fetch correlation and I've tried deleting node modules folder and cleaning up android builds thinking something got corrupted, but to no avail.

@Snupas, @rohail0 or anyone else still seeing this, would you be able to post a link to a minimal reproduction of this as a github repo (using 2.4.0)?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 dyas if no further activity occurs. Thank you.

@tafsiri sorry for the delay, forked the repo to try to expose this on the test integration_rn59 app. All I did was update most of the libraries to newer versions. https://github.com/rohail0/tfjs/tree/bug-func-is-not-function/tfjs-react-native/integration_rn59
Also, as a note, I've only tested this on Android so that's the only one I've updated in that branch.

This should be fixed in the just released 0.4.0. Thanks for reporting and please let us know if this doesn't resolve the issue for you.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 dyas if no further activity occurs. Thank you.

Closing as stale. Please @mention us if this needs more attention.

Are you satisfied with the resolution of your issue?
Yes
No

Was this page helpful?
0 / 5 - 0 ratings

Related issues

take-kuma picture take-kuma  Â·  3Comments

beele picture beele  Â·  3Comments

nsthorat picture nsthorat  Â·  3Comments

ritikrishu picture ritikrishu  Â·  4Comments

rumschuettel picture rumschuettel  Â·  3Comments