无法在 React Native 上从 Tensorflow.js Tensorcamera 读取图像

Cannot read images from Tensorflow.js Tensorcamera on React Native

我正在尝试在 React Native 上使用 Tensorflow.js posenet,但我无法获得 'images'。
目前 Expo-camera 工作正常,但 images 未定义,并且还显示

Can't find variable: React

请告知如何迭代从 TensorCamera 获取图像。
谢谢

import * as React from 'react';
import { Text, View, StyleSheet, Image, Platform } from 'react-native';
import { Camera } from 'expo-camera';
import { cameraWithTensors } from '@tensorflow/tfjs-react-native';
import * as posenet from '@tensorflow-models/posenet';
import * as tf from '@tensorflow/tfjs';

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>
    );
  }
}
<TensorCamera
    ref={(ref) => { this.camera = ref }}
    type={Camera.Constants.Type.front}
    resizeHeight={64}
    resizeWidth={64}
    resizeDepth={3}
    onReady={this.handleCameraStream}
    style={{width: width, height: height}}
/>

你必须通过resizeHeight、resizeWidth、resizeDepth来获取张量。它对我有用。