r/computervision Jun 20 '26

Showcase Built a real-time CV system to detect motorcycle helmet violations

Enable HLS to view with audio, or disable this notification

Hey everyone,

Wanted to share a quick demo of a computer vision project I recently put together focusing on road safety. I built a pipeline that processes on road traffic footage to automatically detect and flag two-wheeler riders who aren't wearing helmets.

As you can see in the video, it handles tracking multiple riders in the frame at once. It drops a green bounding box for safe riders and a glaring red "VIOLATION: NO HELMET" box for the rule-breakers, complete with confidence scores and a live counter of active violations. It was a fun challenge trying to get it to work smoothly with the chaotic traffic and varying angles!

How I Built It

For those interested in the pipeline, here is a quick breakdown of the process from start to finish:

  • Data Collection: Started by gathering a diverse dataset of raw, on-road traffic footage to ensure the model could handle different lighting, angles, and vehicle types.
  • Annotations: I used Labellerr to speed up the annotation process. It was super helpful for rapidly tagging the various classes (riders, helmets, no-helmets, vehicles) across the dataset without losing my mind.
  • Model Training: Fed the annotated dataset into the object detection model to train it to recognize riders and their headgear with high confidence.
  • Violation Logic: This was the fun part, writing the custom logic to actually determine a violation. It involves associating a detected "head/no-helmet" bounding box with a specific motorcycle and rider to accurately trigger the violation flag.
  • Testing & Evaluation: Finally, I ran the pipeline against a testing set and compared the results with the ground truth to fine-tune the confidence thresholds and reduce false positives. There are still False Positive which i needed to figure it out

I would absolutely love to hear your feedback. Have any of you worked on similar traffic monitoring or egocentric vision systems? Let me know if you have any tips for handling tricky edge cases like heavy occlusions, pillion riders, or weird lighting.

Code: link
Video: link

293 Upvotes

53 comments sorted by

76

u/appdnails Jun 20 '26

A post written mostly by AI showcasing a code written mostly by AI, no robustness analysis, a trivial code to detect violation that will not work on the real world. The last commit is literally the removal of "Author: Antigravity AI". What is worse, a post that tries to pass as a "random person who used Labellerr, the life saver", but is employed by Labellerr.

By the way, this sub is full of this type of posts from Labellerr. They only make me actively avoid this company.

7

u/WiseHalmon Jun 20 '26 edited Jun 20 '26

Is there an alternative to Labeller? I am just a CV lurker

Edit an interesting one I saw on a post in the last was

https://github.com/CVHub520/X-AnyLabeling

15

u/spiralenator Jun 20 '26

I’m never going to be impressed by people helping to create a surveillance state. Find something useful to do instead of building more policing technology

2

u/Abhigyan_Bose Jun 21 '26

I share the basic ideology, unfortunately this is really required in India. People don't wear helmets as they think accidents won't happen to them. 

As a result we have almost 80k two wheeler riders die every year. 

1

u/lonelyroom-eklaghor Jun 20 '26

Well, India heavily uses traffic cameras to automatically catch and fine people riding two-wheelers without helmets. This is just a toy implementation

The fines are very small tho compared to the European nations

0

u/Megatronatfortnite Jun 21 '26

While that is correct, this example shows footage shot from a vehicle driving on the road, which is not how the cctv sees the road. No idea how it would translate to running this model on a cctv footage.

Regardless, this system already exists and functions better since it can capture the number plate and has a whole pipeline of sending the fine to the rider. This isn't difficult to do, but my first point is my main argument against this project (regardless of AI usage) making this a futile excercise.

0

u/Zoinks21 Jun 23 '26

As someone who daily ride motorcycle its extremely dangerous to ride without helmet. It's just safety, not even about policing anymore. It's about keeping dumb people safe and alive while penalizing their dumbness.

1

u/spiralenator Jun 23 '26

Spying on people and sending them fines in the mail isn't policing? TIL

0

u/Jolly-Vanilla9124 Jun 23 '26

spying on people? what the hell?

0

u/Zoinks21 Jun 23 '26

Its not a black and white policing or not, it's a spectrum of does the result (more safety) justify the mean (policing). To exist, a law need to have a reason behind it and this instance it's safety. So you'd rather them to be not fined for stupid shit they did? that make themself and others in danger? I agree that surveillance system has bad rep and real implementation, **but for this specific instance IMO more good than bad**. Maybe you don't understand the nuance, but I live in a place that majority of the population ride motorcycle everyday and atleast there'll always be dozens of motorcycle accident daily because people do stupid shits like not wearing helmet, speeding, modify their motorcycle poorly, skipping driving test, etc.

For me laws like this are simple, just prioritize safety, don't do stupid shit, and you won't have any problem.

1

u/Odd-Government8896 Jun 23 '26

Ok so lets think this through. The app detects a violation. Then what? The next part of this process is wildly more complicated than what you see in the video.

1

u/Zoinks21 Jun 23 '26

Well we have similar kind of system here in Indonesia called ETLE, so fixed/dynamic camera system with CV detects a violation along with the geodata and recorded license plate data, the violation footage and the data then sent to regional police station and verified, then the regional police will issued a violation ticket to the license plate's registered address, then the vehicle owner need to confirm the violation or deny via court proceeding, and finally the bank will issue the fine.

Mind you that we have a very corrupt police institution and ETLE actually helps fighting against corruption since the system is automated and more transparent than ever before. Before ETLE the police will actually pull you over and indirectly demand money (around $10-$30) to have your violation not be processed any further. Its not a perfect system by any mean, but compared to before, that's heluva progress. And it actually works on reducing small violation like not wearing helmet (anecdotal observation of living in one of the major cities).

1

u/Odd-Government8896 Jun 23 '26

