DetectFaces procedure

Official Content
This documentation is valid for:

Detects faces that appear in an image.

Parameters

x

Configuration

The following table resumes the configuration properties (access credentials) you must set in order to use this AI task.

Property Amazon WS Google Cloud AI IBM Watson Microsoft Azure SAP Leonardo Tencent AI
Id - - - - - 人脸检测与分析
Key Rekognition Cloud Vision API Visual Recognition Computer Vision - 人脸检测与分析
SecretKey Rekognition - - - - -

Sample

Taking the following image input, the table below shows how faces are identified for each provider (as a JSON structure) and the time it takes for processing it.

GeneXusAI - Image module - Sample

Provider Output Benchmark
Amazon WS
[{
    "label": "Female",
    "confidence": 0.999,
    "top": 433,
    "left": 453,
    "width": 92,
    "height": 131,
    "Info": [{
            "property": "Chinbottom",
            "value": "{
                'X': 0.58294,
                'Y': 0.65531
            }"
        }, {
            "property": "Eyeleft",
            "value": "{
                'X': 0.55245,
                'Y': 0.56365
            }"
        }, {
            "property": "Eyeright",
            "value": "{
                'X': 0.60476,
                'Y': 0.56093
            }"
        }, {
            "property": "Lefteyebrowleft",
            "value": "{
                'X': 0.53189,
                'Y': 0.55226
            }"
        }, {
            "property": "Lefteyebrowright",
            "value": "{
                'X': 0.56244,
                'Y': 0.54663
            }"
        }, {
            "property": "Lefteyebrowup",
            "value": "{
                'X': 0.54712,
                'Y': 0.54475
            }"
        }, {
            "property": "Lefteyedown",
            "value": "{
                'X': 0.55310,
                'Y': 0.56589
            }"
        }, {
            "property": "Lefteyeleft",
            "value": "{
                'X': 0.54364,
                'Y': 0.56383
            }"
        }, {
            "property": "Lefteyeright",
            "value": "{
                'X': 0.56287,
                'Y': 0.56350
            }"
        }, {
            "property": "Lefteyeup",
            "value": "{
                'X': 0.55249,
                'Y': 0.56091
            }"
        }, {
            "property": "Leftpupil",
            "value": "{
                'X': 0.55245,
                'Y': 0.56365
            }"
        }, {
            "property": "Midjawlineleft",
            "value": "{
                'X': 0.53448,
                'Y': 0.62530
            }"
        }, {
            "property": "Midjawlineright",
            "value": "{
                'X': 0.62797,
                'Y': 0.62041
            }"
        }, {
            "property": "Mouthdown",
            "value": "{
                'X': 0.58155,
                'Y': 0.62675
            }"
        }, {
            "property": "Mouthleft",
            "value": "{
                'X': 0.55958,
                'Y': 0.61821
            }"
        }, {
            "property": "Mouthright",
            "value": "{
                'X': 0.60299,
                'Y': 0.61592
            }"
        }, {
            "property": "Mouthup",
            "value": "{
                'X': 0.58079,
                'Y': 0.61035
            }"
        }, {
            "property": "Nose",
            "value": "{
                'X': 0.58007,
                'Y': 0.59092
            }"
        }, {
            "property": "Noseleft",
            "value": "{
                'X': 0.57044,
                'Y': 0.59809
            }"
        }, {
            "property": "Noseright",
            "value": "{
                'X': 0.58980,
                'Y': 0.59679
            }"
        }, {
            "property": "Righteyebrowleft",
            "value": "{
                'X': 0.59317,
                'Y': 0.54503
            }"
        }, {
            "property": "Righteyebrowright",
            "value": "{
                'X': 0.62474,
                'Y': 0.54750
            }"
        }, {
            "property": "Righteyebrowup",
            "value": "{
                'X': 0.60863,
                'Y': 0.54151
            }"
        }, {
            "property": "Righteyedown",
            "value": "{
                'X': 0.60381,
                'Y': 0.56324
            }"
        }, {
            "property": "Righteyeleft",
            "value": "{
                'X': 0.59385,
                'Y': 0.56188
            }"
        }, {
            "property": "Righteyeright",
            "value": "{
                'X': 0.61300,
                'Y': 0.56021
            }"
        }, {
            "property": "Righteyeup",
            "value": "{
                'X': 0.60393,
                'Y': 0.55823
            }"
        }, {
            "property": "Rightpupil",
            "value": "{
                'X': 0.60476,
                'Y': 0.56093
            }"
        }, {
            "property": "Upperjawlineleft",
            "value": "{
                'X': 0.52006,
                'Y': 0.56693
            }"
        }, {
            "property": "Upperjawlineright",
            "value": "{
                'X': 0.63647,
                'Y': 0.56082
            }"
        }, {
            "property": "Gender",
            "value": "Female"
        }, {
            "property": "Gender Score",
            "value": "0.750"
        }, {
            "property": "Age Min",
            "value": "26"
        }, {
            "property": "Age Max",
            "value": "43"
        }, {
            "property": "Beard",
            "value": "false"
        }, {
            "property": "Beard Score",
            "value": "0.995"
        }, {
            "property": "Eyeglasses",
            "value": "false"
        }, {
            "property": "Eyeglasses Score",
            "value": "0.986"
        }, {
            "property": "Eyes Open",
            "value": "true"
        }, {
            "property": "Eyes Open Score",
            "value": "1.000"
        }, {
            "property": "Mouth Open",
            "value": "true"
        }, {
            "property": "Mouth Open Score",
            "value": "0.999"
        }, {
            "property": "Mustache",
            "value": "false"
        }, {
            "property": "Mustache Score",
            "value": "0.999"
        }, {
            "property": "Smile",
            "value": "true"
        }, {
            "property": "Smile Score",
            "value": "0.999"
        }, {
            "property": "Sunglasses",
            "value": "true"
        }, {
            "property": "Sunglasses Score",
            "value": "0.986"
        }, {
            "property": "Emotion Angry",
            "value": "0.03148"
        }, {
            "property": "Emotion Calm",
            "value": "0.04797"
        }, {
            "property": "Emotion Confused",
            "value": "0.00000"
        }, {
            "property": "Emotion Disgusted",
            "value": "0.11313"
        }, {
            "property": "Emotion Happy",
            "value": "0.927"
        }, {
            "property": "Emotion Sad",
            "value": "0.00289"
        }, {
            "property": "Emotion Surprised",
            "value": "6.93511"
        }, {
            "property": "Pose Pitch",
            "value": "-0.20080"
        }, {
            "property": "Pose Roll",
            "value": "-4.16584"
        }, {
            "property": "Pose Yaw",
            "value": "-1.55775"
        }
    ]
}]

