Product Engineer, CTO & a Beer Enthusiast
Experiments, thoughts and scripts documented for posterity.
Dec, 2012
Face.com is without any doubt one of the best Face detection API out there. Considering the fact that Face.com provides 5000 request per hour is quite a good API access for a small or personal project. But unfortunately not all Data provided by face.com is human readable. Following is an example of face.com api result
{
-
photos: [
-
{
url: http://4.bp.blogspot.com/-iJu-Mpq2YbU/TvyEdWnGc8I/AAAAAAAAA_8/0AmcGwM3Pz4/s1600/demi_lovato_red_hair.jpg
pid: "F@383bba385bef538dea790d3a7ab63c42_4b4b4c6d54c37"
width: 400
height: 550
-
tags: [
-
{
tid: "TEMP_F@383bba385bef538dea790d3a7ab63c42_4b4b4c6d54c37_32.50_36.91_0_1"
recognizable: false
threshold: null
uids: [ ]
gid: null
label: ""
confirmed: false
manual: false
tagger_id: null
width: 38.5
height: 28
+
center: { ... }
+
eye_left: { ... }
+
eye_right: { ... }
+
mouth_left: { ... }
+
mouth_center: { ... }
+
mouth_right: { ... }
+
nose: { ... }
ear_left: null
ear_right: null
chin: null
yaw: -86.48
roll: 11.16
pitch: 1.19
+
attributes: { ... }
}
]
}
]
status: "success"
-
usage: {
used: 61
remaining: "unlimited"
limit: "unlimited"
reset_time_text: "unlimited"
reset_time: 0
}
}
if (tag.yaw < 10 && tag.yaw > -10)
return "Forward looking face";
if (tag.yaw < 20 && tag.yaw > -20)
return "Slightly Angled face";
if (tag.yaw < 60 && tag.yaw > -60)
return "Angled face";
if (tag.yaw < 90 && tag.yaw > -90)
return "Side face";
For determining if the image is a portrait image:
if (tag.height > 40 || tag.width > 40)
return "Headshot or Potrait";
if ((tag.height < 40 && tag.height > 15) || (tag.width < 40 && tag.width > 15))
return "HalfLength body shot";
else
return "FullLength body shot";
attributes: {
-
age_est: {
value: 36
confidence: 76
}
-
age_max: {
value: 40
confidence: null
}
-
age_min: {
value: 33
confidence: null
}
-
face: {
value: "true"
confidence: 98
}
-
gender: {
value: "male"
confidence: 82
}
-
glasses: {
value: "false"
confidence: 98
}
-
lips: {
value: "sealed"
confidence: 81
}
-
mood: {
value: "happy"
confidence: 34
}
-
smiling: {
value: "false"
confidence: 66
}
}