ANSFR: report v1.4 emotion class names verbatim in the attribute JSON
The legacy display remap in FaceAttributeToJsonString rewrote most emotions to "Attentive", which hid the v1.4 classifier's real classes. The remap now applies ONLY to the legacy OpenVINO model's lowercase classes (sad/happy/neutral/anger/surprise - v1.1 output unchanged); every other name, i.e. the classes read from emotionsrecognition.names (Angry, Fear, Happy, Neutral, Sad), passes through verbatim. A retrained classifier with a different .names list needs no code change. Verified on the classroom video: faces previously labelled "Attentive" now read "Angry (100%)"; smiling faces read "Happy (100%)". Parity test updated to check each pack against its own emotion vocabulary. Note for client code: v1.4 deployments no longer emit "Attentive" - anything matching that string must handle Angry/Fear/Sad instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2184,8 +2184,12 @@ int TestOutputFormatParity()
|
||||
V14Check(attrKeys(oldFirst) == attrKeys(newFirst),
|
||||
"attribute keys identical", failures);
|
||||
|
||||
// 3. Value vocabularies must match on every face of both packs
|
||||
auto checkVocab = [&](const boost::property_tree::ptree& pt, const char* label) {
|
||||
// 3. Value vocabularies must match on every face of both packs.
|
||||
// Gender/Age vocabularies are shared; the Emotion vocabulary is
|
||||
// per-pack: v1.1's legacy display names vs v1.4's verbatim class
|
||||
// names from emotionsrecognition.names.
|
||||
auto checkVocab = [&](const boost::property_tree::ptree& pt, const char* label,
|
||||
const std::vector<std::string>& emotionVocab) {
|
||||
for (const auto& child : pt.get_child("results")) {
|
||||
auto ept = parse(child.second.get<std::string>("extra_info"));
|
||||
for (const auto& attr : ept.get_child("attributes")) {
|
||||
@@ -2196,16 +2200,19 @@ int TestOutputFormatParity()
|
||||
std::string(label) + " Gender in {Male, Female}: " + gender, failures);
|
||||
V14Check(age == "Kids" || age == "Young Adults" || age == "Adults" || age == "Elders",
|
||||
std::string(label) + " Age in bucket set: " + age, failures);
|
||||
const bool emotionOk =
|
||||
(emotion.rfind("Happy", 0) == 0 || emotion.rfind("Neutral", 0) == 0 ||
|
||||
emotion.rfind("Attentive", 0) == 0) && emotion.find("%)") != std::string::npos;
|
||||
bool emotionOk = emotion.find("%)") != std::string::npos;
|
||||
if (emotionOk) {
|
||||
emotionOk = false;
|
||||
for (const auto& name : emotionVocab)
|
||||
if (emotion.rfind(name, 0) == 0) { emotionOk = true; break; }
|
||||
}
|
||||
V14Check(emotionOk,
|
||||
std::string(label) + " Emotion label/format: " + emotion, failures);
|
||||
}
|
||||
}
|
||||
};
|
||||
checkVocab(oldPt, "v1.1");
|
||||
checkVocab(newPt, "v1.4");
|
||||
checkVocab(oldPt, "v1.1", { "Happy", "Neutral", "Attentive" });
|
||||
checkVocab(newPt, "v1.4", { "Angry", "Fear", "Happy", "Neutral", "Sad" });
|
||||
|
||||
// 4. Both packs must recognize the enrolled user (same matching semantics)
|
||||
V14Check(oldJson.find("ParityUser") != std::string::npos, "v1.1 recognizes enrolled user", failures);
|
||||
|
||||
Reference in New Issue
Block a user