Enable real-time object vision training using scripts
How to add the Train Vision Object By Script robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Camera category tab.
- Press the Train Vision Object By Script icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the Train Vision Object By Script robot skill.
How to use the Train Vision Object By Script robot skill
In order to train objects to the camera device, the Train Object menu is used in the camera device skill. This menu normally requires human intervention to enter the object name and use the mouse. This skill allows your robot to learn objects in real-time triggered by ControlCommand() scripts programmatically. Take a look at the Cheat Sheet within the Script skill settings to see what ControlCommand() this skill accepts.
Main Window
1. Beginning Learning Button This button will attach/detach the camera configured in the camera device skill to the program with pictures skill window.
2. Attach/Detach Camera Button This button will attach/detach the camera configured in the camera device skill to the Train Vision Object by Script skill window.
3. Train Status Bar This will show the object training process time remaining. During this time move the object around to train it at different angles.
4. Status Display This field will display the status and name of the learned object and any errors that occur.
How To Use the Train Vision Object by Script Skill
Add a camera device skill (Project -> Add Skill -> Camera -> Camera Device).
Connect to a camera.
Add this skill (Project -> Add skill -> Camera -> Train Vision Object by Script).
Press the ATTACH button. This will attach this skill to the camera device skill. You will now see a mirror of the camera's video stream in this skill.
Center the onscreen pink box on the object that will be trained. Have the object fill up the pink box completely. Press the BEGIN LEARNING button, then physically move the object around during the training process to get multiple angles.
Wait until the Train Status bar has completed and make note of the object name in the Status display so that you can use it in your scripts.
Script Sample
Here's an script sample that learns an object titled DJ FACE via ez-script:
# Check if the camera is active. If not, exit the script and notify user
if (!$IsCameraActive)
say("The camera is not active")
halt()
endif
# This is the name of the object that will be stored
$LearnedObject = "DJ FACE"
# Attach to the camera for the control
ControlCommand("Train Vision Object By Script", Attach)
# Introduce verbally out of the PC speaker what it is about to happen
SayWait("Prepare to learn " + $LearnedObject + ". 3, 2, 1, learning")
# Instruct the skill to begin learning
ControlCommand("Train Vision Object By Script", Learn, $LearnedObject)
# Wait until the skill has completed learning the object
WaitFor($CameraIsLearning == 0)
# Speak what the object has been learned
Say("I have learned " + $LearnedObject)
# Enable object tracking in the camera control
ControlCommand("Camera", CameraObjectTracking)
Add nothing to the Conversational Menu Add nothing to the BingSpeech control Add nothing to t "Train Vision Object by Script" control
All the java script code goes into "Speech Recognition" control
save
then say into your computer mic, (the Speech Recognition) "learn a new object"
sometimes I have to click "stop recording" in Bing
then it will be saved to your camera control, objects, trained images
you can keep adding other objects
that's it
RoboHappy, did you get it going yet?
Hi EzAng, Sadly no
I have not and I am not sure exactly why. I have been either running into microphone sensitivity issies , which I have been playing with or it seems the program comes back with variable or syntax issues. Still not sure i did put the audio.say in the right place in the camera. I am still learning this java stuff too.
I did find an earlier EZscript version around here, which seems to work but its not fancy, it doesn't let you verbally say the objects name prior to it learning the object. have to type the name in.
Ive also tried to repeat the setup that DJ did with his inmoov via a livehack episode, and pretty much ran into many errors with that as well. Maybe its my setup? I am using windows 10 and am using latest and greatest ARC and updated all my plugins.
I am bummed yes, this is one of the coolest features one can do with the camera and really need to find where my issue is. Any suggestions at this point would be greatly appreciated. I wish I could spend more time learning too, but that not in the cards for me right now. I just do what I can.
typing is never ask good as talking, what is your number, I will call you or:
step 1: open ARC add:
Conversational Menu BingSpeech control Train Vision Object by Script" control
Add nothing to the them
step 2: add a Camera
then in the Scripts&variables tab inside the camera config
add the java script below
Audio.sayWait("I see the "); Audio.say (getVar("$CameraObjectName"));
step 3: Add
Speech Recognition
in the config - phrases:
add a new phrase - " Learn a new object"
next to that, under the Command - click on it and add the java script below
copy and paste it
under java script
Audio.sayWait("what is the name of the new object you want me to learn");
setVar("$BingSpeech", "" );
ControlCommand("Bing Speech Recognition", "StartListening");
while (getVar("$BingSpeech") == "" );
sleep(250);
if (getVar("$BingSpeech") == "cancel"){
Audio.sayWait("cancelling");
return; }
Audio.sayWait("Let me know when you are ready to teach me what a " + getVar("$BingSpeech") + "is." );
var resp = Audio.waitForSpeech(60, "ok", "cancel");
if (resp != "ok"){ Audio.sayWait("ok, I will not learn the "+ getVar("$BingSpeech"));
return; }
ControlCommand("Camera", "CameraObjectTrackingDisable");
ControlCommand("Train Vision Object By Script", "Learn", getVar("$BingSpeech"));
sleep(1000);
while (getVar("$CameraIsLearning"));
sleep(250);
Audio.SayWait("Great, I know what a " + getVar("$BingSpeech") + "is.");
ControlCommand("Camera", "CameraObjectTracking");
save
that is it
Hi EzAng
Thanks again. I will try the program again.

But first, Just wanted to clarify adding the Audio scripts in the camera setting again.step 2: add a Camera
then in the Scripts&variables tab inside the camera config
add the java script below
Audio.sayWait("I see the "); Audio.say (getVar("$CameraObjectName"));
As you can se, there are two additonal boxes to add script(start and stop as shown) So I wanted to verify this part again in case I have something different than yours.
yes in Tracking start
Ok, So I got the program to where it does ask me the name of the object to learn, but after that, nothin happens. It never begins to learn or even tell me if the camera is not activated. Just nothing happens,
In the Camera control, click on tracking, highlight object, then under that, you will see Object, click that.
make sure your "train Vision Object by script" control sees your camera, click "attach Camera"
After you say "learn a new object" give Bing a few seconds, then click "stop recording" in Bing - sometimes you have to do this.
In Speech Recognition I put the confidence to 0.55, see below so it hears me.
check the java script you put in "speech recognition", should end up looking like this