Free AI Laptimer for RC Cars
Would you like to become a better RC racer and measure your lap times? But you'd prefer it to be free? Quick question: do you have a laptop with a camera? Then I'll show you how you can build a lap timer for €0. It's really easy too!
Simple Idea
The idea is impressively simple: you point the camera at a point on your race track. Object recognition constantly evaluates the camera's video stream and checks whether there is a race car in the image. The timing starts at that moment. The clock stops when the car passes the same point again.
Recognize a Car
In general, it is not easy to recognize objects in images or videos. Fortunately, today we have powerful AI tools that make this very easy for us. For the lap timer, I use a pre-trained YOLO 11 AI model that can recognize 80 different objects, such as people, bicycles, and even cars. Using the camera is very easy with Python using the OpenCV library.
YOLO
YOLO stands for You Only Look Once, a family of real-time object detection algorithms. It is widely used in computer vision tasks to identify and locate objects within images or video streams. YOLO is known for its speed and efficiency, making it suitable for applications requiring real-time processing, such as surveillance, autonomous vehicles, and robotics. As illustrated below, it has 24 convolutional layers, four max-pooling layers, and two fully connected layers.
The first 20 convolution layers of the model are pre-trained using ImageNet by plugging in a temporary average pooling and fully connected layer. Then, this pre-trained model is converted to perform detection since previous research showcased that adding convolution and connected layers to a pre-trained network improves performance. YOLO’s final fully connected layer predicts both class probabilities and bounding box coordinates.
YOLO divides an input image into an S × S grid. If the center of an object falls into a grid cell, that grid cell is responsible for detecting that object. Each grid cell predicts B bounding boxes and confidence scores for those boxes. These confidence scores reflect how confident the model is that the box contains an object and how accurate it thinks the predicted box is.
YOLO models, including yolo11n.pt, are commonly trained on the COCO dataset. The COCO dataset (short for Common Objects in Context) is a widely used large-scale dataset for training and evaluating computer vision models. It was developed by researchers at Microsoft and is designed to advance the understanding of objects in complex, real-world scenes.
As you can see in the picture, the RC cars are not all recognized as cars, but some are recognized as skateboards or trucks. However, this is not a problem because we will take this into account in our software.
YOLO Installation
As always, you can easily install YOLO with pip:
pip install ultralytics
OpenCV
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being an Apache 2 licensed product, OpenCV makes it easy for businesses to utilize and modify the code. To install OpenCV, simply execute the following command:
Pip install opencv-python