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

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Most upvoted comments

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).

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",

Same problem over here - how to fix this?