chandrikadeb7 / Face-Mask-Detection

Face Mask Detection system based on computer vision and deep learning using OpenCV and Tensorflow/Keras
https://www.youtube.com/watch?v=AAkNyZlUae0
MIT License
1.55k stars 844 forks source link

Implementation in Rasp Pi #53

Open chandrikadeb7 opened 3 years ago

chandrikadeb7 commented 3 years ago

Please create a go-to-code folder comprising the necessary codes to detect masks using Rasp Pi.

sahebsunny commented 3 years ago

Mam, it's Interesting I have done a similar project but never thought of Implementing it in Rasp Pi Let me work on it

chandrikadeb7 commented 3 years ago

Mam, it's Interesting I have done a similar project but never thought of Implementing it in Rasp Pi Let me work on it

Okay good luck!

chandrikadeb7 commented 3 years ago

@sahebsunny Are you still working on it?

sahebsunny commented 3 years ago

@sahebsunny Are you still working on it?

mam sorry for the delayed response I need some suggestions, I think the code will work in Rasp Pi. It may need some changes but I can not able to check as I am still at home and I don't have the kits or the board. Thank you for your response.

chandrikadeb7 commented 3 years ago

@sahebsunny Are you still working on it?

mam sorry for the delayed response I need some suggestions, I think the code will work in Rasp Pi. It may need some changes but I can not able to check as I am still at home and I don't have the kits or the board. Thank you for your response.

Okay no problem. You can check on other issues meanwhile. :)

vinamramunot-tech commented 3 years ago

126 PR should help with the setup instruction for raspberry pi. Not sure about Jetson Nano. @Defcon27 you are welcome to try out and see if this works on Jetson Nano.

Allisthenics commented 3 years ago

Good day, I and my workmate have decided to play with this project myself and we happened to find a working solution with the Raspberry Pi. However, I am working on replicating the result with my own Raspberry Pi because I only remember a part of the solution as I was working on the bugs. Edit: Since the beginning of April, we did not know that this was a solution that people were searching for till the day that I typed this comment.

To briefly explain what we have done, we installed a version of numpy that happened to work with the entire algorithm. Sadly, this is where I do not have specific information on the problem. But after solving this problem, we moved on to edit a few lines of code in the file "hdf5_format.py" based on the error readings we got while trying to run the algorithm.

As I said earlier, I'm still working on replicating my results, and I will try to get back here as soon as I can.

Edit: I do not wish to officially say that I'd like to take over this problem, but if I manage to find the solution, I will request permission to add my solution to this repository.

inmicro commented 3 years ago

you just need to install separate libraries on the raspi.

In addition to that, you need a picamera implementation. Setting up mkvirtualenv on the pi is a pain. Any way, here is my hack for the picamera:

pip install "picamera[array]"

import picamera by: import picamera and replace this: vs = VideoStream(src=0).start() with: vs = VideoStream(usePiCamera=True).start()

This is on a really old build though. Something like 8-9 months ago(you didn't have the heroku app then iirc)

Allisthenics commented 3 years ago

So we've modified the requirements file to look like this

tensorflow==2.2.0 [MANUAL INSTALLATION]

keras==2.4.3 imutils==0.5.4 numpy==1.20.0

opencv-python==4.5.2 [MANUAL INSTALLATION]

matplotlib==3.4.1 argparse==1.4.0 scipy==1.4.1 scikit-learn==0.24.1 pillow==8.2.0 streamlit==0.79.0

From what we tested, the program works well with the above mentioned versions of numpy (a newer version) and scipy (an older version). It is recommended to manually install the above mentioned versions of openCV (4.5.0 works as well) and TensorFlow, which we managed to accomplish through qengineering.eu

My assumption regarding the manual installation is that a direct approach with python leads to the installation of outdated files.

saifuddin123 commented 2 years ago

Hi, i am trying to run this project on Raspberry pi 32 bit buster OS. Was able to install all the libraries with help of suggestions above, thanks to Allisthenics. Executing train_mask_detector.py , i am seeing below error. Appreciate your help.

(cv) pi@raspberrypi:~/Downloads/Face-Mask-Detection $ python3 train_mask_detector.py --dataset dataset [INFO] loading images... /home/pi/.virtualenvs/cv/lib/python3.7/site-packages/PIL/Image.py:963: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images "Palette images with Transparency expressed in bytes should be " Traceback (most recent call last): File "train_mask_detector.py", line 66, in data = np.array(data, dtype="float32") ValueError: array is too big; arr.size * arr.dtype.itemsize is larger than the maximum possible size.