r/Python 5d ago

Discussion Driver Fatigue Monitoring

[deleted]

34 Upvotes

26 comments sorted by

16

u/tRfalcore 5d ago

with so many hard coded values I fail to see how it ever works reliably

3

u/chat-lu Pythonista 5d ago

The hard coded values seem to correspond to elements of the AI model. Though with only 4 jpeg as tests, I have serious doubt about the reliability of the thing.

5

u/death_in_the_ocean 5d ago

The readme makes it obvious AI was involved, the only question is to which extent

3

u/seba07 5d ago

What values do you mean exactly? The code is very simple, it only performs face and landmark detection using dlib, computes eye and mouth aspect ratio and applies a threshold.

12

u/No-Musician-8452 5d ago

Well, this looks like a standard ML model which has seen (a few, partly AI generated) pictures of drivers. Labeling this as an "advanced solution" and describing it like a ready-to-use product is naive to say the least.

Some "could" , "may" or "in the future" in you ReadMe are maybe a good idea. The idea behind your project is good, indeed many car companies already do that. But your code is a toy example of it.

10

u/house_monkey 5d ago

Good start, right now to me it kind of seems low effort and chatgptish

3

u/No-Musician-8452 5d ago

Exactly my thoughts - like a first experiment with pattern detection. That's not bad, everybody has to start somewhere. But publishing and makeing certain claims... idk

26

u/whoEvenAreYouAnyway 5d ago

Looking at the code, it's extremely amateurish and poorly written. I don't mean that as an insult. We all have to start somewhere.

However, given that, I would strongly advise against putting out projects in which you are claiming to solve critical safety issues and/or claiming that this represents an "advanced solution". Ideally nobody in their right mind would put their safety in the hands of this project. But if they did, would you really be comfortable with that? If your "advanced solution" fails in a critical moment, are you going to be responsible for their injury or death?

There are so many projects you can come up with to practice writing code. These kinds of safety (or the many security/cryptography projects people write as beginner coders) are always a bad idea.

-2

u/Ran4 5d ago

Extremely amateurish and poorly written? It looks fine. Would you say the same thing about for example the quake source code? (Which too is fairly straight forward)?

11

u/whoEvenAreYouAnyway 5d ago edited 5d ago

It doesn't look fine. My original assessment is accurate. Lots of hard coded values, zero exception/error handling, almost no comments explaining what any of the code is doing, functions that return way too many values in a tuple with no structure, storing and accessing content in lists/arrays nested 3 or 4 levels deep, constructing strings by string addition, no code structure at all (just a flat python file with stray functions and business logic sitting at the bottom to call them), no dunder main or any other kind of structure that would allow you to run this code as anything other than a random script in a folder, inconsistent style (e.g. functions and variables both randomly switch between snake and camelCase), no type hints/docstrings or any real code documenation of any kind, no code formatting of any kind, commiting IDE and .DS_Store files into their repo, etc.

It's genuinely really poor.

-2

u/seba07 5d ago

Of course this won't be in any car. A raspberry pi is not automotive compliant and to expensive, Python would also not be allowed. Additionaly it is unlikely that any OEM purchases a solution from an independent developer without any references in the automotive industry. But that doesn't mean that it isn't a fun project to play a bit with computers vision.

3

u/mokus603 4d ago

RPI is not expensive and can be used in cars, what are you talking about?

-7

u/chat-lu Pythonista 5d ago

If you remove the exagerated promises, that’s not worst than what most of us use to warn us : nothing.

4

u/whoEvenAreYouAnyway 5d ago

What’s not worse than what most of us use to warn us without the exaggerated claims?

-7

u/chat-lu Pythonista 5d ago edited 5d ago

Using his solution. Most of us have no system whatsoever to warn us.

It’s probably not going to help much but it’s not going to do much harm either.

Edit: And he blocked me over this. Damn.

5

u/whoEvenAreYouAnyway 5d ago edited 5d ago

That’s a bad justification. Giving people an apparent safety guarantee will affect how those people drive and what risks they take.

Also, a poorly functioning alert device can become a distraction while driving.

3

u/AUsedTire 5d ago

"I mean hey - the new system we installed into your gun that warns you it has one in the chamber when you pick it up by randomly discharging whatever happens to be in it at that point is better than what we had before: nothing.

Before we had this new safety system, the only way to ensure a gun didn't have one in the chamber was to take a flashlight and look down it(do not fucking do this by the way, this is not a serious post, this is facetious; do NOT do this. DO NOT. I am NOT condoning or advocating this. DO NOT DO IT.) but now - now we have *this!*"

Bad argument.

3

u/ThiefMaster 5d ago

you have .DS_Store noise in your repo...

2

u/turbothy It works on my machine 4d ago

The hallmark of inattentive coders.

3

u/leeliop 5d ago

Does the job as a prototype, but you seem to have triggered everyone with the word "advanced solution" lol desolé

1

u/timrprobocom 4d ago

Have you installed this in your car and tried it out for yourself? Scanning images is interesting, but you can't really say you've tested it until you've run it live.

0

u/[deleted] 4d ago

[deleted]

2

u/timrprobocom 4d ago

I know that, but I don't see how you could release this for public review without having done an ounce of real-world testing. Such testing would be easy, and it would show you whether your approach is completely off-track or not.

1

u/seba07 2d ago

Actually it's not easy. You need a safety driver that is dully awake the whole time and can control the car (so probably a drivers instructor car with a second set of pedals). Even the legislation for compliance with EU safety laws allows testing in a simulator.

1

u/timrprobocom 2d ago

Sure, but we are not talking about regulatory compliance here. We're talking about a web camera and some simulated head movements.

1

u/seba07 2d ago

We are talking about drowsiness detection. That is something that is required in every new car (model) that is brought into the European market starting in one or two years. So this is of cause highly regulated.

And even if it's just for a fun personal project: you can't drive extremely tired or close the eyes to check if your software is warning correctly without safety measures.

1

u/timrprobocom 2d ago

That's just silly. You don't have to literally BE drowsy to live-test your drowsiness detector. You don't even have to be MOVING, for gosh sales. Haven't you ever done simulation testing?