Yolov4 mask detection using Darknet and OpenCV
Mask detection
To get a local copy up and running follow these simple steps.
This is an example of how to list things you need to use the software and how to install them.
*python 3.x:
https://www.python.org/downloads/
*numpy
pip install numpy
*openCV
For Window: https://pypi.org/project/opencv-python/
pip install opencv-python
For Raspberry 4, for the love of god please follow this link: https://qengineering.eu/install-opencv-4.4-on-raspberry-pi-4.html
Clone the repo
git clone https://github.com/TienTruong98/Hackathon
Check if the MLX90640 sensor is working correctly (see if the number 33 appear):
sudo i2cdetect -y 1
- Install the visualization library in Python 3
sudo pip3 install matplotlib scipy numpy
- Install the I2C tools:
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools
- Install the Adafruit MLX90640 library:
sudo pip3 install RPI.GPIO adafruit-blinka
sudo pip3 install adafruit-circuitpython-mlx90640
python3 thermal.py
To begin using this, you need to have 3 config files in the yolo-custom directory.
- .names file
- .cfg file
- .weights file
We already have 6 files for 2 categories: face detection and mask detection. But feel free to customize your config.
~~ After that, you need to make sure that you have the correct file path at line 5, 6, 7 in detect.py ~~
~~ Ex: ~~
~~ sh ~~ ~~ labels_path = "yolo-custom\\face.names" ~~ ~~ weights_path = "yolo-custom\yolov4-tiny-custom-face-detection.weights" ~~ ~~ config_path = "yolo-custom\yolov4-tiny-custom-face-detection.cfg" ~~ ~~
~~
After that, you just need to run the run.py file in the command line to begin detect things. ~~
~~ sh ~~ ~~ python run.py ~~ ~~
~~
Truong Tran Tien - tienttse1998@gmail.com Ngo Nguyen Bang - bangmapleproject@gmail.com
If you failed to run the Python code with the error:
moduleNotFoundError: No module named 'board'
Please kindly uninstall the module by using the following bash command:
sudo pip3 uninstall board
1.
2.
3.