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.52k stars 834 forks source link

Tensorflow issue on raspberry pi #117

Closed vinamramunot-tech closed 3 years ago

vinamramunot-tech commented 3 years ago

🐛 Bug Report

44 I found the solution to run this face mask detection repo on raspberry pi that has raspbian 32-bit as the operating system. I wanted to ask if you would like this solution to be documented.

github-actions[bot] commented 3 years ago

Hello @vinamramunot-tech, Thank you for generating an issue to this project! Please wait while we get back to you.

chandrikadeb7 commented 3 years ago

🐛 Bug Report

44 I found the solution to run this face mask detection repo on raspberry pi that has raspbian 32-bit as the operating system. I wanted to ask if you would like this solution to be documented.

Sure, you can document the solution!

vinamramunot-tech commented 3 years ago

Face Mask Detection

Expected Hardware

Getting Started

New requirements.txt

keras==2.3.1
imutils==0.5.3
numpy==1.18.2
opencv-python==4.2.0.*
matplotlib==3.2.1
argparse==1.1
scipy==1.4.1
scikit-learn==0.23.1
pillow==7.2.0
streamlit==0.65.2
playsound
pyobjc

Raspberry Pi App Installation & Execution

Run these commands after cloning the project

Commands Time to completion
sudo apt install -y libatlas-base-dev liblapacke-dev gfortran 1min
sudo apt install -y libhdf5-dev libhdf5-103 1min
pip3 install -r requirements.txt 1-3 mins
wget "https://raw.githubusercontent.com/PINTO0309/Tensorflow-bin/master/tensorflow-2.4.0-cp37-none-linux_armv7l_download.sh" less than 10 secs
./tensorflow-2.4.0-cp37-none-linux_armv7l_download.sh less than 10 secs
pip3 install tensorflow-2.4.0-cp37-none-linux_armv7l.whl 1-3 mins
vinamramunot-tech commented 3 years ago

@chandrikadeb7 I have tested this on Raspberry Pi and it runs perfectly for me. Please test on your side and let me know if you face any issues. I would be happy to work on it 😃 fix issues.

chandrikadeb7 commented 3 years ago

@chandrikadeb7 I have tested this on Raspberry Pi and it runs perfectly for me. Please test on your side and let me know if you face any issues. I would be happy to work on it 😃 fix issues.

Hi, if still possible can you raise a PR with an updated requirements file. Thanks.

vinamramunot-tech commented 3 years ago

will do! thank you for giving me the opportunity.

vinamramunot-tech commented 3 years ago

@chandrikadeb7 I do want to highlight that this is fix for raspberry pi and not for any other machine. #44 error shouldn't appear on a computer with the latest TensorFlow. Do you still want me to create a PR?

chandrikadeb7 commented 3 years ago

44

Yes, please create a PR for this.

DasBlackfur commented 3 years ago

I ran into multiple issues while using a raspi 4 4GB. While running everything as documented above the first issue arises because opencv is only available in 4.1.0. and 4.3.0. I kind of fixed it by just using 4.3.0.* The next issue is the following:

Collecting pyobjc-framework-ScreenSaver==7.1 (from pyobjc->-r requirements.txt (line 12))
  Downloading https://files.pythonhosted.org/packages/eb/95/9bc53622bc8f09211459c9ac55651d04dd6da5cdb307248f770be2919d82/pyobjc-framework-ScreenSaver-7.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/setup.py", line 23, in <module>
        py_limited_api=True,
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/pyobjc_setup.py", line 414, in Extension
        os_level = get_os_level()
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/pyobjc_setup.py", line 200, in get_os_level
        with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as fp:
    FileNotFoundError: [Errno 2] No such file or directory: '/System/Library/CoreServices/SystemVersion.plist'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/

I have no idea what that means. Why is it downloading a screensaver framework?

chandrikadeb7 commented 3 years ago

I ran into multiple issues while using a raspi 4 4GB. While running everything as documented above the first issue arises because opencv is only available in 4.1.0. and 4.3.0. I kind of fixed it by just using 4.3.0.* The next issue is the following:

Collecting pyobjc-framework-ScreenSaver==7.1 (from pyobjc->-r requirements.txt (line 12))
  Downloading https://files.pythonhosted.org/packages/eb/95/9bc53622bc8f09211459c9ac55651d04dd6da5cdb307248f770be2919d82/pyobjc-framework-ScreenSaver-7.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/setup.py", line 23, in <module>
        py_limited_api=True,
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/pyobjc_setup.py", line 414, in Extension
        os_level = get_os_level()
      File "/tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/pyobjc_setup.py", line 200, in get_os_level
        with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as fp:
    FileNotFoundError: [Errno 2] No such file or directory: '/System/Library/CoreServices/SystemVersion.plist'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-9bj_in5_/pyobjc-framework-ScreenSaver/

I have no idea what that means. Why is it downloading a screensaver framework?

Please use the latest committed code. The pyobjc module is removed.

DasBlackfur commented 3 years ago

Thanks for your reply, if I use the latest committed code I get the issue that was fixed with new requirements.txt

vinamramunot-tech commented 3 years ago

@chandrikadeb7 I have started a PR #126. I am not sure why one of the checks didn't complete. Please let me know if there are any changes required.

vinamramunot-tech commented 3 years ago

@chandrikadeb7 This issue should be fixed