Canada
Asked — Edited

Ibm Watson Services Plugin

The IBM Watson Services plugin created by @PTP currently allows you to perform Speech to Text and Text to Speech as well as visual recognition using Watson Services.

You can download and install the plugin here https://www.ez-robot.com/EZ-Builder/Plugins/view/251

Before you can use the plugin, you will need to apply for a free 30 day trial of IBM Speech to Text Account here https://www.ibm.com/watson/services/speech-to-text and a free 30 day trial of IBM Text to Speech https://www.ibm.com/watson/services/text-to-speech/

I will create some examples as it moves forward and try to answer any how to questions.

Thanks for creating this PTP, as with all your plugins this is an excellent piece of work and showcase of your talents.

User-inserted image


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

PRO
USA
#17  

Step 3: Use the custom classifier

The following code uses the default (watson classifiers)


ControlCommand("IBM Watson Services", VisualRecognition)

The following code uses the above custom classifier.


ControlCommand("IBM Watson Services", VisualRecognition, "PlayingCards_978301467")

Note: PlayingCards_978301467 is the classifierId, PlayingCards is the classifier name.

The following code uses the default and the above custom classifier.


ControlCommand("IBM Watson Services", VisualRecognition, "default,PlayingCards_978301467")

Note: you can pass multiple classifier ids

Testing the initial picture (Seven of Clubs) with the custom classifier:

User-inserted image

SevenOfClubs class has the highest score.

PRO
Canada
#18  

You are amaizing.

PRO
USA
#19  

Once you have a classifierId (after you create one) you can update a classifier adding new classes e.g. cards, or delete the existent classifier, please check the ControlCommand cheat.

The free service i.e. Lite, only allows one custom classifier e.g. "PlayingCards", and does not allow updates to the existing classifier.

So the only solution, is to delete the existent classifier, and create again with more classes or create another one for another purpose, or if you feel confident move to the standard service.

bear in mind, a good training requires pictures, more than merrie.

I did a few tests (with 10 pictures per cards) an eight of clubs can get higher score in a specific angle/light.... the solution is to train more pictures.

PRO
USA
#20  

Thanks Nink.

Taking the pictures, takes time, it's very important the small details: playing with the card, putting something below to create a distorted image, change the distance/orientation from the camera, play with the light etc, maybe introduce some minors errors (fingers while holding ?).

Although the Lite model does not allow incremental updates, i plan to use my assistants e.g. Kids, to take more pictures and then I'll try to create the classifier with all the zip files (big upload).

PRO
Canada
#21  

Thanks for this ptp. My daughter is visiting so I am entertaining this weekend but will get back to this during the week and start taking photos of cards with an ez-robot camera.

PRO
Canada
#22  

I uploaded about 15 cards 15 photos each in various lighting. Various levels of success. I am using a cheap deck I picked up at local dollar store (My logic was I can buy a lot of the same cards cheap). They don't look quite like a normal deck so I may try a better deck of cards but I am confident I can get it to the point where it will recognize all 52 cards with lots of training.

Now the next question is, How do I get it to recognize multiple cards at once? Bounding boxes?

PRO
USA
#23  

@Nink,

Quote:

Now the next question is, How do I get it to recognize multiple cards at once? Bounding boxes?
we need an offline solution to detect objects, and then apply VR for each object.

There are a few ideas using opencv and tensorflow.

tensorflow with Watson: https://medium.com/ibm-watson/dont-miss-your-target-object-detection-with-tensorflow-and-watson-488e24226ef3

Tensorflow on linux is well supported you will find a lot of examples with linux and python, some of them on a Raspberry PI. Windows is a different story.

I'm exploring the windows implementation, but, so far it's not possible to built a ARC skill plugin, most libraries are x64 and ARC is a x86 (32) bits application.

The solution is to built a 64 bits application to handle the tensorflow logic and create a communication layer between the application and the ARC skill plugin.

PRO
Canada
#24  

OK thanks ptp. It sounds like it is in the to hard basket for now :-) I will just stick with the one card at a time :-)

I photographed all the cards if you want them but some need a lot more photos (or I have too many bad quality photos) as I am getting a lot of false positives. I wish the free version of Watson VR would allow us to retrain when we have an issue (No it is not an ace of clubs it is an ace of spades).

