Awesome Open Source
Awesome Open Source


Safety helmet (hardhat) wearing detect dataset(安全帽佩戴检测数据集, SHWD). We also provide pretrained models.


SHWD provide the dataset used for both safety helmet wearing and human head detection. It includes 7581 images with 9044 human safety helmet wearing objects(positive) and 111514 normal head objects(not wearing or negative). The positive objects got from goolge or baidu, and we manually labeld with LabelImg. Some of negative objects got from SCUT-HEAD. We fixed some bugs for original SCUT-HEAD and make the data can be directly loaded as normal Pascal VOC format. Also we provide some pretrained models with MXNet GluonCV.

Dataset and model download


BaiduDrive GoogleDrive


BaiduDrive GoogleDrive


model darknet mobile1.0 mobile0.25
map 88.5 86.3 75.0

How to use dataset

We annotate the data as Pascal VOC format:


Two object class names for the task, "hat" for positive object and "person" for negative object.

How to run


Make sure you install MXNet, GluonCV, OpenCV

Test with pretrained models

Two way to inference.

First way

Download models from link BaiduDrive.

Run "python" with default settings, or change options:  
--network: darknet/mobile1.0/mobile0.25 network, default darknet53;  
--threshold: confidence that filter object;  
--gpu: use gpu or cpu, default gpu;  
--short: short side input size for original image.

Second way, inference with mxnet symbol

Download symbol models from BaiduDrive, (or GoogleDrive), then inference with symbol:



1. This repo provide 3 yolo models with different size, default darknet53.
2. Parameter "short" means the input size of short side for original image, you can try larger value if want to detect dense objects or big size image.
3. Hyper-parameter threshold means the confidence for detect, change it for different task.

How to train

You can see function "get_dataset" in the file "" to set dataset path. An example, download dataset and unzip to the path such as "D:\VOCdevkit\VOC2028", train/val dataset can set as:

train_dataset = VOCLike(root='D:\VOCdevkit', splits=[(2028, 'trainval')])
val_dataset = VOCLike(root='D:\VOCdevkit', splits=[(2028, 'test')])

Then check to set options and train, such as:

python --batch-size 4 -j 4 --warmup-epochs 3


1. One common problem when train yolo is gradient explosion, try more epoches to warmup or use smaller learning rate.
2. Much time spent on dataset loading with CPU, set "-j" number bigger if you have multi-core CPU and will improve train speed.
3. If train on Windows, sometimes program may blocked, see, if train on Linux make sure you have enough share memory.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (53,699
dataset (394
detection (238