Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
"Error: EuclideanDistance: arr1.longitud! == arr2.longitud" en face-api

Actualmente estoy creando un sistema de reconocimiento facial usando esta API: https://github.com/justadudewhohacks/face-api.js/

Referencia: https://blog.mdzulkarnine.com/building-face-recognition-api-with-nodejs-expressjs-mongodb-face-apijs

En el lado del cliente, después de la detección exitosa de la cara, obtendrá la solicitud posterior al servidor y enviará la detección redimensionada

 $("#face").attr("src",img_data); const input = await $('#face')[0]; const detection = await faceapi.detectAllFaces(input).withFaceLandmarks().withFaceDescriptors(); const resized = await faceapi.resizeResults(detection, displaySize); if(!fetched && resized) { fetched = true; await fetch('/establishment/verify', { method: 'POST', headers: { "content-type": "application/json" }, body: JSON.stringify({ resized }) // descriptor }) .then((response)=> { console.log(response); }); }

En el servidor, aceptará la detección redimensionada del lado del cliente.

 const verification_post = async (req, res) => { try { const resizedDetections = req.body.resized; let visitors = await Visitor.find(); for(i=0;i<visitors.length;i++) { for (j = 0; j < visitors[i].descriptions.length; j++) { visitors[i].descriptions[j] = new Float32Array(Object.values(visitors[i].descriptions[j])); } visitors[i] = new faceapi.LabeledFaceDescriptors(visitors[i]._id.toString(), visitors[i].descriptions); } const faceMatcher = new faceapi.FaceMatcher(visitors, 0.6); console.log("Faces: ", visitors); console.log("Resized Detections: ", resizedDetections); const results = resizedDetections.map((des) => faceMatcher.findBestMatch(des.descriptor)); } catch (error) { console.log(error); res.status(400).send(error); } }

Los visitantes y la detección redimensionada se muestran correctamente, pero no proceden a la parte de los resultados y devuelven el error "Error: EuclideanDistance: arr1.length !== arr2.length". ¿Hay alguien que haya intentado trabajar con él?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!