I can send anyone who wants a physical deck that I used, I Purchased them DollarRama (Canadian Dollar Store) They are Victoria brand.

Here is my edit of ptp script so others don't need to re type. Note my pictures location is different so you will have to change path but a search and replace in your fav editor is easier than retyping and debugging (Get a zip file name wrong and it will not work).




#Don't use dash or symbols for class names
DefineArray($Classes,52) 
$Classes[0]="AceOfSpades"
$Classes[1]="TwoOfSpades"
$Classes[2]="ThreeOfSpades"
$Classes[3]="FourOfSpades"
$Classes[4]="FiveOfSpades"
$Classes[5]="SixOfSpades"
$Classes[6]="SevenOfSpades"
$Classes[7]="EightOfSpades"
$Classes[8]="NineOfSpades"
$Classes[9]="TenOfSpades"
$Classes[10]="JackOfSpades"
$Classes[11]="QueenOfSpades"
$Classes[12]="KingOfSpades"
$Classes[13]="AceOfClubs"
$Classes[14]="TwoOfClubs"
$Classes[15]="ThreeOfClubs"
$Classes[16]="FourOfClubs"
$Classes[17]="FiveOfClubs"
$Classes[18]="SixOfClubs"
$Classes[19]="SevenOfClubs"
$Classes[20]="EightOfClubs"
$Classes[21]="NineOfClubs"
$Classes[22]="TenOfClubs"
$Classes[23]="JackOfClubs"
$Classes[24]="QueenOfClubs"
$Classes[25]="KingOfClubs"
$Classes[26]="AceOfHearts"
$Classes[27]="TwoOfHearts"
$Classes[28]="ThreeOfHearts"
$Classes[29]="FourOfHearts"
$Classes[30]="FiveOfHearts"
$Classes[31]="SixOfHearts"
$Classes[32]="SevenOfHearts"
$Classes[33]="EightOfHearts"
$Classes[34]="NineOfHearts"
$Classes[35]="TenOfHearts"
$Classes[36]="JackOfHearts"
$Classes[37]="QueenOfHearts"
$Classes[38]="KingOfHearts"
$Classes[39]="AceOfDiamonds"
$Classes[40]="TwoOfDiamonds"
$Classes[41]="ThreeOfDiamonds"
$Classes[42]="FourOfDiamonds"
$Classes[43]="FiveOfDiamonds"
$Classes[44]="SixOfDiamonds"
$Classes[45]="SevenOfDiamonds"
$Classes[46]="EightOfDiamonds"
$Classes[47]="NineOfDiamonds"
$Classes[48]="TenOfDiamonds"
$Classes[49]="JackOfDiamonds"
$Classes[50]="QueenOfDiamonds"
$Classes[51]="KingOfDiamonds"



