Commit 0a8d94ad authored by Davis King's avatar Davis King

Added age and gender fields to image metadata.

parent 2dfbf778
...@@ -80,6 +80,12 @@ namespace dlib ...@@ -80,6 +80,12 @@ namespace dlib
fout << " ignore='" << b.ignore << "'"; fout << " ignore='" << b.ignore << "'";
if (b.angle != 0) if (b.angle != 0)
fout << " angle='" << b.angle << "'"; fout << " angle='" << b.angle << "'";
if (b.age != 0)
fout << " age='" << b.age << "'";
if (b.gender == FEMALE)
fout << " gender='female'";
else if (b.gender == MALE)
fout << " gender='male'";
if (b.pose != 0) if (b.pose != 0)
fout << " pose='" << b.pose << "'"; fout << " pose='" << b.pose << "'";
if (b.detection_score != 0) if (b.detection_score != 0)
...@@ -196,6 +202,18 @@ namespace dlib ...@@ -196,6 +202,18 @@ namespace dlib
if (atts.is_in_list("occluded")) temp_box.occluded = sa = atts["occluded"]; if (atts.is_in_list("occluded")) temp_box.occluded = sa = atts["occluded"];
if (atts.is_in_list("ignore")) temp_box.ignore = sa = atts["ignore"]; if (atts.is_in_list("ignore")) temp_box.ignore = sa = atts["ignore"];
if (atts.is_in_list("angle")) temp_box.angle = sa = atts["angle"]; if (atts.is_in_list("angle")) temp_box.angle = sa = atts["angle"];
if (atts.is_in_list("age")) temp_box.age = sa = atts["age"];
if (atts.is_in_list("gender"))
{
if (atts["gender"] == "male")
temp_box.gender = MALE;
else if (atts["gender"] == "female")
temp_box.gender = FEMALE;
else if (atts["gender"] == "unknown")
temp_box.gender = UNKNOWN;
else
throw dlib::error("Invalid gender string in box attribute.");
}
if (atts.is_in_list("pose")) temp_box.pose = sa = atts["pose"]; if (atts.is_in_list("pose")) temp_box.pose = sa = atts["pose"];
if (atts.is_in_list("detection_score")) temp_box.detection_score = sa = atts["detection_score"]; if (atts.is_in_list("detection_score")) temp_box.detection_score = sa = atts["detection_score"];
......
...@@ -14,6 +14,15 @@ namespace dlib ...@@ -14,6 +14,15 @@ namespace dlib
namespace image_dataset_metadata namespace image_dataset_metadata
{ {
// ------------------------------------------------------------------------------------
enum gender_t
{
UNKNOWN,
MALE,
FEMALE
};
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
struct box struct box
...@@ -36,7 +45,9 @@ namespace dlib ...@@ -36,7 +45,9 @@ namespace dlib
ignore(false), ignore(false),
pose(0), pose(0),
detection_score(0), detection_score(0),
angle(0) angle(0),
gender(UNKNOWN),
age(0)
{} {}
box ( box (
...@@ -49,7 +60,9 @@ namespace dlib ...@@ -49,7 +60,9 @@ namespace dlib
ignore(false), ignore(false),
pose(0), pose(0),
detection_score(0), detection_score(0),
angle(0) angle(0),
gender(UNKNOWN),
age(0)
{} {}
rectangle rect; rectangle rect;
...@@ -72,6 +85,9 @@ namespace dlib ...@@ -72,6 +85,9 @@ namespace dlib
// image counter-clockwise by angle radians. // image counter-clockwise by angle radians.
double angle; double angle;
gender_t gender;
double age;
bool has_label() const { return label.size() != 0; } bool has_label() const { return label.size() != 0; }
/*! /*!
ensures ensures
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment