Skip to content

Commit 5db3118

Browse files
committed
bug where classifier is not being passed into call
1 parent aeacc4c commit 5db3118

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ void Start()
6969
// Log.Debug("ExampleVisualRecognition", "Classify image failed!");
7070

7171
//// Classify post image
72-
//Log.Debug("ExampleVisualRecognition", "Attempting to classify via image on file system");
73-
//string imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
74-
//string[] owners = { "IBM", "me" };
75-
//string[] classifierIDs = { "default" };
76-
//if (!m_VisualRecognition.Classify(imagesPath, OnClassify, owners, classifierIDs, 0.5f))
77-
// Log.Debug("ExampleVisualRecognition", "Classify image failed!");
72+
Log.Debug("ExampleVisualRecognition", "Attempting to classify via image on file system");
73+
string imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/giraffe_to_classify.jpg";
74+
string[] owners = { "IBM", "me" };
75+
string[] classifierIDs = { "default", m_classifierID };
76+
if (!m_VisualRecognition.Classify(imagesPath, OnClassify, owners, classifierIDs, 0.5f))
77+
Log.Debug("ExampleVisualRecognition", "Classify image failed!");
7878

7979
//// Detect faces get
8080
//Log.Debug("ExampleVisualRecognition", "Attempting to detect faces via URL");

Scripts/Services/VisualRecognition/VisualRecognition.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,14 @@ public class VisualRecognition : IWatsonService
224224
req.Headers["Content-Type"] = "application/x-www-form-urlencoded";
225225
req.Headers["Accept-Language"] = acceptLanguage;
226226

227-
if(imageData != null)
227+
if (owners != default(string[]))
228+
req.Parameters["owners"] = string.Join(",", owners);
229+
if (classifierIDs != default(string[]))
230+
req.Parameters["classifier_ids"] = string.Join(",", classifierIDs);
231+
if (threshold != default(float))
232+
req.Parameters["threshold"] = threshold;
233+
234+
if (imageData != null)
228235
req.Send = imageData;
229236

230237
return connector.Send(req);

0 commit comments

Comments
 (0)