
Introduction
The data is undeniable: helmets are essential for motorcycle safety. About 40% of fatal motorcycle crashes involve riders who are helmetless. And even for those who survive, traumatic brain injuries can cause irreversible damage and disability. Not to mention the burden on public health and resources. I was intrigued by a viral video of an AI traffic light that had a clever idea: it would only turn green for motorcycles if the riders had helmets on. Could I replicate this system using the Texas Instruments AM62A Starter Kit for Edge AI? I had some experience with other TI boards like the TDA4VM, so I thought this would be a breeze. But I encountered some challenges, learned some lessons, and discovered some useful tips for other developers who want to start new ML projects with Edge Impulse and the TI AM62A.Model Training
For this section an Edge Impulse account is needed. Edge Impulse is free for developers, and you can sign up here.
helmet
and nohelmet
. I uploaded the pictures to Edge Impulse using the Data acquisition tab, then I went to the Labeling queue.

helmet
and nohelmet
.



edge-impulse-runner
on the board and the model will be directly downloaded on to the AM62A.
Note: You can also just clone my trained model instead of training a new one. The Public Project URL link is https://studio.edgeimpulse.com/public/295740/latest
Hardware
Texas Instruments AM62A
The Texas Instruments AM62A SK-AM62A-LP is a “low-power Starter Kit for Edge AI systems” featuring a quad-core 64-bit Arm® Cortex®-A53 microprocessor, a single-core Arm Cortex-R5F, an H.264/H.265 video encode/decode, 2GB 32bit LPDDR4 memory, 512MB OSPI, 16GB eMMC, USB 2.0, microSD slot, Gigabit Ethernet, 3.5mm TRRS audio jack, and a 40 pin GPIO expansion header.
- Download this operating system image version: https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-AM62A/08.06.00.45
- Flash the image to a 16gb or larger microSD card with Balena Etcher or any other similar software
- Connect the Power Supply, HDMI, USB Camera, and Ethernet Cable
- Check the board IP on the HDMI screen when board boots up and the default application loads

- Login to that IP using Putty or any other SSH client, using
root
as the user, and no password - Run
npm config set user root && sudo npm install edge-impulse-linux -g --unsafe-perm

- Run
sudo pip3 install requests
(this will be required later to publish the detection rate for the WiFi traffic light module) - Adjust the camera position to aim at your target, and then run the following:
edge-impulse-linux-runner --force-engine tidl --force-target runner-linux-aarch64-am62a
. The first time you run this, you will need to login to your Edge Impulse account and select the right project. Once running, launch a web browser and navigate to your board’s IP address, port 4912. For example,http://192.168.1.66:4912
in my case. - Download the
am62a_traffic.py
file from the GitHub repository and then upload the script to the AM62A board using SFTP. The credentials are the same as logging in directly: You’ll need your IP address, username isroot
, and there is no password.
GPIO


Server Application
I created and uploaded files namedupdateHelmet.php
and helmet.ini
(which are also available in the same GitHub repo as earlier) to a web server, assigned 777 permissions to helmet.ini
, and edited the URL inside the am62a_traffic.py
file on the AM62A.
Note: For this prototype, only one inference value is uploaded to the server. For a multi-traffic light environment, unique IDs would have to be added (and also security controls).

Unihiker Traffic Light
Unihiker is a Debian/Python ready single board computer with an integrated LCD screen. So, from the hardware point of view and software requirements, it has everything to code a script to get inferences from an intermediate web server, and display traffic lights (which in fact will be 3 iterating png files:green
, yellow
and red.png
)
To begin, connect a USB-C cable to the Unihiker, open a web browser to http://10.1.2.3
, enter your WiFi SSID and password, and obtain the new IP address of the Unihiker.
Now with that Unihiker on the same network, you can connect via SFTP to the Unihiker using the user root
and password dfrobot
, and upload the unihiker_trafficLight.py
file (again, obtained from the GitHub repo) and the three traffic light images to the /images
folder.
Run the System
Now that the camera was placed, the inference module was ready, the intermediate server was ready, and the traffic light was ready, I started the system by executing from an SSH session on each board:- AM62A:
python3 am62a_traffic.py
- Unihiker:
python unihiker_trafficLight.py
Demo Video
Conclusions
The applications and the machine learning model work as expected, successfully identifying helmets (or lack of) on the Lego figures. However, the ethical and practical implications of this project are debatable (helmeted riders are penalized by the system too, and traffic congestion may increase if non-helmeted riders trigger a red-light, with no ability to acquire a helmet thus creating an indefinite red light). But, it is worthwhile to explore and develop machine learning for human and public health scenarios. This project was trained with Lego figures, but the same principles can be scaled up and applied to real-world situations. In fact, it may be easier to detect patterns with larger figures considering the camera quality and resolution. Edge Impulse also provides the ability to use a previously trained model through the BYOM feature, so there could be existing or better models already developed that would make this more applicable.Further Development
As mentioned, if a rider does not have a helmet, the light would remain red indefinitely. Obviously, that is not acceptable, so what about sending a Telegram notification to authorities instead? Just add this function to theam62a_traffic.py
file, and you are all set.
Resources
Files
- Source Code: https://github.com/ronibandini/TIAM62AITrafficLight
- Edge Impulse Public Project: https://studio.edgeimpulse.com/public/295740/latest
- Traffic Light 3D Printed Stand: https://www.thingiverse.com/thing:6277702
References
- https://www.steelhorselaw.com/news/motorcycle-accident-claim-impact-of-not-wearing-a-helmet
- https://applications.emro.who.int/docs/EM_RC56_Tech_Disc_1_en.pdf
- https://docs.edgeimpulse.com/docs/edge-impulse-studio/bring-your-own-model-byom
- https://docs.edgeimpulse.com/knowledge/concepts/machine-learning/data-augmentation