Celebrity Detection

Last updated November 15th, 2017

Overview

The celebrity detection model detects people with a public notoriety. This includes politicians, actors, athletes, business people and more.

Actor
(Brad Pitt)
Television presenter
(Ellen Degeneres)
Business Person
(Elon Musk)
Athlete
(Michael Jordan)
Politician
(Barack Obama)

Principles

The Celebrity recognition works by first finding relevant faces within an image or a video frame and then comparing the face characteristics to our list of known celebrities.

Our Face Recognition works in a way that makes it robust and able to recognize celebrities in previously unknown images, just like a human would. The API works for color images as well as black-and-white, and will work from different angles, in different lighting conditions.

Celebrity probability

For each face the API will return a list of possible celebrity names along with a probability, ranked from the highest to the lowest probability.

Probability values are between 0 and 1. The closer the value is to 1, the more confident the API is that this is the correct name.

  • Ellen DeGeneres: 0.99
  • Nicky Hilton: 0.19
  • Lindsay Ridgeway: 0.08
  • Lori Petty: 0.07
  • Denise Gough: 0.06

Detecting multiple celebrities

The celebrities model can also identify several celebrities within a single image or single video frame.

Limitations

  • Faces that are smaller than 10% of the image dimensions, are very blurry or have a low contrast with the background may go undetected
  • Faces that are not visible to human eyes (mostly hidden for instance or too small) might not be detected
  • Pictures of celebrities at a very young age (for instance a picture of Jennifer Lawrence when she was a baby or a picture of Ellen DeGeneres as a young girl) would result on lower accuracy

Adding celebrities to our database

We are steadily improving our celebrity detection model. Feel free to contact us to add celebrities you want to detect.

Use the model

To start, you need to create an account to retrieve your API keys. Then you must install the SDK that corresponds to your programming language.


# install cURL: https://curl.haxx.se/download.html


pip install sightengine


composer require sightengine/client-php


npm install sightengine --save

Detect a celebrity

Let say you want moderate the following image:

You can either upload a public URL to the image, or upload the raw binary image. Here's how to upload the


curl -X GET -G 'https://api.sightengine.com/1.0/check.json' \
    -d 'models=celebrities' \
    -d 'api_user={api_user}&api_secret={api_secret}' \
    -d 'url=https://d3m9459r9kwism.cloudfront.net/img/examples/example-craig-300.jpg'


 # if you haven't already, install the SDK with 'pip install sightengine'
from sightengine.client import SightengineClient
client = SightengineClient('{api_user}','{api_secret}')
output = client.check('celebrities').set_url('https://d3m9459r9kwism.cloudfront.net/img/examples/example-craig-300.jpg')


// if you haven't already, install the SDK with 'composer require sightengine/client-php'
use \Sightengine\SightengineClient;
$client = new SightengineClient('{api_user}','{api_secret}');
$client->check(['celebrities'])->set_url('https://d3m9459r9kwism.cloudfront.net/img/examples/example-craig-300.jpg');


// if you haven't already, install the SDK with 'npm install sightengine --save'
var sightengine = require('sightengine')('{api_user}','{api_secret}');
sightengine.check(['celebrities']).set_url('https://d3m9459r9kwism.cloudfront.net/img/examples/example-craig-300.jpg').then(function(result) {
    // The result of the API
}).catch(function(err) {
    // Error
});

Here is the result:

                    
                    
{
    "status": "success",
    "request": {
        "id": "req_0MtAXnNu1zHLs6CZXMVaw",
        "timestamp": 1494409587.8202,
        "operations": 1
    },
    "faces": [
        {
            "x1": 0.293,
            "y1": 0.1491,
            "x2": 0.7035,
            "y2": 0.8158,
            "features": {
                "left_eye": {
                    "x": 0.61,
                    "y": 0.4378
                },
                "right_eye": {
                    "x": 0.43,
                    "y": 0.4016
                },
                "nose_tip": {
                    "x": 0.5167,
                    "y": 0.5663
                },
                "left_mouth_corner": {
                    "x": 0.5667,
                    "y": 0.6787
                },
                "right_mouth_corner": {
                    "x": 0.4133,
                    "y": 0.6466
                }
            },
            "celebrity": [
                {
                    "name": "Daniel Craig",
                    "prob": 0.99
                },
                {
                    "name": "Dean Wareham",
                    "prob": 0.06
                },
                {
                    "name": "Ben Daniels",
                    "prob": 0.06
                },
                {
                    "name": "Graham Fellows",
                    "prob": 0.05
                }
            ]
        }
    ],
    "media": {
        "id": "med_0MtAtt9ud8Jaz93Ohb9UE",
        "uri": "https:\/\/sightengine.com\/assets\/img\/examples\/example-craig-300.jpg"
    }
}
                    
                

Did you find this page helpful?

We're always looking for advice to help improve our documentation!

Let us know what you think