Nodosresowo
Posts: 1
Joined: Sat May 15, 2021 12:38 pm

Problem regarding face mask detection

Sat May 15, 2021 12:51 pm

Hi everyone,

I have a project regarding detecting face masks, aim is to detect whether the mask is worn properly, worn improperly, or not worn at all. We use a CCN using Keras and opencv2, whole code is working on python. It is supposed to be working on the Raspberry pi 4 2Gb version. In my personal computer, the code works with very good accuracy and everything is just fine. The problem is when I run it on my Rasp. its performance degrades, significantly, it even cannot detect the faces properly from time to time. Does anyone face a similar problem? How can I find a solution?

PS: It's my first topic on this forum. If its place is not correct sorry for that.

User avatar
B.Goode
Posts: 12051
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Problem regarding face mask detection

Sat May 15, 2021 2:07 pm

Nodosresowo wrote:
Sat May 15, 2021 12:51 pm
Hi everyone,

I have a project regarding detecting face masks, aim is to detect whether the mask is worn properly, worn improperly, or not worn at all. We use a CCN using Keras and opencv2, whole code is working on python. It is supposed to be working on the Raspberry pi 4 2Gb version. In my personal computer, the code works with very good accuracy and everything is just fine. The problem is when I run it on my Rasp. its performance degrades, significantly, it even cannot detect the faces properly from time to time. Does anyone face a similar problem? How can I find a solution?

PS: It's my first topic on this forum. If its place is not correct sorry for that.


" In my personal computer, the code works with very good accuracy and everything is just fine. The problem is when I run it on my Rasp. its performance degrades, significantly, it even cannot detect the faces properly from time to time. Does anyone face a similar problem?"


Wouldn't it be necessary to know the specification of your 'other' personal computer to be able to make a sensible reply to that question?

PiGraham
Posts: 4728
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Problem regarding face mask detection

Sat May 15, 2021 2:18 pm

You must expect RPI is not as fast as latest PCs.

You can use USB accelerators for CNN with Raspberry Pi.
https://magpi.raspberrypi.org/articles/ ... ccelerator

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: Problem regarding face mask detection

Sat May 15, 2021 4:47 pm

I'm not sure I understand the question.

If you are using the same software, the same NN model and the same input data, then I would expect the output to be the same.

If it is not I would rate the software as a wobbly, unreliable, mess.

Except of course I would expect the performance on the Pi to be somewhat less than when using some modern PC with heigh end GPU.

So what exactly are you running? Down to the specific versions of the software involved.

And what are you comparing the Pi against?
Memory in C++ is a leaky abstraction .

LTolledo
Posts: 5318
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Problem regarding face mask detection

Sat May 15, 2021 6:27 pm

is this another one of those

"expecting McLaren F1 performance on a stock Mini"?
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

ganzgustav22
Posts: 201
Joined: Tue Feb 11, 2020 1:04 pm

Re: Problem regarding face mask detection

Mon May 17, 2021 4:37 pm

And what are you comparing the Pi against?
Except of course I would expect the performance on the Pi to be somewhat less than when using some modern PC with heigh end GPU.
Wouldn't it be necessary to know the specification of your 'other' personal computer to be able to make a sensible reply to that question?
Nope, it wouldn't. Even the lower range PCs with Celeron processors or those all-in-one mini PCs based on Intel hardware are something like 2-10 times faster than a Pi4. It's totally normal that things run a lot slower on a Pi and it doesn't really matter that much how much slower it is exactly.

I've tried two opensource facemask detection projects on the Pi4, they were indeed slow and laggy. I'm not a programmer but one of them was using what looked like some inefficient way of acquiring the images from cam and running them through the machine learning model. This doesn't really matter on a much faster machine, on a Pi it may eat a substantial amount of computing ressources.
So what exactly are you running? Down to the specific versions of the software involved.
Because if you knew all the software and versions the OP is running you'd be like: "Oh yes, I see, in <library xy> version <x.y.z> there is a bug that makes it run slow, just use library ab version a.b.c.d and it'll be good"? :D

Long story short, a Pi is a lot slower, the thread starter needs to check where the bottleneck occurs exactly, if the software can be optimized and/or use a hardware accelerator.


Return to “General discussion”