DefineArray($ZipFiles,52) 
$ZipFiles[0]="Y:\Pictures\My Robot Pictures\Ace of Spades.zip"
$ZipFiles[1]="Y:\Pictures\My Robot Pictures\Two of Spades.zip"
$ZipFiles[2]="Y:\Pictures\My Robot Pictures\Three of Spades.zip"
$ZipFiles[3]="Y:\Pictures\My Robot Pictures\Four of Spades.zip"
$ZipFiles[4]="Y:\Pictures\My Robot Pictures\Five of Spades.zip"
$ZipFiles[5]="Y:\Pictures\My Robot Pictures\Six of Spades.zip"
$ZipFiles[6]="Y:\Pictures\My Robot Pictures\Seven of Spades.zip"
$ZipFiles[7]="Y:\Pictures\My Robot Pictures\Eight of Spades.zip"
$ZipFiles[8]="Y:\Pictures\My Robot Pictures\Nine of Spades.zip"
$ZipFiles[9]="Y:\Pictures\My Robot Pictures\Ten of Spades.zip"
$ZipFiles[10]="Y:\Pictures\My Robot Pictures\Jack of Spades.zip"
$ZipFiles[11]="Y:\Pictures\My Robot Pictures\Queen of Spades.zip"
$ZipFiles[12]="Y:\Pictures\My Robot Pictures\King of Spades.zip"
$ZipFiles[13]="Y:\Pictures\My Robot Pictures\Ace of Clubs.zip"
$ZipFiles[14]="Y:\Pictures\My Robot Pictures\Two of Clubs.zip"
$ZipFiles[15]="Y:\Pictures\My Robot Pictures\Three of Clubs.zip"
$ZipFiles[16]="Y:\Pictures\My Robot Pictures\Four of Clubs.zip"
$ZipFiles[17]="Y:\Pictures\My Robot Pictures\Five of Clubs.zip"
$ZipFiles[18]="Y:\Pictures\My Robot Pictures\Six of Clubs.zip"
$ZipFiles[19]="Y:\Pictures\My Robot Pictures\Seven of Clubs.zip"
$ZipFiles[20]="Y:\Pictures\My Robot Pictures\Eight of Clubs.zip"
$ZipFiles[21]="Y:\Pictures\My Robot Pictures\Nine of Clubs.zip"
$ZipFiles[22]="Y:\Pictures\My Robot Pictures\Ten of Clubs.zip"
$ZipFiles[23]="Y:\Pictures\My Robot Pictures\Jack of Clubs.zip"
$ZipFiles[24]="Y:\Pictures\My Robot Pictures\Queen of Clubs.zip"
$ZipFiles[25]="Y:\Pictures\My Robot Pictures\King of Clubs.zip"
$ZipFiles[26]="Y:\Pictures\My Robot Pictures\Ace of Hearts.zip"
$ZipFiles[27]="Y:\Pictures\My Robot Pictures\Two of Hearts.zip"
$ZipFiles[28]="Y:\Pictures\My Robot Pictures\Three of Hearts.zip"
$ZipFiles[29]="Y:\Pictures\My Robot Pictures\Four of Hearts.zip"
$ZipFiles[30]="Y:\Pictures\My Robot Pictures\Five of Hearts.zip"
$ZipFiles[31]="Y:\Pictures\My Robot Pictures\Six of Hearts.zip"
$ZipFiles[32]="Y:\Pictures\My Robot Pictures\Seven of Hearts.zip"
$ZipFiles[33]="Y:\Pictures\My Robot Pictures\Eight of Hearts.zip"
$ZipFiles[34]="Y:\Pictures\My Robot Pictures\Nine of Hearts.zip"
$ZipFiles[35]="Y:\Pictures\My Robot Pictures\Ten of Hearts.zip"
$ZipFiles[36]="Y:\Pictures\My Robot Pictures\Jack of Hearts.zip"
$ZipFiles[37]="Y:\Pictures\My Robot Pictures\Queen of Hearts.zip"
$ZipFiles[38]="Y:\Pictures\My Robot Pictures\King of Hearts.zip"
$ZipFiles[39]="Y:\Pictures\My Robot Pictures\Ace of Diamonds.zip"
$ZipFiles[40]="Y:\Pictures\My Robot Pictures\Two of Diamonds.zip"
$ZipFiles[41]="Y:\Pictures\My Robot Pictures\Three of Diamonds.zip"
$ZipFiles[42]="Y:\Pictures\My Robot Pictures\Four of Diamonds.zip"
$ZipFiles[43]="Y:\Pictures\My Robot Pictures\Five of Diamonds.zip"
$ZipFiles[44]="Y:\Pictures\My Robot Pictures\Six of Diamonds.zip"
$ZipFiles[45]="Y:\Pictures\My Robot Pictures\Seven of Diamonds.zip"
$ZipFiles[46]="Y:\Pictures\My Robot Pictures\Eight of Diamonds.zip"
$ZipFiles[47]="Y:\Pictures\My Robot Pictures\Nine of Diamonds.zip"
$ZipFiles[48]="Y:\Pictures\My Robot Pictures\Ten of Diamonds.zip"
$ZipFiles[49]="Y:\Pictures\My Robot Pictures\Jack of Diamonds.zip"
$ZipFiles[50]="Y:\Pictures\My Robot Pictures\Queen of Diamonds.zip"
$ZipFiles[51]="Y:\Pictures\My Robot Pictures\King of Diamonds.zip"

ControlCommand("IBM Watson Services", CreateClassifier, "PlayingCards", "$Classes", "$ZipFiles")