vladmandic / human

Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gaze Tracking, Gesture Recognition
https://vladmandic.github.io/human/demo/index.html
MIT License
2.27k stars 320 forks source link

Not finding an face in the image, why? #99

Closed MuriloRS closed 3 years ago

MuriloRS commented 3 years ago

Issue Description No face is found in this image: https://www.jordanharbinger.com/wp-content/uploads/2018/09/be-the-most-interesting.jpg

My config const myConfig = { backend: 'tensorflow', console: true, videoOptimized: false, async: true, warmup: 'face', filter: { enabled: true, // enable image pre-processing filters width: 256, // resize input width height: 256, // resize input height // if both width and height are set to 0, there is no resizing // if just one is set, second one is scaled automatically // if both are set, values are used as-is return: true, // return processed canvas imagedata in result brightness: 1, // range: -1 (darken) to 1 (lighten) contrast: 0, // range: -1 (reduce contrast) to 1 (increase contrast) sharpness: 0, // range: 0 (no sharpening) to 1 (maximum sharpening) blur: 0, // range: 0 (no blur) to N (blur radius in pixels) saturation: 0, // range: -1 (reduce saturation) to 1 (increase saturation) hue: 0, // range: 0 (no change) to 360 (hue rotation in degrees) pixelate: 0, // range: 0 (no pixelate) to N (number of pixels to pixelate) }, mesh: { enabled: false, modelPath:file://src/models/facemesh.json, inputSize: 192, // fixed value, returnRawData: false // in addition to standard mesh and box values, return raw normalized values as well }, detector: { modelPath:file://src/models/blazeface-back.json`, // can be 'front' or 'back'. // 'front' is optimized for large faces // such as front-facing camera and // 'back' is optimized for distanct faces. inputSize: 256, // fixed value: 128 for front and 256 for 'back' rotation: false, // use best-guess rotated face image or just box with rotation as-is maxFaces: 1, // maximum number of faces detected in the input // should be set to the minimum number for performance skipFrames: 11, // how many frames to go without re-running the face bounding box detector // only used for video inputs // e.g., if model is running st 25 FPS, we can re-use existing bounding // box for updated face analysis as the head probably hasn't moved much // in short time (10 * 1/25 = 0.25 sec) minConfidence: 0.3, // threshold for discarding a prediction iouThreshold: 0.2, // threshold for deciding whether boxes overlap too much in // non-maximum suppression (0.1 means drop if overlap 10%) scoreThreshold: 0.5 // threshold for deciding when to remove boxes based on score // in non-maximum suppression, // this is applied on detection objects only and before minConfidence },

face: { enabled: true, detector: { modelPath: 'file://src/models/blazeface-front.json', enabled: true, rotation: true, return: true }, mesh: { modelPath: 'file://src/models/facemesh.json', enabled: true }, iris: { modelPath: 'file://src/models/iris.json', enabled: false }, description: { modelPath: 'file://src/models/faceres.json', enabled: true }, emotion: { modelPath: 'file://src/models/emotion.json', enabled: false }, age: { modelPath: 'file://src/models/age.json', enabled: false }, gender: { modelPath: 'file://src/models/gender.json', enabled: false }, embedding: { modelPath: 'file://src/models/mobileface.json', enabled: true }, }, // body: { modelPath: 'file://models/blazepose.json', enabled: true }, body: { modelPath: 'file://src/models/posenet.json', enabled: false }, hand: { enabled: false, detector: { modelPath: 'file://src/models/handdetect.json' }, skeleton: { modelPath: 'file://src/models/handskeleton.json' }, }, object: { modelPath: 'file://src/models/nanodet.json', enabled: false }, };`

The result:

{ face: [], body: [], hand: [], gesture: [], object: [], performance: { backend: 1, load: 212, image: 0, total: 291 }, canvas: null }

Why is not finding an face in that image?

**Environment

vladmandic commented 3 years ago

using blazeface-front model it doesn't detect a person as that model is trained for center-aligned faces,
this photo is too far to the edge. and in general blazeface-front model is good only for webcam input, not for photos.

use blazeface-back model (which is default for a good reason) and it works fine:

# node demo/node.js /tmp/be-the-most-interesting.jpg
2021-04-12 20:53:42 INFO:  @vladmandic/human version 1.4.3
...
2021-04-12 20:53:42 STATE:  Processing: [ 1, 1400, 1400, 3, [length]: 4 ]
2021-04-12 20:53:44 DATA:  Results:
2021-04-12 20:53:44 DATA:    Face: #0 boxConfidence:0.69 faceConfidence:0.69 age:48.3 genderConfidence:0.84 gender:male emotionScore:0.92 emotion:sad iris:4.89
2021-04-12 20:53:44 DATA:    Gesture: face#0 gesture:facing camera
2021-04-12 20:53:44 DATA:    Gesture: iris#0 gesture:looking at camera
2021-04-12 20:53:44 DATA:    Object: #0 score:0.36 label:person