首页 > 解决方案 > TypeError: t.toFloat is not a function TensorFlow with Angular

问题描述

I am trying to integrate TensorFlow Facemesh in Angular Application. I have imported all required modules and tried different model.

I am using following :

import * as tf from '@tensorflow/tfjs';
import * as facemesh from '@tensorflow-models/facemesh';

Function :

    const faceEstimate = await model.estimateFaces(video));
    console.log(faceEstimate);

I am facing this error :

(in promise): TypeError: t.toFloat is not a function
TypeError: t.toFloat is not a function
    at facemesh.esm.js:17

I using Angular 10. Please help with this.

Update: I tried a Different Model with MediaPipe, which also gives the same error.

标签: angulartypescripttensorflow

解决方案


有同样的问题并通过当前降级到 2.6.0 "@tensorflow/tfjs-backend-webgl": "^2.6.0", "@tensorflow/tfjs-converter": "^2.6.0", "@tensorflow/tfjs-core": "^2.6.0",


推荐阅读