CYOLO – a pure C++ implementation of a YOLOv3 SPE for rt-ai

The Python-based YOLOv3 SPE has been working for a while now but the performance was a little disappointing at 2 or 3 fps using 1280 x 720 frames on an i7 5820K CPU/GTX 1080ti GPU machine. I was interested to see how much effect the Python code was having on overall performance. To do this I implemented the C++ rt-ai SPE API and added the C version of the YOLOv3 demo code. The result is shown above and this version now runs at just over 14 fps (17 fps at 640 x 480) which is very usable.

While Python is very convenient, it is clearly (and unsurprisingly) more efficient to use C/C++ so I will probably do that in the future where possible. The main side-effect is that rtaiDesigner has to deploy the correct compiled SPE for the target node (typically x64 or ARM) and that any shared libraries that are not part of the standard install are included too. A Dockerized version would of course solve the dependency problem and just require a container for each target architecture.

2 thoughts on “CYOLO – a pure C++ implementation of a YOLOv3 SPE for rt-ai”

    1. This SPE is based on the Darknet examples here:

      https://github.com/pjreddie/darknet/tree/master/examples

      The detection is handled by this code:

      https://github.com/pjreddie/darknet/blob/master/examples/detector.c

      This is part of the Darknet repo. For example, to do real-time detection with a webcam, run:

      ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights

      My code is basically this same processing bolted into the rt-ai infrastructure (which isn’t helpful to you at the moment). I would look at detector.c and modify it to suit your requirements. That’s what I did!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.