【发布时间】:2019-05-26 10:28:58
【问题描述】:
我正在使用 Microsoft Face API 来检测 Android 中的面部和情绪。我有一个TreeMap,它的键是情感属性的概率,值是属性名称,如下所示:
TreeMap<Double, String> treeMap = new TreeMap<>();
treeMap.put(person.faceAttributes.emotion.happiness, "Happiness");
treeMap.put(person.faceAttributes.emotion.anger, "Anger");
treeMap.put(person.faceAttributes.emotion.disgust, "Disgust");
treeMap.put(person.faceAttributes.emotion.sadness, "Sadness");
treeMap.put(person.faceAttributes.emotion.neutral, "Neutral");
treeMap.put(person.faceAttributes.emotion.surprise, "Surprise");
treeMap.put(person.faceAttributes.emotion.fear, "Fear");
(person 是 Face 类型的对象)
我想做的是将这 7 种情绪从最有可能到最不可能进行排序,但问题是 treeMap 的大小各不相同。例如,当我选择获取微笑的面部表情属性时,treeMap.size() 返回2。当我选择获取主要是中性的面部的情绪属性时,treeMap.size() 返回 3。
即使我使用treeMap.put() 向treeMap 添加了7 个键值对,有谁知道为什么会发生这种行为?我发现treeMap中确实存在的键值对是最有可能的情绪,但是即使其他属性为0,为什么它们仍然不被添加到@ 987654330@.
【问题讨论】:
标签: android azure attributes microsoft-cognitive face-api