Javascript 从图像列表中检测本地人脸

Javascript 从图像列表中检测本地人脸,javascript,android,reactjs,react-native,Javascript,Android,Reactjs,React Native,我想从相册中列出的图像列表中检测人脸 这是我的密码 // get All images from particular album await CameraRoll.getPhotos({ first: count, after, assetType: 'Photos', groupTypes: 'All', groupName: this.props.navigation.stat

我想从相册中列出的图像列表中检测人脸

这是我的密码

  // get All images from particular album

    await CameraRoll.getPhotos({
          first: count,
          after,
          assetType: 'Photos',
          groupTypes: 'All',
          groupName: this.props.navigation.state.params.album,
        })
          .then(r => {
            this.setState({ data: r.edges, isLoading: false, });

            this.state.data.map((p, index) => {
              this.getFaces(p.node.image.uri);
            });
          })
}
//从图像列表中检测人脸

async getFaces(uri) {
    await FaceDetector.detectFacesAsync(uri).then(res => {
      if (res.faces.length > 0) {
        console.log('Has faces: ' + uri);
        this.state.faceImage.push(uri);  // array of face images and set it to Flatlist
      } else {
        console.log('No faces: ' + uri);
      }
    });

      this.setState({
        faceImage: this.state.faceImage,
        isLoading: false,
      });

  }

所有的事情都正常工作,但当图像数组的大小很大时,我的应用程序就卡住了,只能在android设备上关闭

当阵列的大小太大时,尝试将其拆分为新阵列

您是否尝试将其保存到文件并从中加载