我正在尝试将 Onclassify 调用的结果转换为可用格式。我似乎无法弄清楚如何将 classResult.m_class 返回为可用格式,例如更新 Text 对象或将其存储在变量中。
有人可以建议将多个或单个分类器的 classResult.m_class 的结果传递到我可以稍后操作或传递给其他函数的变量中的推荐方法是什么。
private void OnClassify(ClassifyTopLevelMultiple classify, string data)
{
if (classify != null)
{
Log.Debug("WebCamRecognition", "images processed: " + classify.images_processed);
foreach (ClassifyTopLevelSingle image in classify.images)
{
Log.Debug("WebCamRecognition", "\tsource_url: " + image.source_url + ", resolved_url: " + image.resolved_url);
foreach (ClassifyPerClassifier classifier in image.classifiers) {
Log.Debug ("WebCamRecognition", "\t\tclassifier_id: " + classifier.classifier_id + ", name: " + classifier.name);
foreach (ClassResult classResult in classifier.classes) {
Log.Debug ("WebCamRecognition", "\t\t\tclass: " + classResult.m_class + ", score: " + classResult.score + ", type_hierarchy: " + classResult.type_hierarchy);
}
}
}
}
else
{
Log.Debug("WebCamRecognition", "Classification failed!");
}
}