Search code examples
azureazure-cognitive-servicesface-api

Azure Cognitive Services - Face API Response: Reserved Fields or Bugs?


In the Azure Cognitive Services Face API (see e.g. https://azure.microsoft.com/en-us/services/cognitive-services/face), the following response fields never seem to trigger:

  1. headPose:pitch (reserved field)
  2. foreheadOccluded
  3. eyeOccluded

Am I misusing these, or is there a plan for them, or is there no plan to activate them?


Solution

  • If you look at the API documentation here:

    • For the headPose, it says:

    EDIT 13/06/2019: doc was saying

    HeadPose's pitch value is a reserved field and will always return 0

    Now changed to:

    headPose: 3-D roll/yaw/pitch angles for face direction.

    • For the foreheadOccluded value, I successfully got true value in the following test, where there is a cap on the head (sorry for the sample, did not find anything else quickly!):

      • URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
      • Content sent: { "url": "https://www.knijff.com/markmatters/wp-content/uploads/2015/10/Trump-Red-Hat.jpg" }

    Sample for forehead occluded

    Reply received:

    [{
      "faceId": "e6ae42a6-b008-4859-9bf5-1ae22e4b71a7",
      "faceRectangle": {
        "top": 118,
        "left": 212,
        "width": 276,
        "height": 276
      },
      "faceAttributes": {
        "occlusion": {
          "foreheadOccluded": true,
          "eyeOccluded": false,
          "mouthOccluded": false
        }
      }
    }]
    
    • For the eyeOccluded value, I successfully got true and false values in the following test where the same person appears 2 times, one with a rectangle over the eyes:

      • URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
      • Content sent: { "url": "https://jov.arvojournals.org/data/Journals/JOV/933685/i1534-7362-14-13-14-f09.png" }

    Sample for eyes occluded

    Reply received (please note that 1st face is the right one):

    [{
      "faceId": "4c2eb52e-2fd4-456c-bdae-694df1adc571",
      "faceRectangle": {
        "top": 204,
        "left": 683,
        "width": 297,
        "height": 297
      },
      "faceAttributes": {
        "occlusion": {
          "foreheadOccluded": false,
          "eyeOccluded": false,
          "mouthOccluded": true
        }
      }
    }, {
      "faceId": "5b9dc938-e6cf-4fe9-8e6c-8649fef44e7a",
      "faceRectangle": {
        "top": 213,
        "left": 107,
        "width": 275,
        "height": 275
      },
      "faceAttributes": {
        "occlusion": {
          "foreheadOccluded": false,
          "eyeOccluded": true,
          "mouthOccluded": false
        }
      }
    }]