Thumbnail

Train Vision Object By Script

by Synthiam

Enable real-time object vision training using scripts

Requires ARC v6 (Updated 2/27/2020)

How to add the Train Vision Object By Script robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Camera category tab.
  5. 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.

User-inserted image

Main Window

User-inserted image

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

  1. Add a camera device skill (Project -> Add Skill -> Camera -> Camera Device).

  2. Connect to a camera.

  3. Add this skill (Project -> Add skill -> Camera -> Train Vision Object by Script).

  4. 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.

  5. 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.

  6. 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)

Video

Resources

You can also download the project here: trainobjectplugintest.EZB


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

PRO
USA
#1   — Edited

Do you have to make numerous scripts for each item learned or can one script handle it all?

Where are the learned items stored?

EzAng

PRO
USA
#2  

has anyone used this control?

PRO
Synthiam
#3  

Watch the tutorial video or read the manual would be two good places to start

PRO
USA
#4  

I will do it, had to get to a place to watch video, farm no internet

Thanks

EzAng

PRO
Belgium
#5  

dj

your picture off sleep&power is diff then mine. yours has a slider .here's mine. do i have an older version win10?

User-inserted image

PRO
USA
#6   — Edited

Great tutorial - I learned the java script code in "train object by script". Now  my robot can learn many things :-)

EzAng

#7  

Great Video DJ. Its bene awhile but I am finally getting around to trying it. I am trying to recreate all the script that you showed in the video, but the video would get blurry at times as you'd type away so I am not able to see clearly some of the syntax being entered, esp around the "if" statement. This is my first attempt to use the JavaScript feature also. You wouldn't happen to have that file that was created handy? :-)

PRO
USA
#8   — Edited

Hey RobHappy

try DJ script above, it works for me, my camera recognizes all the objects I trained it to see, you can change the items in the script:

This is the name of the object that will be stored

$LearnedObject = "cup"

example, cup, bottle, face etc... "

add BingSpeech, add a Camera (in the Camera script add : Audio.say("I see the "); Audio.say (getVar("$CameraObjectName"));

Add this is a script

if (!$IsCameraActive) say("The camera is not active") halt() endif

This is the name of the object that will be stored

$LearnedObject = "cup"

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 plugin to begin learning

ControlCommand("Train Vision Object By Script", Learn, $BingSpeech)

Wait until the plugin 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)

when you start the script, make sure the pink square in the Camera is totally covered with the object you are training

Good to see you also

EzAng