반응형
object-detection-with-yolo-v5-hijab.pdf
0.14MB

https://colab.research.google.com/drive/1zodLzCvhWQNVDOApQcbaWB87o9RIzP1a 
 
 
 

The Hijab Object-Detection with YOLOv5


The hijab object detection is an object detection task that detects whether people are wearing hijabs or masks in videos. This repository includes a demo for building a face hijab or mask detector using YOLOv5 model.

Dataset

The model was trained on dataset which contains 377 hijab or mask images belonging to 4 classes. The classes are defined as follows:

  • burqz
  • chador
  • mask
  • niqab

→ This model will be further trained on a dataset that contains about 2,000 hijab or mask images belonging to 4 classes.

Setup

  • Clone this repository and install YOLOv5
git clone ~ # 추가 예정

# install YOLO v5
git clone <https://github.com/ultralytics/yolov5.git>
cd yolov5
pip install -r requirements.txt

Training

  • --data : yaml file path (yaml file with data set information)
  • --weights : Pre-Trained model file path (pt format file), if no value is entered (‘’), initialize and train with a random weight value
  • --epochs : epoch size
  • --batch : batch size
  • --cfg : The model size determined above (saved as a yaml file in the yolov5/models folder)
    • s is the lightest model x is the heaviest model Of course, s has the lowest performance but the highest FPS, and x has the highest performance but the lowest FPS.
python train.py --img 640 --batch 16 --epochs 50 --data ./dataset/hijab.yaml --cfg ./models/yolov5s.yaml --weights yolov5s.pt --name hijab_yolov5s_results

Inference

  • If training the model was finished, use the following command for inference.
val_img_path = '../dataset/hijab/images/test/chador/84.jpeg'
!python detect.py --weights ../yolov5/runs/train/hijab_yolov5s_results/weights/best.pt --source "{val_img_path}"

Result