Skip to content

Commit 03488e0

Browse files
authored
Merge pull request #121 from watson-developer-cloud/develop
Watson Unity SDK release 0.7.0
2 parents 0fd3db4 + 9175439 commit 03488e0

36 files changed

+2604
-586
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ install:
77
script:
88
- ./Travis/createProject.sh
99
- ./Travis/installSDK.sh
10-
- ./Travis/runTests.sh
10+
- travis_wait 15 ./Travis/runTests.sh
1111
- ./Travis/build.sh

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Change Log
22
==========
3+
## Version 0.7.0
4+
_2016-07-29_
5+
6+
* New: Visual Recognition: Added retraining functionality.
7+
* New: Visual Recognition: Use byteArray data to classify, detect faces and recognize text.
8+
* Fix: Updated integration testing.
9+
10+
311
## Version 0.6.1
412
_2016-07-17_
513

Config.json.enc

0 Bytes
Binary file not shown.

Examples/ServiceExamples/Scripts/ExampleDIalog.cs.meta

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/ServiceExamples/Scripts/ExamplePersonalityInsights.cs

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
public class ExamplePersonalityInsights : MonoBehaviour {
2424
PersonalityInsights m_personalityInsights = new PersonalityInsights();
25-
private string testString = "Facing certain defeat at the hands of a room-size I.B.M. computer on Wednesday evening, Ken Jennings, famous for winning 74 games in a row on the TV quiz show, acknowledged the obvious. \"I, for one, welcome our new computer overlords,\" he wrote on his video screen, borrowing a line from a \"Simpsons\" episode.\n\nFrom now on, if the answer is \"the computer champion on \"Jeopardy!,\" the question will be, \"What is Watson?\"\n\nFor I.B.M., the showdown was not merely a well-publicized stunt and a $1 million prize, but proof that the company has taken a big step toward a world in which intelligent machines will understand and respond to humans, and perhaps inevitably, replace some of them.\n\nWatson, specifically, is a \"question answering machine\" of a type that artificial intelligence researchers have struggled with for decades — a computer akin to the one on \"Star Trek\" that can understand questions posed in natural language and answer them.\n\nWatson showed itself to be imperfect, but researchers at I.B.M. and other companies are already developing uses for Watson's technologies that could have a significant impact on the way doctors practice and consumers buy products.\n\n\"Cast your mind back 20 years and who would have thought this was possible?\" said Edward Feigenbaum, a Stanford University computer scientist and a pioneer in the field.\n\nIn its \"Jeopardy!\" project, I.B.M. researchers were tackling a game that requires not only encyclopedic recall, but also the ability to untangle convoluted and often opaque statements, a modicum of luck, and quick, strategic button pressing.\n\nThe contest, which was taped in January here at the company's T. J. Watson Research Laboratory before an audience of I.B.M. executives and company clients, played out in three televised episodes concluding Wednesday. At the end of the first day, Watson was in a tie with Brad Rutter, another ace human player, at $5,000 each, with Mr. Jennings trailing with $2,000.\n\nBut on the second day, Watson went on a tear. By night's end, Watson had a commanding lead with a total of $35,734, compared with Mr. Rutter's $10,400 and Mr. Jennings's $4,800.\n\nVictory was not cemented until late in the third match, when Watson was in Nonfiction. \"Same category for $1,200,\" it said in a manufactured tenor, and lucked into a Daily Double. Mr. Jennings grimaced.\n\nEven later in the match, however, had Mr. Jennings won another key Daily Double it might have come down to Final Jeopardy, I.B.M. researchers acknowledged.\n\nThe final tally was $77,147 to Mr. Jennings's $24,000 and Mr. Rutter's $21,600.\n\nMore than anything, the contest was a vindication for the academic field of artificial intelligence, which began with great promise in the 1960s with the vision of creating a thinking machine and which became the laughingstock of Silicon Valley in the 1980s, when a series of heavily financed start-up companies went bankrupt.\n\nDespite its intellectual prowess, Watson was by no means omniscient. On Tuesday evening during Final Jeopardy, the category was U.S. Cities and the clue was: \"Its largest airport is named for a World War II hero; its second largest for a World War II battle.\"\n\nWatson drew guffaws from many in the television audience when it responded \"What is Toronto?????\"\n\nThe string of question marks indicated that the system had very low confidence in its response, I.B.M. researchers said, but because it was Final Jeopardy, it was forced to give a response. The machine did not suffer much damage. It had wagered just $947 on its result. (The correct answer is, \"What is Chicago?\")\n\n\"We failed to deeply understand what was going on there,\" said David Ferrucci, an I.B.M. researcher who led the development of Watson. \"The reality is that there's lots of data where the title is U.S. cities and the answers are countries, European cities, people, mayors. Even though it says U.S. cities, we had very little confidence that that's the distinguishing feature.\"\n\nThe researchers also acknowledged that the machine had benefited from the \"buzzer factor.\"\n\nBoth Mr. Jennings and Mr. Rutter are accomplished at anticipating the light that signals it is possible to \"buzz in,\" and can sometimes get in with virtually zero lag time. The danger is to buzz too early, in which case the contestant is penalized and \"locked out\" for roughly a quarter of a second.\n\nWatson, on the other hand, does not anticipate the light, but has a weighted scheme that allows it, when it is highly confident, to hit the buzzer in as little as 10 milliseconds, making it very hard for humans to beat. When it was less confident, it took longer to buzz in. In the second round, Watson beat the others to the buzzer in 24 out of 30 Double Jeopardy questions.\n\n\"It sort of wants to get beaten when it doesn't have high confidence,\" Dr. Ferrucci said. \"It doesn't want to look stupid.\"\n\nBoth human players said that Watson's button pushing skill was not necessarily an unfair advantage. \"I beat Watson a couple of times,\" Mr. Rutter said.\n\nWhen Watson did buzz in, it made the most of it. Showing the ability to parse language, it responded to, \"A recent best seller by Muriel Barbery is called 'This of the Hedgehog,' \" with \"What is Elegance?\"\n\nIt showed its facility with medical diagnosis. With the answer: \"You just need a nap. You don't have this sleep disorder that can make sufferers nod off while standing up,\" Watson replied, \"What is narcolepsy?\"\n\nThe coup de grâce came with the answer, \"William Wilkenson's 'An Account of the Principalities of Wallachia and Moldavia' inspired this author's most famous novel.\" Mr. Jennings wrote, correctly, Bram Stoker, but realized that he could not catch up with Watson's winnings and wrote out his surrender.\n\nBoth players took the contest and its outcome philosophically.\n\n\"I had a great time and I would do it again in a heartbeat,\" said Mr. Jennings. \"It's not about the results; this is about being part of the future.\"\n\nFor I.B.M., the future will happen very quickly, company executives said. On Thursday it plans to announce that it will collaborate with Columbia University and the University of Maryland to create a physician's assistant service that will allow doctors to query a cybernetic assistant. The company also plans to work with Nuance Communications Inc. to add voice recognition to the physician's assistant, possibly making the service available in as little as 18 months.\n\n\"I have been in medical education for 40 years and we're still a very memory-based curriculum,\" said Dr. Herbert Chase, a professor of clinical medicine at Columbia University who is working with I.B.M. on the physician's assistant. \"The power of Watson- like tools will cause us to reconsider what it is we want students to do.\"\n\nI.B.M. executives also said they are in discussions with a major consumer electronics retailer to develop a version of Watson, named after I.B.M.'s founder, Thomas J. Watson, that would be able to interact with consumers on a variety of subjects like buying decisions and technical support.\n\nDr. Ferrucci sees none of the fears that have been expressed by theorists and science fiction writers about the potential of computers to usurp humans.\n\n\"People ask me if this is HAL,\" he said, referring to the computer in \"2001: A Space Odyssey.\" \"HAL's not the focus; the focus is on the computer on 'Star Trek,' where you have this intelligent information seek dialogue, where you can ask follow-up questions and the computer can look at all the evidence and tries to ask follow-up questions. That's very cool.\"";
2625

2726
void Start ()
2827
{

Examples/ServiceExamples/Scripts/ExampleRetrieveAndRank.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
using IBM.Watson.DeveloperCloud.Services.RetrieveAndRank.v1;
2121
using IBM.Watson.DeveloperCloud.Logging;
2222
using IBM.Watson.DeveloperCloud.Utilities;
23-
using UnityEditor;
2423
using System.IO;
24+
#if UNITY_EDITOR
25+
using UnityEditor;
26+
#endif
2527

2628
public class ExampleRetrieveAndRank : MonoBehaviour
2729
{
@@ -222,7 +224,8 @@ private void OnDeleteClusterConfig(bool success, string data)
222224

223225
private void OnGetClusterConfig(byte[] respData, string data)
224226
{
225-
if(respData != null)
227+
#if UNITY_EDITOR
228+
if (respData != null)
226229
{
227230
Log.Debug("ExampleRetrieveAndRank", "OnGetClusterConfig | success!");
228231
string currentDirectory = Application.dataPath;
@@ -235,7 +238,10 @@ private void OnGetClusterConfig(byte[] respData, string data)
235238
}
236239
else
237240
Log.Debug("ExampleRetrieveAndRank", "OnGetClusterConfig | respData is null!");
238-
}
241+
#else
242+
Log.Debug("ExampleRetrieveAndRank", "Not in editor - skipping download.");
243+
#endif
244+
}
239245

240246
private void OnSaveConfig(bool success, string data)
241247
{

Examples/ServiceExamples/Scripts/ExampleToneAnalyzer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*
1616
*/
1717

18-
1918
using UnityEngine;
2019
using System.Collections;
2120
using IBM.Watson.DeveloperCloud.Services.ToneAnalyzer.v3;

Examples/ServiceExamples/Scripts/ExampleTradeoffAnalytics.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*
1616
*/
1717

18-
1918
using UnityEngine;
2019
using System.Collections;
2120
using System.Collections.Generic;

Examples/ServiceExamples/Scripts/ExampleVisualRecognition.cs

Lines changed: 71 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
using UnityEngine;
1919
using System.Collections;
20+
using System.Collections.Generic;
2021
using IBM.Watson.DeveloperCloud.Services.VisualRecognition.v3;
2122
using IBM.Watson.DeveloperCloud.Logging;
2223
using IBM.Watson.DeveloperCloud.Utilities;
@@ -34,61 +35,71 @@ void Start()
3435
{
3536
LogSystem.InstallDefaultReactors();
3637

37-
// Get all classifiers
38-
if (!m_VisualRecognition.GetClassifiers(OnGetClassifiers))
39-
Log.Debug("ExampleVisualRecognition", "Getting classifiers failed!");
40-
//
41-
// Find classifier by name
42-
m_VisualRecognition.FindClassifier(m_classifierName, OnFindClassifier);
43-
44-
// Find classifier by ID
45-
if (!m_VisualRecognition.GetClassifier(m_classifierID, OnGetClassifier))
46-
Log.Debug("ExampleVisualRecognition", "Getting classifier failed!");
47-
48-
// Delete classifier by ID
49-
if (!m_VisualRecognition.DeleteClassifier(m_classifierToDelete, OnDeleteClassifier))
50-
Log.Debug("ExampleVisualRecognition", "Deleting classifier failed!");
51-
52-
// Train classifier
53-
string m_positiveExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/giraffe_positive_examples.zip";
54-
string m_negativeExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/negative_examples.zip";
55-
if (!m_VisualRecognition.TrainClassifier("unity-test-classifier5", "giraffe", m_positiveExamplesPath, m_negativeExamplesPath, OnTrainClassifier))
56-
Log.Debug("ExampleVisualRecognition", "Train classifier failed!");
57-
58-
// Classify get
59-
if (!m_VisualRecognition.Classify(m_imageURL, OnClassify))
60-
Log.Debug("ExampleVisualRecognition", "Classify image failed!");
61-
62-
// Classify post image
63-
string m_imagesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
64-
string[] m_owners = { "IBM", "me" };
65-
string[] m_classifierIDs = { "default" };
66-
if (!m_VisualRecognition.Classify(OnClassify, m_imagesPath, m_owners, m_classifierIDs, 0.5f))
67-
Log.Debug("ExampleVisualRecognition", "Classify image failed!");
68-
69-
70-
// Detect faces get
71-
if (!m_VisualRecognition.DetectFaces(m_imageURL, OnDetectFaces))
72-
Log.Debug("ExampleVisualRecogntiion", "Detect faces failed!");
73-
74-
// Detect faces post image
75-
string m_faceExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
76-
if (!m_VisualRecognition.DetectFaces(OnDetectFaces, m_faceExamplePath))
77-
Log.Debug("ExampleVisualRecognition", "Detect faces failed!");
78-
79-
80-
81-
// Recognize text get
82-
if (!m_VisualRecognition.RecognizeText(m_imageTextURL, OnRecognizeText))
83-
Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
84-
85-
// Recognize text post image
86-
string m_textExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/from_platos_apology.png";
87-
if (!m_VisualRecognition.RecognizeText(OnRecognizeText, m_textExamplePath))
88-
Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
38+
//// Get all classifiers
39+
//Log.Debug("ExampleVisualRecognition", "Attempting to get all classifiers");
40+
//if (!m_VisualRecognition.GetClassifiers(OnGetClassifiers))
41+
// Log.Debug("ExampleVisualRecognition", "Getting classifiers failed!");
42+
43+
//// Find classifier by name
44+
//Log.Debug("ExampleVisualRecognition", "Attempting to find classifier by name");
45+
//m_VisualRecognition.FindClassifier(OnFindClassifier, m_classifierName);
46+
47+
//// Find classifier by ID
48+
//Log.Debug("ExampleVisualRecognition", "Attempting to find classifier by ID");
49+
//if (!m_VisualRecognition.GetClassifier(OnGetClassifier, m_classifierID))
50+
// Log.Debug("ExampleVisualRecognition", "Getting classifier failed!");
51+
52+
//// Delete classifier by ID
53+
//Log.Debug("ExampleVisualRecognition", "Attempting to delete classifier");
54+
//if (!m_VisualRecognition.DeleteClassifier(OnDeleteClassifier, m_classifierToDelete))
55+
// Log.Debug("ExampleVisualRecognition", "Deleting classifier failed!");
56+
57+
//// Train classifier
58+
//Log.Debug("ExampleVisualRecognition", "Attempting to train classifier");
59+
//string positiveExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/giraffe_positive_examples.zip";
60+
//string negativeExamplesPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/negative_examples.zip";
61+
//Dictionary<string, string> positiveExamples = new Dictionary<string, string>();
62+
//positiveExamples.Add("giraffe", positiveExamplesPath);
63+
//if (!m_VisualRecognition.TrainClassifier(OnTrainClassifier, "unity-test-classifier-example", positiveExamples, negativeExamplesPath))
64+
// Log.Debug("ExampleVisualRecognition", "Train classifier failed!");
65+
66+
//// Classify get
67+
//Log.Debug("ExampleVisualRecognition", "Attempting to get classify via URL");
68+
//if (!m_VisualRecognition.Classify(m_imageURL, OnClassify))
69+
// Log.Debug("ExampleVisualRecognition", "Classify image failed!");
70+
71+
//// 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(OnClassify, imagesPath, owners, classifierIDs, 0.5f))
77+
// Log.Debug("ExampleVisualRecognition", "Classify image failed!");
78+
79+
//// Detect faces get
80+
//Log.Debug("ExampleVisualRecognition", "Attempting to detect faces via URL");
81+
//if (!m_VisualRecognition.DetectFaces(m_imageURL, OnDetectFaces))
82+
// Log.Debug("ExampleVisualRecogntiion", "Detect faces failed!");
83+
84+
//// Detect faces post image
85+
//Log.Debug("ExampleVisualRecognition", "Attempting to detect faces via image");
86+
//string faceExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/obama.jpg";
87+
//if (!m_VisualRecognition.DetectFaces(OnDetectFaces, faceExamplePath))
88+
// Log.Debug("ExampleVisualRecognition", "Detect faces failed!");
89+
90+
//// Recognize text get
91+
//Log.Debug("ExampleVisualRecognition", "Attempting to recognizeText via URL");
92+
//if (!m_VisualRecognition.RecognizeText(m_imageTextURL, OnRecognizeText))
93+
// Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
94+
95+
//// Recognize text post image
96+
//Log.Debug("ExampleVisualRecognition", "Attempting to recognizeText via image");
97+
//string textExamplePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/visual-recognition-classifiers/from_platos_apology.png";
98+
//if (!m_VisualRecognition.RecognizeText(OnRecognizeText, textExamplePath))
99+
// Log.Debug("ExampleVisualRecognition", "Recognize text failed!");
89100
}
90101

91-
private void OnGetClassifiers(GetClassifiersTopLevelBrief classifiers)
102+
private void OnGetClassifiers(GetClassifiersTopLevelBrief classifiers, string data)
92103
{
93104
if (classifiers != null && classifiers.classifiers.Length > 0)
94105
{
@@ -103,7 +114,7 @@ private void OnGetClassifiers(GetClassifiersTopLevelBrief classifiers)
103114
}
104115
}
105116

106-
private void OnFindClassifier(GetClassifiersPerClassifierVerbose classifier)
117+
private void OnFindClassifier(GetClassifiersPerClassifierVerbose classifier, string data)
107118
{
108119
if (classifier != null)
109120
{
@@ -115,7 +126,7 @@ private void OnFindClassifier(GetClassifiersPerClassifierVerbose classifier)
115126
}
116127
}
117128

118-
private void OnGetClassifier(GetClassifiersPerClassifierVerbose classifier)
129+
private void OnGetClassifier(GetClassifiersPerClassifierVerbose classifier, string data)
119130
{
120131
if (classifier != null)
121132
{
@@ -127,7 +138,7 @@ private void OnGetClassifier(GetClassifiersPerClassifierVerbose classifier)
127138
}
128139
}
129140

130-
private void OnDeleteClassifier(bool success)
141+
private void OnDeleteClassifier(bool success, string data)
131142
{
132143
if (success)
133144
{
@@ -139,7 +150,7 @@ private void OnDeleteClassifier(bool success)
139150
}
140151
}
141152

142-
private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier)
153+
private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier, string data)
143154
{
144155
if (classifier != null)
145156
{
@@ -151,7 +162,7 @@ private void OnTrainClassifier(GetClassifiersPerClassifierVerbose classifier)
151162
}
152163
}
153164

154-
private void OnClassify(ClassifyTopLevelMultiple classify)
165+
private void OnClassify(ClassifyTopLevelMultiple classify, string data)
155166
{
156167
if (classify != null)
157168
{
@@ -173,7 +184,7 @@ private void OnClassify(ClassifyTopLevelMultiple classify)
173184
}
174185
}
175186

176-
private void OnDetectFaces(FacesTopLevelMultiple multipleImages)
187+
private void OnDetectFaces(FacesTopLevelMultiple multipleImages, string data)
177188
{
178189
if (multipleImages != null)
179190
{
@@ -196,7 +207,7 @@ private void OnDetectFaces(FacesTopLevelMultiple multipleImages)
196207
}
197208
}
198209

199-
private void OnRecognizeText(TextRecogTopLevelMultiple multipleImages)
210+
private void OnRecognizeText(TextRecogTopLevelMultiple multipleImages, string data)
200211
{
201212
if (multipleImages != null)
202213
{
Binary file not shown.
Binary file not shown.

Examples/ServiceExamples/TestData/visual-recognition-classifiers/turtle_positive_examples.zip.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

0 commit comments

Comments
 (0)