Cannot read images from Tensorflow.js Tensorcamera on React Native
See original GitHub issueI am trying to use Tensorflow.js posenet on React Native but I can not get ‘images’. Currently Expo-camera works ok, but images is undefined. Please advise how to iterate getting images from TensorCamera. Thanks.
const TensorCamera = cameraWithTensors(Camera);
export default class MyComponent extends React.Component {
constructor(props) {
super(props);
this.handleCameraStream = this.handleCameraStream.bind(this);
}
async estimatePoseOnImage(imageElement) {
const net = await posenet.load();
const pose = await net.estimateSinglePose(imageElement, {
flipHorizontal: false,
});
this.setState({ pose: pose });
return pose;
}
handleCameraStream( images ) {
const loop = async () => {
const nextImageTensor = await images.next().value;
await this.estimatePoseOnImage(nextImageTensor);
requestAnimationFrame(loop);
};
loop();
}
render() {
return (
<View>
<TensorCamera
type={Camera.Constants.Type.front}
onReady={this.handleCameraStream}
autorender={true}
/>
</View>
);
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Cannot read images from Tensorflow.js Tensorcamera on ...
js posenet on React Native but I can not get 'images'. Currently Expo-camera works ok, but images is undefined, and it also shows....
Read more >DevAsking.com - The issue Cannot read images from... | Facebook
The issue Cannot read images from Tensorflow.js Tensorcamera on React Native has new answer.
Read more >Real Time Image Classification with TensorFlow and React ...
In this tutorial we will implement a simple mobile app that acts as a pictionary (picture dictionary) for a specific language by using...
Read more >tf.io.RequestDetails - TensorFlow.js React Native API
Utilities for dealing with images and cameras. Media / Images. decodeJpeg (contents, channels?) function Source. Decode a ...
Read more >Using TensorFlow.js in a Native iOS App to Perform Object ...
tflite model to your project. To help solve this problem, let's take a look how we can apply a JavaScript version of TensorFlow...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m trying to follow this demo => https://github.com/tensorflow/tfjs/blob/master/tfjs-react-native/integration_rn59/components/webcam/realtime_demo.tsx, but none of the models’ load. I’m using expo to make the test. @rthadur @tafsiri
@sauceishere Could you try changing your react import to
import * as React from 'react';
and having your main component extend React.Component. Newer versions of expo use a different import format that what is used in the integration_test app.If that doesn’t work then from looking at the error stack it seemed to be coming from react-native-svg, so I would first remove all the things from the app other than the model loading and inference and make sure that works before introducing rendering.