Face
API - Faces
REQUEST
Analyze an image and return the coordinates of any detected faces.
https://api.moderatecontent.com/moderate/? face=true& key=your_api_key& url=https://www.moderatecontent.com/img/sample_face_5.jpg
ARGUMENTS
face
boolean
A flag to turn on the detect faces feature (true | false). Faces are returned as an array of coordinates for the detected face.
true
key
string
The api key used to reference your account within the system.
f96f44847704d2291b2967536afe8898
url
string
The URL pointing at an image accessible over the internet, no larger than 10MB and with a format of either .jpg .png .bmp .gif.
https://www.moderatecontent.com/img/sample_face_5.jpg
RESPONSE
{ "url_classified": "https://www.moderatecontent.com/img/sample.jpg", "rating_index": 1, "rating_letter": "e", "predictions": { "teen": 0, "everyone": 90.440768003464, "adult": 9.5592319965363 }, "rating_label": "everyone", "faces": [ { "gender": "male", "age": 39, "face": { "width": 64, "right": 197, "bottom": 162, "y": 97, "x": 133, "top": 97, "height": 65, "left": 133 } } ], "error_code": 0 }
url_classified
string
The URL pointing at an image accessible over the internet, no larger than 10MB and with a format of either .jpg .png .bmp .gif.
https://www.moderatecontent.com/img/sample.jpg
rating_index
integer
A numeric representation of the content rating (1 = everyone, 2 = teen, 3 = adult).
1
rating_letter
string
A single char representing the content rating (e = everyone, t = teen, a = adult).
a
predictions
object
The classification scores created by the computer vision model for each classification. Values range between 0 and 100.
{
"teen": 0.11751182222118,
"everyone": 99.823732266668,
"adult": 0.05875591111059
}
teen
double
The score by the computer vision model for the teen classification.
Parent: predictions
0.11751182222118
everyone
double
The score by the computer vision model for the everyone classification.
Parent: predictions
99.823732266668
adult
double
The score by the computer vision model for the adult classification.
Parent: predictions
0.05875591111059
rating_label
string
A label representing the content rating (everyone, teen, adult).
everyone
faces
array
List of face objects (coordinates and score)
[
{
"face": {
"width": 62,
"right": 197,
"bottom": 163,
"y": 101,
"x": 135,
"top": 101,
"left": 135,
"height": 62
}
},
{
"face": {
"width": 62,
"right": 363,
"bottom": 170,
"y": 108,
"x": 301,
"top": 108,
"left": 301,
"height": 62
}
}
]
gender
string
String containing the gender prediction ( male | female ).
Parent: faces
male
age
integer
Object containing the age prediction. Range 0 to 100. Returns -1 on low confidence.
Parent: faces
39
face
object
Object containing the location within the image of the face and the confidence that it is a face.
Parent: faces
{
"width": 62,
"right": 197,
"bottom": 163,
"y": 101,
"x": 135,
"top": 101,
"left": 135,
"height": 62
}
width
integer
The width in pixels of a single face's detected region.
Parent: face
62
right
integer
The distance from the left side of the image to the right side of the detected face in pixels.
Parent: face
62
bottom
integer
The distance from the top of the image to the bottom of the detected face in pixels.
Parent: face
163
y
integer
The distance from the left side of the image to the left side of the detected face in pixels.
Parent: face
101
x
integer
The distance from the top of the image to the top of the detected face in pixels.
Parent: face
135
top
integer
The distance from the top of the image to the top of the detected face in pixels.
Parent: face
101
left
integer
The distance from the left side of the image to the left side of the detected face in pixels.
Parent: face
101
height
integer
The height in pixels of a single face's detected region.
Parent: face
62
error_code
integer
A code representing the type of error returned. The value 0 means no error was found.
1024
error
string
Optional
A message representing the type of error returned. This occurs when the error_code is not 0.
No url specified in querystring
frame
integer
Optional
The index of the frame where the rating originated. Animated GIFs have 1..n frames, the API returns the frame with the highest prediction for adult.
1
ERROR MESSAGES
1001
URL not accessible or malformed image
A catch-all message from our prediction model, when it doesn't have an image to predict. Often, the URL can not be reached due to scraping restrictions.
1002
No URL specified in querystring
Parsing the querystring, we look for a parameter like &url=https://moderatecontent.com/image.png.
1003
Content does not begin with boundary
You have an incorrectly formed POST multipart/form-data, this can be tricky to setup without a library.
1004
Permissions Error
Generated when the API receives an image with forged byte code.
1005
Unexpected end of data
Image truncated during transmission.
1006
Malformed post upload request
A catch-all message for POST requests with unexpected content.
1007
Malformed post url
The URL field in your form POST is not a valid image.
1008
Requested file size too large > 10MB
We recommend keeping your images below 1MB to reduce latency. Increasing the size doesn't make our model more accurate.