我正在尝试训练/创建自己的分类器,我将此代码附加到主摄像头,但我没有得到控制台的任何响应,也没有收到任何错误。还是我只是做错了?
public class VisualRecog : MonoBehaviour{
private VisualRecognition m_VisualRecognition = new VisualRecognition();
void Start()
{
string m_positiveExamplesPath = Application.dataPath + "/testData/cpu_positive_examples.zip";
string m_negativeExamplesPath = Application.dataPath + "/testData/negative_examples.zip";
Dictionary<string, string> positiveExamples = new Dictionary<string, string>();
positiveExamples.Add("cpu", m_positiveExamplesPath);
if (!m_VisualRecognition.TrainClassifier(OnTrainClassifier, "compClassifier", positiveExamples, m_negativeExamplesPath))
Log.Debug("ExampleVisualRecognition", "Train classifier failed!");
}
private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier, string data)
{
if (classifier != null)
{
Log.Debug("ExampleVisualRecognition", "Classifier is training! " + classifier);
}
else
{
Log.Debug("ExampleVisualRecognition", "Failed to train classifier!");
}
}
}
顺便说一下,这里是 Unity SDK 的链接。谢谢!