Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot read property 'descriptor' of undefined #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ersaurabh101 opened this issue May 7, 2020 · 3 comments
Open

Cannot read property 'descriptor' of undefined #4

ersaurabh101 opened this issue May 7, 2020 · 3 comments

Comments

@ersaurabh101
Copy link

Hii,

I added new folder name

const labels = ['Black Widow', 'Captain America', 'Captain Marvel', 'Hawkeye', 'Jim Rhodes', 'Thor', 'Tony Stark','Bhaiya']

It has 2 images 1.jpg , 2.jpg

After adding this in labels, page is showing error in console.log

script.js:46 Uncaught (in promise) TypeError: Cannot read property 'descriptor' of undefined at script.js:46 at async Promise.all (/tensorflow-web/index 7) at async start (script.js:13)

what is wrong i am doing, here is the entire function-

function loadLabeledImages() {
  const labels = ['Black Widow', 'Captain America', 'Captain Marvel', 'Hawkeye', 'Jim Rhodes', 'Thor', 'Tony Stark','Bhaiya']
  return Promise.all(
    labels.map(async label => {
      const descriptions = []
      for (let i = 1; i <= 2; i++) {
        const img = await faceapi.fetchImage(`labeled_images/${label}/${i}.jpg`)
        const detections = await faceapi.detectSingleFace(img).withFaceLandmarks().withFaceDescriptor()
        descriptions.push(detections.descriptor)
      }

      return new faceapi.LabeledFaceDescriptors(label, descriptions)
    })
  )
}
@yx-yangxiao
Copy link

have you resolve it,l got a new problem l can`t fetch the picture :|

@Purukitto
Copy link

@ersaurabh101 This happens when it cant find a face in the image, just use clearer images

@deepsingh245
Copy link

i am facing the same issue, after searching it said descriptor is the numeric vector for the image it detected ,
since it is undefined means it did not detect any face at all, i dont know how to resolve it either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants