deeplearning

deeplearning / AgeClassification / 2.0.0

README.md

1. Introduction


This algorithm classifies age for each person in any given image. Currently it only supports two genders. (male & female)

Input:

  • (Required) Image Data API Url, Web (http/https) Url, binary image or a base64 encoded image.

Output:

  • Age range and bounding-box information of each person in a given image

Note: The first call to this algorithm will take a bit longer than sequential calls to due algorithm initialization. All following calls will be significantly faster.

2. Examples

Example 1.

  • Parameter 1: Data API Url
{
    "image": "data://deeplearning/example_data/veronika-balasyuk.jpg"
}

Output

{
  "results": [
    {
      "age": [
        {
          "ageRange": {"max": 6, "min": 4},
          "confidence": 0.252856969833374
        },
        {
          "ageRange": {"max": 12, "min": 8},
          "confidence": 0.24691076576709747
        },
        {
          "ageRange": {"max": 32, "min": 25},
          "confidence": 0.2092548310756683
        },
        {
          "ageRange": {"max": 2, "min": 0},
          "confidence": 0.12406377494335176
        },
        {
          "ageRange": {"max": 20, "min": 15},
          "confidence": 0.09925682842731476
        },
        {
          "ageRange": {"max": 43, "min": 38},
          "confidence": 0.041676465421915054
        },
        {
          "ageRange": {"max": 53, "min": 48},
          "confidence": 0.02348341979086399
        },
        {
          "ageRange": {"max": 100, "min": 60},
          "confidence": 0.002496980596333742
        }
      ],
      "bbox": {
        "bottom": 759,
        "left": 1632,
        "right": 2094,
        "top": 297
      },
      "person": 0
    }
  ]
}

Example 2.

  • Parameter 1: HTTP Url
{
    "image": "https://s3.amazonaws.com/algorithmia-assets/algo_desc_images/deeplearning_AgeClassification/veronika-balasyuk.jpg"
}

Output:

{
  "results": [
    {
      "age": [
        {
          "ageRange": {"max": 6, "min": 4},
          "confidence": 0.252856969833374
        },
        {
          "ageRange": {"max": 12, "min": 8},
          "confidence": 0.24691076576709747
        },
        {
          "ageRange": {"max": 32, "min": 25},
          "confidence": 0.2092548310756683
        },
        {
          "ageRange": {"max": 2, "min": 0},
          "confidence": 0.12406377494335176
        },
        {
          "ageRange": {"max": 20, "min": 15},
          "confidence": 0.09925682842731476
        },
        {
          "ageRange": {"max": 43, "min": 38},
          "confidence": 0.041676465421915054
        },
        {
          "ageRange": {"max": 53, "min": 48},
          "confidence": 0.02348341979086399
        },
        {
          "ageRange": {"max": 100, "min": 60},
          "confidence": 0.002496980596333742
        }
      ],
      "bbox": {
        "bottom": 759,
        "left": 1632,
        "right": 2094,
        "top": 297
      },
      "person": 0
    }
  ]
}

Example 3.

  • Parameter 1: Base64 image
{
    "image": "data:image/png;base64....",
}

Output;

{
  "results": [
    {
      "age": [
        {
          "ageRange": {"max": 6, "min": 4},
          "confidence": 0.252856969833374
        },
        {
          "ageRange": {"max": 12, "min": 8},
          "confidence": 0.24691076576709747
        },
        {
          "ageRange": {"max": 32, "min": 25},
          "confidence": 0.2092548310756683
        },
        {
          "ageRange": {"max": 2, "min": 0},
          "confidence": 0.12406377494335176
        },
        {
          "ageRange": {"max": 20, "min": 15},
          "confidence": 0.09925682842731476
        },
        {
          "ageRange": {"max": 43, "min": 38},
          "confidence": 0.041676465421915054
        },
        {
          "ageRange": {"max": 53, "min": 48},
          "confidence": 0.02348341979086399
        },
        {
          "ageRange": {"max": 100, "min": 60},
          "confidence": 0.002496980596333742
        }
      ],
      "bbox": {
        "bottom": 759,
        "left": 1632,
        "right": 2094,
        "top": 297
      },
      "person": 0
    }
  ]
}

3. Credits

for more information, please refer to: http://www.openu.ac.il/home/hassner/projects/cnn_agegender/ or Gil Levi and Tal Hassner, Age and Gender Classification using Convolutional Neural Networks, IEEE Workshop on Analysis and Modeling of Faces and Gestures (AMFG), at the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), Boston, June 2015

dlib/FaceDetection was used to detect faces in given images.

Demo is was taken from:

https://unsplash.com/photos/i6xguD8p4js