GeneXusAI - Amazon - DetectFaces
13358ms
Google Cloud AI
[{
    "label": "Face 1",
    "confidence": 0.9711827,
    "top": 499,
    "left": 517,
    "width": 181,
    "height": 210,
    "Info": [{
            "property": "Angle",
            "value": "-3.24046"
        }, {
            "property": "PanAngle",
            "value": "0.92209"
        }, {
            "property": "TitlAngle",
            "value": "4.52504"
        }, {
            "property": "LandmarkingConfidence",
            "value": "0.46889"
        }, {
            "property": "left_eye",
            "value": "{
            	'x': 580.1488,
            	'y': 592.61914,
            	'z': -0.0009537811
            }"
        }, {
            "property": "right_eye",
            "value": "{
            	'x': 634.6278,
            	'y': 589.59705,
            	'z': 0.87478584
            }"
        }, {
        ...
        }, {
            "property": "chin_left_gonion",
            "value": "{
            	'x': 554.4516,
            	'y': 659.24805,
            	'z': 39.453327
            }"
        }, {
            "property": "chin_right_gonion",
            "value": "{
            	'x': 666.07837,
            	'y': 653.048,
            	'z': 41.252846
            }"
        }
    ]
}]

GeneXusAI - Google - DetectFaces
929ms
IBM Watson
[{
    "label": "MALE",
    "confidence": 0.903327775,
    "top": 556,
    "left": 537,
    "width": 127,
    "height": 145,
    "Info": [{
        "property": "Gender",
        "value": "MALE"
    }, {
        "property": "Gender Score",
        "value": "0.90615"
    }, {
        "property": "Age Min",
        "value": "26.00000"
    }, {
        "property": "Age Max",
        "value": "29.00000"
    }, {
        "property": "Age Score",
        "value": "0.90051"
    }]
}]
GeneXusAI - IBM - DetectFaces
8682ms
Microsoft Azure
[{
    "label": "Male",
    "confidence": 1.0,
    "top": 545,
    "left": 539,
    "width": 133,
    "height": 133,
    "Info": [{
        "property": "Age",
        "value": "33.00000"
    },
    {
        "property": "Gender",
        "value": "Male"
    }]
}]
GeneXusAI - Microsoft - DetectFaces
3412ms
SAP Leonardo
[{
    "label": "Face 1",
    "confidence": 1.0,
    "top": 555,
    "left": 540,
    "width": 129,
    "height": 129
}]

