繁体   English   中英

如何正确实施 tensorflow.js?

[英]how can I impelement tensorflow.js correctly?

我正在尝试使用 TensorFlow JavaScript 模型实现人脸检测,但是当我运行它时出现问题,错误的上下文是:

ERROR in ./src/App.js 22:50-108 export 'SupportedPackages' (imported as 'faceLandmarksDetection') was not found in '@tensorflow-models/face-landmarks-detection' (possible exports: SupportedModels, createDetector, util)

我认为这已被弃用,错误中提到的代码部分是:

  const runFacemesh = async () => {
    const net = await faceLandmarksDetection.load(
      faceLandmarksDetection.SupportedPackages.mediapipeFacemesh
    );

您可以使用我在下面放置的链接访问代码:

https://github.com/mohamad-sw/facemesh

而不是 .load() 函数使用

const detectorConfig = {
  runtime: 'tfjs',
  solutionPath: 'https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh',
}
model = await faceLandmarksDetection.createDetector(faceLandmarksDetection.SupportedModels.MediaPipeFaceMesh, detectorConfig);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM