You only look once (YOLO) is a state-of-the-art, real-time object detection system. using Tiny YOLOv3 a very small model as well for constrained environments (CPU Only, NO GPU)
How to add the Darknet YOLO (Obj Detection) 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 Darknet YOLO (Obj Detection) 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 Darknet YOLO (Obj Detection) robot skill.
How to use the Darknet YOLO (Obj Detection) robot skill
You only look once (YOLO) is a state-of-the-art, real-time object detection system. using Tiny YOLOv3 a very small model as well for constrained environments (CPU Only, NO GPU)
Darket YOLO website: https://pjreddie.com/darknet/yolo/
Requirements: You only need a camera control, the detection is done offline (no cloud services).
- start the camera.
- check the Running (check box)
The detection will run continuously when the detection results change an On Changes script is executed (check the configuration area):
- Press config
- Edit the on changes script
- on changes Javascript script
you can run the detection on demand, javascript:
controlCommand("Darknet YOLO", "Run");
The above command runs the configured on demand script.
An example of script:
var numberOfRegions=getVar('$YOLONumberOfRegions');
if (numberOfRegions==0)
{
Audio.sayWait('No regions found');
}
else
{
Audio.sayWait('Found ' + numberOfRegions + ' regions');
var classes = getVar('$YOLOClasses');
var scores = getVar('$YOLOScores');
for(var ix=0; ix {
Audio.sayWait('Found ' + classes[ix] + ' with score: ' + (classes[ix]*100) + '%');
}
}
categories (80): https://github.com/pjreddie/darknet/blob/master/data/coco.names
ptp: Thanks! I am looking forward to it!!!!
I like the the code with a few things off, I highlighted it
var numberOfRegions=getVar('$YOLONumberOfRegions'); if (numberOfRegions==0) { // Audio.sayWait('No regions found'); } else { // Audio.sayWait('Found ' + numberOfRegions + 'regions'); //Audio.sayWait('Found '); var classes = getVar('$YOLOClasses'); for(var ix=0; ix { //Audio.sayWait("I see a " + (classes[ix])); or Audio.sayWait(classes[ix]); }
So the audio only comes out with the item it detects
EzAng
I get this error during detection
I'm guessing the detection is done in a new task (new thread)? If so, you'll have to make a copy of the bitmap if it's not being manipulated in the OnNewFrame event. Working with any camera image has to be done either in the new frame event, or a copy of itself needs to be made to work in another thread.
It works here, pretty well
EzAng
@DJ:

:Maybe is not enough to copy the bitmap ? Do you recommend another method to copy the bitmap ?
That won't copy the bitmap - it'll create a new object wrapped around the memory of the bitmap. The bitmap memory actually never changes in ARC. The memory is allocated when the camera starts and is re-used for every frame. A new Bitmap(bitmap) will create a wrapper around the memory that's being used.
An old version of ARC (when ARC days) used to create a new bitmap and dispose it for every frame. But that was super expensive on garbage collection. With the new method, the memory is reused - and that's also why a camera image can exist on many skill controls without a ton of cpu being used or memory. It's because every instance of that bitmap is actually referencing the same memory location and only the screen needs to be refreshed when the memory updates
So the solution for yours is actually quite easy - i would recommend taking the Camera's bitmap and "draw" it to a bitmap for your own detection thread. That way, you can keep your own bitmap or dispose of it how you wish etc etc and it lives for long as you want it to.
Something like...
OR fastest way is....... you can use memcpy and get an instance of your Bitmap's BitmapData - and memcpy the Camera.GetCurrentBitmapUnmanaged.Data to your bitmap's Data0