• Resolved thelostparrot

    (@thelostparrot)


    I turned on “Detect Faces” in Rekognition Settings Under Media Cloud. I processed the images that are already in S3 using Rekognition Importer. After Importer is done, I go back to Media and looked at the images being processed by Rokognition. I don’t see any facial detection metadata. My questions: Does “Detect Faces” actually work? If it does, how or where do I see result of face detect?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author interfacelab

    (@interfacelab)

    If you look at the meta for the attachment, there should be a field called ‘faces’, if a face was found.

    If you turn on PHP error logging in php.ini (log_errors = YES and error_log = /path/to/error.log) and then turn on debugging in the plugin you’ll be able to see the raw results for Rekognition in your logs.

    I’ll do some testing today though to see if anything has been broken in an update.

    Thanks,

    Jon.

    Thread Starter thelostparrot

    (@thelostparrot)

    Thank you for responding Jon. I will turn on PHP error logging and check again. Will provide update soon.

    Thread Starter thelostparrot

    (@thelostparrot)

    I didn’t find a php.ini (or PHP.INI) file in my WordPress project directory.

    Plugin Author interfacelab

    (@interfacelab)

    The php.ini file will be wherever your php is installed to.

    I’ve done a lot of testing with Rekognition today and there are a few things of note. You’ll need to make sure your IAM user policy is correct. This is the minimum policy you’ll need to use:

    
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                    "s3:DeleteObjectTagging",
                    "s3:ListBucketMultipartUploads",
                    "s3:DeleteObjectVersion",
                    "s3:ListBucket",
                    "s3:DeleteObjectVersionTagging",
                    "s3:GetBucketAcl",
                    "s3:ListMultipartUploadParts",
                    "s3:PutObject",
                    "s3:GetObjectAcl",
                    "s3:GetObject",
                    "s3:AbortMultipartUpload",
                    "s3:DeleteObject",
                    "s3:GetBucketLocation",
                    "s3:PutObjectAcl"
                ],
                "Resource": [
                    "arn:aws:s3:::YOURBUCKET",
                    "arn:aws:s3:::YOURBUCKET/*",
                ]
            },
            {
                "Sid": "VisualEditor1",
                "Effect": "Allow",
                "Action": [
                    "rekognition:DetectLabels",
                    "rekognition:GetCelebrityRecognition",
                    "rekognition:GetContentModeration",
                    "rekognition:DetectFaces",
                    "rekognition:DetectModerationLabels",
                    "rekognition:RecognizeCelebrities",
                    "rekognition:CompareFaces",
                    "rekognition:DetectText",
                    "rekognition:GetCelebrityInfo",
                    "s3:HeadBucket",
                    "rekognition:GetLabelDetection"
                ],
                "Resource": "*"
            }
        ]
    }
    

    Replace YOURBUCKET with the name of your bucket.

    You’ll also need to make sure that your bucket is in one of the following AWS regions:

    us-east-1 => US East (Northern Virginia)
    us-east-2 => US East (Ohio)
    us-west-2 => US West (Oregon)
    eu-west-1 => EU (Ireland)
    ap-south-1 => Asia Pacific (Mumbai)
    ap-northeast-2 => Asia Pacific (Seoul)
    ap-southeast-2 => Asia Pacific (Sydney)
    ap-northeast-1 => Asia Pacific (Tokyo)
    us-gov-west-1 => AWS GovCloud (US)

    If it’s not in one of those buckets, it will not work. Make sure the region in Rekognition settings of the plugin are set to the same region as your bucket.

    The face data is stored in the meta data for an attachment:

    
    $meta = wp_get_attachment_metadata($attachement_id);
    // The face data will be in $meta['faces'] if any faces were detected
    

    Here is a var_dump() of what the attachment metadata looks like:

    
    Array
    (
        [width] => 673
        [height] => 1024
        [file] => nice/2018/11/03/10/07/20/0036_40790438_244300536164142_764647553286275072_n.jpg
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-150x150.jpg
                        [width] => 150
                        [height] => 150
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-150x150.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-150x150.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
                [medium] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-197x300.jpg
                        [width] => 197
                        [height] => 300
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-197x300.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-197x300.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
                [large] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-673x1024.jpg
                        [width] => 673
                        [height] => 1024
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-673x1024.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-673x1024.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
                [hero-image] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-673x683.jpg
                        [width] => 673
                        [height] => 683
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-673x683.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-673x683.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
                [hero-simple] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-673x550.jpg
                        [width] => 673
                        [height] => 550
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-673x550.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-673x550.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
                [small-square] => Array
                    (
                        [file] => 0036_40790438_244300536164142_764647553286275072_n-640x640.jpg
                        [width] => 640
                        [height] => 640
                        [mime-type] => image/jpeg
                        [s3] => Array
                            (
                                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n-640x640.jpg
                                [bucket] => gutenberg-rekognition-test
                                [privacy] => public-read
                                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n-640x640.jpg
                                [provider] => s3
                                [options] => Array
                                    (
                                    )
    
                                [mime-type] => image/jpeg
                            )
    
                    )
    
            )
    
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] => 
                [camera] => 
                [caption] => 
                [created_timestamp] => 0
                [copyright] => 
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] => 
                [orientation] => 0
                [keywords] => Array
                    (
                    )
    
            )
    
        [s3] => Array
            (
                [url] => https://gutenberg-rekognition-test.s3-accelerate.amazonaws.com/2018/11/0036_40790438_244300536164142_764647553286275072_n.jpg
                [bucket] => gutenberg-rekognition-test
                [privacy] => public-read
                [key] => 2018/11/0036_40790438_244300536164142_764647553286275072_n.jpg
                [provider] => s3
                [options] => Array
                    (
                    )
    
                [mime-type] => image/jpeg
            )
    
        [faces] => Array
            (
                [0] => Array
                    (
                        [BoundingBox] => Array
                            (
                                [Width] => 0.16790489852428
                                [Height] => 0.1103515625
                                [Left] => 0.21248142421246
                                [Top] => 0.05078125
                            )
    
                        [AgeRange] => Array
                            (
                                [Low] => 26
                                [High] => 43
                            )
    
                        [Smile] => Array
                            (
                                [Value] => 
                                [Confidence] => 90.128707885742
                            )
    
                        [Eyeglasses] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.782775878906
                            )
    
                        [Sunglasses] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.588790893555
                            )
    
                        [Gender] => Array
                            (
                                [Value] => Female
                                [Confidence] => 99.999702453613
                            )
    
                        [Beard] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.934944152832
                            )
    
                        [Mustache] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.997329711914
                            )
    
                        [EyesOpen] => Array
                            (
                                [Value] => 1
                                [Confidence] => 99.99715423584
                            )
    
                        [MouthOpen] => Array
                            (
                                [Value] => 
                                [Confidence] => 91.838279724121
                            )
    
                        [Emotions] => Array
                            (
                                [0] => Array
                                    (
                                        [Type] => CALM
                                        [Confidence] => 76.60627746582
                                    )
    
                                [1] => Array
                                    (
                                        [Type] => HAPPY
                                        [Confidence] => 26.10064125061
                                    )
    
                                [2] => Array
                                    (
                                        [Type] => SAD
                                        [Confidence] => 2.0383536815643
                                    )
    
                            )
    
                        [Landmarks] => Array
                            (
                                [0] => Array
                                    (
                                        [Type] => eyeLeft
                                        [X] => 0.26921534538269
                                        [Y] => 0.096239008009434
                                    )
    
                                [1] => Array
                                    (
                                        [Type] => eyeRight
                                        [X] => 0.32335963845253
                                        [Y] => 0.09582045674324
                                    )
    
                                [2] => Array
                                    (
                                        [Type] => nose
                                        [X] => 0.29901498556137
                                        [Y] => 0.11317467689514
                                    )
    
                                [3] => Array
                                    (
                                        [Type] => mouthLeft
                                        [X] => 0.28169691562653
                                        [Y] => 0.13609923422337
                                    )
    
                                [4] => Array
                                    (
                                        [Type] => mouthRight
                                        [X] => 0.31714773178101
                                        [Y] => 0.13541348278522
                                    )
    
                                [5] => Array
                                    (
                                        [Type] => leftPupil
                                        [X] => 0.27210903167725
                                        [Y] => 0.096320874989033
                                    )
    
                                [6] => Array
                                    (
                                        [Type] => rightPupil
                                        [X] => 0.32509756088257
                                        [Y] => 0.094451501965523
                                    )
    
                                [7] => Array
                                    (
                                        [Type] => leftEyeBrowLeft
                                        [X] => 0.24802127480507
                                        [Y] => 0.083377748727798
                                    )
    
                                [8] => Array
                                    (
                                        [Type] => leftEyeBrowUp
                                        [X] => 0.26342269778252
                                        [Y] => 0.080130204558372
                                    )
    
                                [9] => Array
                                    (
                                        [Type] => leftEyeBrowRight
                                        [X] => 0.28089293837547
                                        [Y] => 0.083327442407608
                                    )
    
                                [10] => Array
                                    (
                                        [Type] => rightEyeBrowLeft
                                        [X] => 0.31048738956451
                                        [Y] => 0.083573184907436
                                    )
    
                                [11] => Array
                                    (
                                        [Type] => rightEyeBrowUp
                                        [X] => 0.32498818635941
                                        [Y] => 0.080256082117558
                                    )
    
                                [12] => Array
                                    (
                                        [Type] => rightEyeBrowRight
                                        [X] => 0.33906579017639
                                        [Y] => 0.082221016287804
                                    )
    
                                [13] => Array
                                    (
                                        [Type] => leftEyeLeft
                                        [X] => 0.25796765089035
                                        [Y] => 0.096822209656239
                                    )
    
                                [14] => Array
                                    (
                                        [Type] => leftEyeRight
                                        [X] => 0.27993333339691
                                        [Y] => 0.096864156424999
                                    )
    
                                [15] => Array
                                    (
                                        [Type] => leftEyeUp
                                        [X] => 0.26931995153427
                                        [Y] => 0.093370839953423
                                    )
    
                                [16] => Array
                                    (
                                        [Type] => leftEyeDown
                                        [X] => 0.26937553286552
                                        [Y] => 0.098502993583679
                                    )
    
                                [17] => Array
                                    (
                                        [Type] => rightEyeLeft
                                        [X] => 0.3126737177372
                                        [Y] => 0.097046725451946
                                    )
    
                                [18] => Array
                                    (
                                        [Type] => rightEyeRight
                                        [X] => 0.33314269781113
                                        [Y] => 0.095704965293407
                                    )
    
                                [19] => Array
                                    (
                                        [Type] => rightEyeUp
                                        [X] => 0.32304656505585
                                        [Y] => 0.092858165502548
                                    )
    
                                [20] => Array
                                    (
                                        [Type] => rightEyeDown
                                        [X] => 0.32412412762642
                                        [Y] => 0.098227366805077
                                    )
    
                                [21] => Array
                                    (
                                        [Type] => noseLeft
                                        [X] => 0.28966122865677
                                        [Y] => 0.1231747046113
                                    )
    
                                [22] => Array
                                    (
                                        [Type] => noseRight
                                        [X] => 0.30705398321152
                                        [Y] => 0.12315227091312
                                    )
    
                                [23] => Array
                                    (
                                        [Type] => mouthUp
                                        [X] => 0.30040156841278
                                        [Y] => 0.13008078932762
                                    )
    
                                [24] => Array
                                    (
                                        [Type] => mouthDown
                                        [X] => 0.30214485526085
                                        [Y] => 0.14393526315689
                                    )
    
                            )
    
                        [Pose] => Array
                            (
                                [Roll] => -1.0160439014435
                                [Yaw] => -1.1779615879059
                                [Pitch] => 2.771534204483
                            )
    
                        [Quality] => Array
                            (
                                [Brightness] => 79.942672729492
                                [Sharpness] => 86.932060241699
                            )
    
                        [Confidence] => 99.996658325195
                    )
    
                [1] => Array
                    (
                        [BoundingBox] => Array
                            (
                                [Width] => 0.15898959338665
                                [Height] => 0.103515625
                                [Left] => 0.55423474311829
                                [Top] => 0.0498046875
                            )
    
                        [AgeRange] => Array
                            (
                                [Low] => 20
                                [High] => 38
                            )
    
                        [Smile] => Array
                            (
                                [Value] => 
                                [Confidence] => 53.32612991333
                            )
    
                        [Eyeglasses] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.877861022949
                            )
    
                        [Sunglasses] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.712669372559
                            )
    
                        [Gender] => Array
                            (
                                [Value] => Female
                                [Confidence] => 99.998840332031
                            )
    
                        [Beard] => Array
                            (
                                [Value] => 
                                [Confidence] => 98.909339904785
                            )
    
                        [Mustache] => Array
                            (
                                [Value] => 
                                [Confidence] => 99.75537109375
                            )
    
                        [EyesOpen] => Array
                            (
                                [Value] => 1
                                [Confidence] => 99.999824523926
                            )
    
                        [MouthOpen] => Array
                            (
                                [Value] => 
                                [Confidence] => 90.889503479004
                            )
    
                        [Emotions] => Array
                            (
                                [0] => Array
                                    (
                                        [Type] => HAPPY
                                        [Confidence] => 76.651100158691
                                    )
    
                                [1] => Array
                                    (
                                        [Type] => CALM
                                        [Confidence] => 50.205429077148
                                    )
    
                                [2] => Array
                                    (
                                        [Type] => CONFUSED
                                        [Confidence] => 1.0253548622131
                                    )
    
                            )
    
                        [Landmarks] => Array
                            (
                                [0] => Array
                                    (
                                        [Type] => eyeLeft
                                        [X] => 0.60221344232559
                                        [Y] => 0.096578359603882
                                    )
    
                                [1] => Array
                                    (
                                        [Type] => eyeRight
                                        [X] => 0.65561658143997
                                        [Y] => 0.088760875165462
                                    )
    
                                [2] => Array
                                    (
                                        [Type] => nose
                                        [X] => 0.62256306409836
                                        [Y] => 0.10845056176186
                                    )
    
                                [3] => Array
                                    (
                                        [Type] => mouthLeft
                                        [X] => 0.6178594827652
                                        [Y] => 0.13119769096375
                                    )
    
                                [4] => Array
                                    (
                                        [Type] => mouthRight
                                        [X] => 0.655277967453
                                        [Y] => 0.12581962347031
                                    )
    
                                [5] => Array
                                    (
                                        [Type] => leftPupil
                                        [X] => 0.60646694898605
                                        [Y] => 0.096310116350651
                                    )
    
                                [6] => Array
                                    (
                                        [Type] => rightPupil
                                        [X] => 0.65795290470123
                                        [Y] => 0.087247543036938
                                    )
    
                                [7] => Array
                                    (
                                        [Type] => leftEyeBrowLeft
                                        [X] => 0.58321338891983
                                        [Y] => 0.085290424525738
                                    )
    
                                [8] => Array
                                    (
                                        [Type] => leftEyeBrowUp
                                        [X] => 0.59432953596115
                                        [Y] => 0.081016600131989
                                    )
    
                                [9] => Array
                                    (
                                        [Type] => leftEyeBrowRight
                                        [X] => 0.60753005743027
                                        [Y] => 0.081010758876801
                                    )
    
                                [10] => Array
                                    (
                                        [Type] => rightEyeBrowLeft
                                        [X] => 0.63595622777939
                                        [Y] => 0.076753318309784
                                    )
    
                                [11] => Array
                                    (
                                        [Type] => rightEyeBrowUp
                                        [X] => 0.65531748533249
                                        [Y] => 0.071316830813885
                                    )
    
                                [12] => Array
                                    (
                                        [Type] => rightEyeBrowRight
                                        [X] => 0.67402452230453
                                        [Y] => 0.074557721614838
                                    )
    
                                [13] => Array
                                    (
                                        [Type] => leftEyeLeft
                                        [X] => 0.59276306629181
                                        [Y] => 0.098151139914989
                                    )
    
                                [14] => Array
                                    (
                                        [Type] => leftEyeRight
                                        [X] => 0.6119299530983
                                        [Y] => 0.096098512411118
                                    )
    
                                [15] => Array
                                    (
                                        [Type] => leftEyeUp
                                        [X] => 0.60134774446487
                                        [Y] => 0.093652173876762
                                    )
    
                                [16] => Array
                                    (
                                        [Type] => leftEyeDown
                                        [X] => 0.60294610261917
                                        [Y] => 0.098958089947701
                                    )
    
                                [17] => Array
                                    (
                                        [Type] => rightEyeLeft
                                        [X] => 0.64423322677612
                                        [Y] => 0.091043494641781
                                    )
    
                                [18] => Array
                                    (
                                        [Type] => rightEyeRight
                                        [X] => 0.66729933023453
                                        [Y] => 0.087408229708672
                                    )
    
                                [19] => Array
                                    (
                                        [Type] => rightEyeUp
                                        [X] => 0.65432786941528
                                        [Y] => 0.085857026278973
                                    )
    
                                [20] => Array
                                    (
                                        [Type] => rightEyeDown
                                        [X] => 0.65675550699234
                                        [Y] => 0.091199740767479
                                    )
    
                                [21] => Array
                                    (
                                        [Type] => noseLeft
                                        [X] => 0.62085485458374
                                        [Y] => 0.11755715310574
                                    )
    
                                [22] => Array
                                    (
                                        [Type] => noseRight
                                        [X] => 0.63898819684982
                                        [Y] => 0.11552639305592
                                    )
    
                                [23] => Array
                                    (
                                        [Type] => mouthUp
                                        [X] => 0.63159310817719
                                        [Y] => 0.12267334759235
                                    )
    
                                [24] => Array
                                    (
                                        [Type] => mouthDown
                                        [X] => 0.63674688339233
                                        [Y] => 0.13607706129551
                                    )
    
                            )
    
                        [Pose] => Array
                            (
                                [Roll] => -12.605429649353
                                [Yaw] => -15.24743938446
                                [Pitch] => 5.538863658905
                            )
    
                        [Quality] => Array
                            (
                                [Brightness] => 91.371520996094
                                [Sharpness] => 83.234924316406
                            )
    
                        [Confidence] => 99.971328735352
                    )
    
            )
    
    )
    

    I’m pretty confident your issues are either region or permissions related.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Rekognition Settings – Detect Faces’ is closed to new replies.