Skip to content

T-jatesada/yolov9-face-detection

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv9 for Face Detection

In this repo, I have trained yolov9-c on the WIDER face dataset.

🛠️ Installation

Clone this repo and install YOLOv9:

# Clone
git clone https://github.com/spacewalk01/yolov9-face-detection
cd yolov9-face-detection/yolov9
pip install -r requirements.txt

Pretrained Model

  • Download the pretrained yolov9-c.pt model from google drive. Note that this model was trained on the WIDER dataset for 240 epochs.

Data Preparation

The WIDER dataset comprises of more than 30k images with more than 390k faces, each with bouding box and other various label formats.

Dataset structure:

${ROOT}
└── yolov9
└── datasets/    
    └── widerface/
        └── train/
        └── val/
    └── original-widerface/
        └── train/
            └── images/
            └── label.txt
        └── val/
            └── images/
            └── label.txt
└── train2yolo.py
└── val2yolo.py
└── widerface.yaml

To prepare the data:

  1. Download WIDER-FACE datasets.
  2. Download annotation files from google drive.

Run the following commands:

python train2yolo.py datasets/original-widerface/train [datasets/widerface/train]
python val2yolo.py  datasets/original-widerface [datasets/widerface/val]

Training

To train the model, use the following command:

cd yolov9
python train_dual.py --workers 4 --device 0 --batch 4 --data ../widerface.yaml --img 640 --cfg models/detect/yolov9-c.yaml --weights '' --name yolov9-c --hyp hyp.scratch-high.yaml --min-items 0 --epochs 500 --close-mosaic 15

Inference

For inference, run the following command:

python detect.py --weights runs/train/yolov9-c5/weights/best.pt --source assets/worlds-largest-selfie.jpg

🔗 Reference

  • YOLOv9 - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
  • WIDER FACE - WIDER FACE: A Face Detection Benchmark

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.5%
  • Other 0.5%