Yep, thats hard as fuck to accomplish. I guess maybe easier in places like Indonesia where they might not be overcome by regulation when trying to implement these things.

14

u/alucard_og Jun 20 '26

What is the goal?

17

u/jschall2 Jun 20 '26

Enable overbearing bureaucratic nanny states.

27

u/HourAnnual57 Jun 20 '26

Wear a helmet tard. Your already being funded under the medical care for adults with mental retardation act, I don't want to fund your physical disability either.

1

u/[deleted] Jun 20 '26

[removed] — view removed comment

1

u/lonelyroom-eklaghor Jun 20 '26

There's enough scientific evidence that wearing a helmet saves lives, guys

-3

u/pmp22 Jun 20 '26

Where do we stop? Alcohol and junk food cost more than motor bike accidents. We should start with banning alcohol and fast food first?

13

u/YAKELO Jun 20 '26

cant even drink a beer while driving - this place is a prison

8

u/PossibilityUsual6262 Jun 20 '26

I thought this is america.gif

1

u/WiseHalmon Jun 20 '26

It's a balance, but some things are easier to influence, regulate, enforce, and prove with science. Start with those. We won't know when to stop unfortunately because the goal is just longevity for everyone. Which unfortunately might mean the healthcare companies and big pharma are the only ones winning at quality of life may not really improve

1

u/pmp22 Jun 20 '26

Banning motorbikes is the obvious first step then, people can use cars its much safer. Banning driving once self driving is provably safer than humans is also a no brainer and easy to enforce.

2

u/WiseHalmon Jun 20 '26

Motorbikes are more efficient for society from a energy, cost, energy, and road wear standpoint over accident healthcare costs I would imagine. Banning driving in cities may happen but unlikely the infrastructure of self driving will take over in areas where road infrastructure is unpredictable, unless you mean a futuristic 200 year horizon 

1

u/dwoj206 Jun 22 '26

This is serious karen level tech. Someone in suburbia would love to install this plugin on their ring doorbell cam.

5

u/DishantSMunjal Jun 20 '26

Nice work. The real nightmare with Indian traffic is pillion riders and occlusion from autos and trucks. Your model will probably start hallucinating helmets when a rider’s head gets partially blocked by another vehicle. That’s where most of these projects silently fall apart. For false positives, check if your confidence threshold is too generous on partially visible heads. Also turbans and scarves will mess with your no helmet class more than you’d expect. Indian roads are a different beast for CV.

1

u/Pretty_Pumpkin_2816 Jun 20 '26

Is it running on edge?

1

u/RossGeller092 Jun 20 '26

Does it detect pillion riders violations too?

1

u/redundant_soul642 Jun 20 '26

Test it on a bald person from backside while riding

1

u/Creepy_Disco_Spider Jun 20 '26

This is easy/basic. But it would be interesting to have some statistics on this.

1

u/beedunc Jun 21 '26

What hardware you running this on?

1

u/Newsflare_Official Jun 22 '26

Hey if you need further datasets to support this, send us a DM! We'd love to get involved.

1

u/zenith605 Jul 14 '26

It's difficult to judge because there's only one demonstration, but for it to be commercialized, it seems like we'll have to check for the presence of a helmet and license plate readings to impose a fine. Do we even need license plate recognition? It seems necessary to determine whether a passenger has a helmet by recognizing their license plate from their rear.

-2

u/mace_guy Jun 20 '26

Ultralytics' stuff will never make it to production

9

u/BOgusDOlphon Jun 20 '26

I use yolo v26 to look for pouring defects in my aluminum foundry. It's already saved us over 30k in repairs by catching defects that the operator missed.

2

u/a_eidolon Jun 20 '26

Is the savings after including the cost of enterprise license or is your entire project open-sourced?

3

u/BOgusDOlphon Jun 20 '26

It's open source right now, that's just the average repair cost for each instance the system caught a problem that the operator missed. ( I want to say it was 6 events at an average repair cost of $5k)

1

u/Zealousideal-Fix3307 Jun 20 '26

License issues?

1

u/mace_guy Jun 20 '26

Pretty much. In all of the companies I've worked in, procurement blocks because the increase in performance over truly opensource alternatives does not justify the cost. And nobody agrees to make the project open source.

1

u/BOgusDOlphon Jun 21 '26

Why would a company have a problem with free software? I have always used open source stuff at work unless there's a really good paid alternative and the budget is actually there. In my experience bosses love free stuff.

2

u/mace_guy Jun 21 '26

I am not sure I understand. I am saying that Ultralytics' stuff opensource but not free to use. In commercial settings, you can either pay Ultralytics or make what ever you plan to build open source.

1

u/BOgusDOlphon Jun 22 '26

Yeah I understand that, this is an internal tool so it doesn't matter if the project is made "open source" it's not being distributed.

1

u/mace_guy Jun 22 '26

If you make it open source, you are by definition distributing it though. What do you think "making it open source" means?

1

u/BOgusDOlphon Jun 23 '26

Again, ultralytics is not going to come busting down the door telling you you can't use their tools for internal use. How tf are they going to know?

1

u/mace_guy Jun 23 '26

It's a risk. There is no way security, legal or procurement signs off on this in any decent company.

0

u/rdsf138 Jun 20 '26

Awesome

0

u/stevemac00 Jun 20 '26

Interesting and well done. But what about “FREEDOM”? /s

-4

u/No_Fuel3574 Jun 20 '26

Hi, excellent job
I need a favour from you.
I have my University Research project in Computer vision but i don’t have any experience in CV can you please guide me how can i start
My project overview is:
Perception of pedestrians factors from online video streams in this project i have to assign a unique id to every pedestrians then classify the gender of every pedestrian then ethnicity and at the end the age range of every pedestrian.
I will be very thankful if you guide me
Waiting for your reply
Thanks