GeneXusAI - SAP - DetectFaces
17681ms
Tencent AI
[{
    "label": "2916682081710921705",
    "confidence": 1,
    "top": 442,
    "left": 432,
    "width": 118,
    "height": 118,
    "Info": [{
            "property": "AGE",
            "value": "0.230"
        }, {
            "property": "GENDER",
            "value": "0.990"
        }, {
            "property": "EXPRESSION",
            "value": "0.970"
        }, {
            "property": "BEAUTY",
            "value": "0.810"
        }, {
            "property": "GLASS",
            "value": "1.0"
        }, {
            "property": "PITCH",
            "value": "2.0"
        }, {
            "property": "YAW",
            "value": "8.0"
        }, {
            "property": "ROLL",
            "value": "0.0"
        }, {
            "property": "FACE PROFILE",
            "value": "[{
            	'x': 449,
            	'y': 477
            }, {
            	'x': 448,
            	'y': 487
            }, {
            	'x': 448,
            	'y': 498
            }, {
            	'x': 449,
            	'y': 508
            }, {
            	'x': 451,
            	'y': 519
            }, {
            	'x': 454,
            	'y': 529
            }, {
            	'x': 459,
            	'y': 538
            }, {
            	'x': 466,
            	'y': 546
            }, {
            	'x': 474,
            	'y': 553
            }, {
            	'x': 483,
            	'y': 558
            }, {
            	'x': 494,
            	'y': 561
            }, {
            	'x': 504,
            	'y': 559
            }, {
            	'x': 513,
            	'y': 554
            }, {
            	'x': 521,
            	'y': 548
            }, {
            	'x': 527,
            	'y': 540
            }, {
            	'x': 533,
            	'y': 532
            }, {
            	'x': 537,
            	'y': 522
            }, {
            	'x': 539,
            	'y': 512
            }, {
            	'x': 541,
            	'y': 502
            }, {
            	'x': 542,
            	'y': 492
            }, {
            	'x': 542,
            	'y': 483
            }]"
        }, {
            "property": "FACE LEFT EYE",
            "value": "[{
            		'x': 476,
            		'y': 483
            	}, {
            		'x': 473,
            		'y': 484
            	}, {
            		'x': 469,
            		'y': 484
            	}, {
            		'x': 465,
            		'y': 483
            	}, {
            		'x': 462,
            		'y': 482
            	}, {
            		'x': 465,
            		'y': 483
            	}, {
            		'x': 469,
            		'y': 483
            	}, {
            		'x': 473,
            		'y': 483
            	}
            ]"
        }, {
            "property": "FACE RIGHT EYE",
            "value": "[{
            		'x': 503,
            		'y': 483
            	}, {
            		'x': 507,
            		'y': 485
            	}, {
            		'x': 512,
            		'y': 485
            	}, {
            		'x': 516,
            		'y': 484
            	}, {
            		'x': 520,
            		'y': 481
            	}, {
            		'x': 516,
            		'y': 479
            	}, {
            		'x': 511,
            		'y': 478
            	}, {
            		'x': 506,
            		'y': 479
            	}
            ]"
        }, {
            "property": "FACE LEFT EYEBROW",
            "value": "[{
            		'x': 450,
            		'y': 477
            	}, {
            		'x': 458,
            		'y': 475
            	}, {
            		'x': 466,
            		'y': 473
            	}, {
            		'x': 474,
            		'y': 471
            	}, {
            		'x': 482,
            		'y': 469
            	}, {
            		'x': 474,
            		'y': 464
            	}, {
            		'x': 464,
            		'y': 464
            	}, {
            		'x': 454,
            		'y': 468
            	}
            ]"
        }, {
            "property": "FACE RIGHT EYEBROW",
            "value": "[{
            		'x': 528,
            		'y': 471
            	}, {
            		'x': 519,
            		'y': 470
            	}, {
            		'x': 511,
            		'y': 470
            	}, {
            		'x': 503,
            		'y': 469
            	}, {
            		'x': 494,
            		'y': 469
            	}, {
            		'x': 502,
            		'y': 463
            	}, {
            		'x': 512,
            		'y': 462
            	}, {
            		'x': 521,
            		'y': 464
            	}
            ]"
        }, {
            "property": "FACE MOUTH",
            "value": "[{
            		'x': 470,
            		'y': 523
            	}, {
            		'x': 476,
            		'y': 530
            	}, {
            		'x': 485,
            		'y': 535
            	}, {
            		'x': 495,
            		'y': 536
            	}, {
            		'x': 504,
            		'y': 534
            	}, {
            		'x': 511,
            		'y': 528
            	}, {
            		'x': 515,
            		'y': 520
            	}, {
            		'x': 508,
            		'y': 516
            	}, {
            		'x': 500,
            		'y': 514
            	}, {
            		'x': 494,
            		'y': 515
            	}, {
            		'x': 487,
            		'y': 514
            	}, {
            		'x': 478,
            		'y': 517
            	}, {
            		'x': 478,
            		'y': 527
            	}, {
            		'x': 486,
            		'y': 529
            	}, {
            		'x': 494,
            		'y': 530
            	}, {
            		'x': 502,
            		'y': 528
            	}, {
            		'x': 509,
            		'y': 525
            	}, {
            		'x': 508,
            		'y': 519
            	}, {
            		'x': 501,
            		'y': 518
            	}, {
            		'x': 494,
            		'y': 518
            	}, {
            		'x': 486,
            		'y': 519
            	}, {
            		'x': 478,
            		'y': 521
            	}
            ]"
        }, {
            "property": "FACE NOSE",
            "value": "[{
            		'x': 494,
            		'y': 502
            	}, {
            		'x': 491,
            		'y': 480
            	}, {
            		'x': 488,
            		'y': 486
            	}, {
            		'x': 486,
            		'y': 491
            	}, {
            		'x': 483,
            		'y': 497
            	}, {
            		'x': 478,
            		'y': 503
            	}, {
            		'x': 486,
            		'y': 507
            	}, {
            		'x': 494,
            		'y': 509
            	}, {
            		'x': 501,
            		'y': 506
            	}, {
            		'x': 508,
            		'y': 501
            	}, {
            		'x': 503,
            		'y': 495
            	}, {
            		'x': 499,
            		'y': 490
            	}, {
            		'x': 495,
            		'y': 485
            	}
            ]"
        }
    ]
}]

GeneXusAI - Tencent - DetectFaces
10026ms

Notes

  • The label assigned for a face depends on the provider used. Additional information can be found on the OutputRegion.Info field if it is given by the provider.
  • Maximum image file size is 10MB.
  • GeneXusAI does not provide support for drawing a rectangle over an image. This action is the responsibility of the developer.
    TIP: For Web applications, a good alternative can be combining HTML5 Canvas control with JavaScript with User Control object. On the other hand, for Smart Devices you could use Image Map control on which you can set the processed image as background and 'draw' square regions (i.e. set a border color on the table item of the grid).

Scope

Platforms Web(.NET,.NETCore,Java), SmartDevices(Android,iOS)
Connectivity Online

Availability

This procedure is available as of GeneXus 16.

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.