Thumbnail

Darknet YOLO (Obj Detection)

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 This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the Camera category tab.
  7. Press the Darknet YOLO (Obj Detection) icon to add the control to your project.

Manual

Darket YOLO website:

Requirements:

You only need a camera control, the detection is done offline (no cloud services).

User-inserted image



User-inserted image

1) start the camera.
2) 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):
User-inserted image

1) Press config
2) Edit the on changes script 
3) on changes Javascript script 

you can run the detection on demand, javascript:

Code:

controlCommand("Darknet YOLO", "Run");

The above command runs the configured on demand script.

An example of script:

Code:

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) + '%');
}
}

#1   — Edited
There is a file size limit for plugin uploads. There is a missing file required to operate the plugin.

Please download the following file:

Code:

https://pjreddie.com/media/files/yolov3-tiny.weights
And copy to the plugin folder:

Code:

C:\ProgramData\ARC\Plugins\d1db5da7-8805-41eb-8a65-a548e2fe60f6
Expected plugin folder content:
User-inserted image
#16  
working on a fix / update.
#17  
@amin:
Thanks, 35Mb file uploaded with success.

@Smarty:
Fixed.

@All:
Model file is now is included with the plugin.
Canada
#18  
wow  PTP you are amazing. This is excellent. FIVE STARS
#19  
Your program works well,

I have been using DJ's Train Vision Object By Script =  works well also

thanks for all your work

EzAng
Germany
#20   — Edited
@ptp

now I have another problem. If I use "run detection only" all is fine. a perfect live video.
If I unmark "run detection only" the video takes 15 seconds to show another frame. no smoothly live video. YOLOv2 was both together: a perfect frame video and voice playback (with the non stop playback problem). YOLOv3 now has a frame problem.:D
#21  
@Smarty,
New update with minor optimizations.

Regarding the delay: before (v2) during the script execution the detection results were queued, and that was the cause of the bug i.e. after you stop the detection the queue was still begin processed.

To solve the bug I stop the execution while the onchanges script is being executed.
I presume the 15 seconds must be delay processing the script 

Can you add the javascript code:

Quote:

//do nothing
to OnChanges script.

And try to see if the delay is relevant ?

If you are using EZ-Script I recommend changing to Javascript, EZ-Script is very slow.

Post your EZ-Script if you need help converting to Javascript.
#22   — Edited
YOLO is the acronym of the phrase "you only live once"  lol

thanks again for the app, control

EzAng.
#23   — Edited
In this case it actually means "You Only Look Once" of course referring to the urban slang...but it is describing the way the algorithm is working. Kinda a cool Tagline for a sopisticated mathematical operation!!:D
#24  
How are you Mickey?

What are you up to?

EzAng
#25   — Edited
I have a few questions for PTP.
1. Without a GPU how many frames per second/ per minute are people getting with this arrangement?
2. I have a GPU on my laptop, but you said that this code won't utilize it. Is that right?
3. What about the Latte Panda, how can such a tiny machine run this CPU/GPU intensive code?
4. How do they get object classification to run so fast on products like HuskeyLens? I get about 1 or 2 FPS on that device.
#26  
1)

NUC Core I7 
4 fps with a dummy javascript script i.e. comments only

User-inserted image


2)
Correct. This version does not use GPU, also is using the tiny model, less accurate but lighter.

3)
No tests yet. I've used Atomic PI (similar to Latte panda entry model) but is running ROS, I got a new one and I plan to install Windows, ARC and the plugin, I can guess the performance will be worst. 

4)
I'll address in another post.
#27  

Quote:

4. How do they get object classification to run so fast on products like HuskeyLens? I get about 1 or 2 FPS on that device.
HuskeyLens uses a SoC (System on chip) Kendryte K210 and the video capture is handled/processed directly on the pcb.
You can read more about the chip here:
https://www.seeedstudio.com/blog/2019/09/12/get-started-with-k210-hardware-and-programming-environment/
https://hackaday.com/2019/11/04/how-smart-are-ai-chips-really/

User-inserted image

so basically is a dual risc with a KPU:

Quote:

KPU is a general-purpose neural network processor with built-in convolution,
batch normalization, activation, and pooling operations. It can detect faces or
objects in real time
The K210 is not new (2019) is from a Chinese manufacturer, it's a good choice for IOT scenarios i.e. (no PC) , power and budget constrains. I don't like DFRobot approach they  mentioned and advertised as an open source product but later they changed to "to be open source later".

So if you are designing solutions for IOT and pairing with other micro-controllers it's good choice, everything is glue together (camera on board), serial communication, product support etc.
#28  
Regarding Robots in general If you plan to have an embedded computer, operating system, additional software e.g. ARC or ROS you will need additional hardware: GPU or a TPU. 

If you are building real robots or creating products:
1) you don't pick a Windows Desktop for a Robot.
2) For an embedded computer you pick ARM and not an Intel architecture. Intel arch is too much complicated. Only works if you have a good design (more money) to accommodate battery power, heat dissipation, space and additional hardware e.g. GPUS.

That is of my opinion, also is the reason why ROS works very well on Linux. If you need to develop a windows driver, or something low level is a pain in neck you need to deal with all the safe protections e.g. drivers certificates and closed APIs. Also a good portion of CPU is used for user interface and other user features not relevant for a Robot.

ARC/Builder's user base expects an aasy (EZ) software to run the robots with a friendly operating system i.e. Windows plus a friendly off the shelf controller (EZ-Robot) with no extra soldering or extra changes.

There was a Raspberry PI version now is gone, similar scenario for EZ-Robot controller replacement i.e. Arduino Firmwares, you can do a lot of new stuff... but requires coding not an easy task for most forum users so most people will wait for Synthiam to add the required features.

Regarding TPUs there are some low cost solutions running on Linux, and some are ported (being fixed) to run on windows.

Hopefully they will become more Windows friendly and combined with Lattepandas / Upboards will become a solution for Windows + ARC users.
#30   — Edited
ptp, 

I Downloaded and installed your skill and it works PERFECTLY!!! In the past I installed YOLO/Darknet and it took me 2 weeks to get it right. This time it took less than two minutes! I get 8 FPS. 

I made some changes to your javascript code that works better for me. I wanted to just announce the object/objects that it sees. 

Again thank you for all your hard work in getting this skill up and going!!!!!

--Thomas

Code:

var numberOfRegions=getVar('$YOLONumberOfRegions');
if (numberOfRegions==0)
{
}
else
{
var classes = getVar('$YOLOClasses');
for(var ix=0; ix {
Audio.sayWait('I see a ' + classes[ix]);
}
}
#31  
PS. Do you have a list of all of the objects that it can detect?
#32  
PPS. FEATURE REQUEST: Can you give us the coordinates of the bounding boxes, or at least the center of the bounding boxes?
#34  

Quote:

PPS. FEATURE REQUEST: Can you give us the coordinates of the bounding boxes, or at least the center of the bounding boxes?
Yes. It's possible, I'll add in the next update.