Face-api.js: Uncaught (in promise) TypeError: faceapi.drawDetection is not a function

Created on 2 Aug 2019  路  2Comments  路  Source: justadudewhohacks/face-api.js

$(document).ready(function(){
run()
})
async function run(){
await faceapi.loadMtcnnModel('./models');
await faceapi.loadFaceRecognitionModel('./models');
const videoEl=document.getElementById('inputVideo')
navigator.getUserMedia(
{video:{}},
stream=>videoEl.srcObject=stream,
err=>console.err(err)
)
}
async function onPlay(videoEl){

setInterval( async ()=>{console.log('it is running');

const mtcnnForwardParams = {
maxNumScales: 10,
scaleFactor: 0.709,
scoreThresholds: [0.6, 0.7, 0.7],
minFaceSize: 200
}
const canvas=document.getElementById('overlay')
const mtcnnResults=await faceapi.mtcnn(videoEl,mtcnnForwardParams)
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height)
faceapi.drawDetection(canvas, mtcnnResults.map(res => res.faceDetection), { withScore: false })
faceapi.drawLandmarks(canvas, mtcnnResults.map(res => res.faceLandmarks), { lineWidth: 4, color: 'red' })
},1000)
}

this is my javascript code,i got this error,please help to sort out

script2.js:27 Uncaught (in promise) TypeError: faceapi.drawDetection is not a function
at script2.js:27

Most helpful comment

faceapi.drawDetections is not part of faceapi anymore, please use the up to date examples.

All 2 comments

in faceapi.js also there is no drawDetection( 0,0 ,0 ) with three arguments

faceapi.drawDetections is not part of faceapi anymore, please use the up to date examples.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fakob picture fakob  路  6Comments

gmanojisaac picture gmanojisaac  路  6Comments

swapanil picture swapanil  路  5Comments

LeonardoDB picture LeonardoDB  路  6Comments

SunilKapadia1208 picture SunilKapadia1208  路  7Comments