Abstract
The safety helmet wearing of workers is extremely important to their safety in construction scenarios, and it is very meaningful for computer vision, pattern recognition and artificial intelligence. This paper proposes a new Improved Boosted Random Ferns algorithm (IBRFs) for safety helmet wearing status detection. IBRFs originates from the Boosted Random Ferns algorithm (BRFs) and introduces the weighted coefficient to improve. In IBRFs, firstly, the feature is extracted by Histogram of Oriented Gradient (HOG) to form the feature domain space of the image. Secondly, the random binary test method is used to construct random ferns in the feature domain space. Then, a weak (acceptable) classifier is constructed by random ferns. Finally, an improved Real AdaBoost algorithm is used to select the most discriminative ones to construct IBRFs. Experimental evaluation on an enlarged public Safety Helmet Wearing-datasets (GZMU-SHWD) shows that the result of IBRFs outperforms those of the existing advanced detection algorithms, including SSD, YOLOv3 and Faster R-CNN, which further demonstrates the effectiveness of IBRFs for safety helmet wearing status detection.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Avoid common mistakes on your manuscript.
1 Introduction
The safety helmet, as the basics safety protection equipment for constructers, is mainly used to protect workers’ head and prevent them from being hit and collided by sharp objects [18]. It is of great significance to the personal safety of constructers. Therefore, it has become a hot topic of artificial intelligence to detect the wearing status of safety helmet, in different construction scenarios, based on computer vision technology, especially in pattern recognition community.
The task of object detection is to find out the interested objects in the image and determine their classes and locations. We form the safety helmet wearing status detection as two class object detection problems. In pattern recognition community, there are two main methods, traditional statistical pattern recognition and deep learning, to detect the safety helmet wearing status.
In traditional object detection, firstly, some candidate regions are selected from a given image. Then, feature extraction is carried out for these regions, the commonly used features are Histogram of Oriented Gradient (HOG) [4], Local Binary Patterns (LBP) [12], Scale-Invariant Feature Transform (SIFT) [10] etc. Finally, the pretrained classifier is used for classification. Limei Cai et al. constructed standard images of helmets, extracted four directional features, modeled the distribution of these features using a Gaussian function and separated local images of frames into helmet and non-helmet classes [2]. Bahaa et al. Detect the helmet in different scenarios [1]. Park et al. proposed a background difference method for detection [13]. After extracted HOG features from the input image, SVM classifier is used to detect person and safety helmet.
There are two problems in the existing safety helmet wearing detection based on traditional methods. One is the region selection strategy based on sliding window lack of pertinence, with high time complexity and redundant window. Another is the hand-designed features have poor robustness to the changes of diversity.
In deep learning method, after multiple convolutional and pooling operations, the extracted features are put into the classifier for detection. There are two distinct ideas of deep learning detection. One is using semantic segmentation [11, 27] for reference, which mainly includes You Only Look Once (YOLO) [14], YOLOv3 [17] and Single Shot MutiBox Detector (SSD) [19], predicting the classes and locations of different objects with convolutional neural network. This kind of method can achieve higher accuracy while slower detection speed. Another is the R-CNN framework based on candidate region, which mainly includes R-CNN [8], Fast R-CNN, and Faster R-CNN [15]. Within this framework, the object candidate box is generated for classification and regression. This framework has strong generalization ability and has been widely used. Cheng Raoet al. proposed a helmet wearing detection algorithm based on SAS-YOLOv3-Tiny [3]. Fang Ming et al. proposed a fast detection algorithm based on YOLOv2 [5].Added dense blocks, and compressed the network by adopting the lightweight network structure, to realize the rapid detection of safety helmet. Wen P et al. proposed a method based on the YOLOv3 algorithm to detect the wearing of safety helmet [24]. By using multi-scale training and increasing the anchor points to enhance the robustness of network for different sizes object detection, the Fast R-CNN is optimized.
In general, deep learning can achieve high accuracy, however a lot of samples, high hardware, and long time is need for training. Moreover, there is no public large-scale safety helmet datasets. In this way, the unbiased estimation based on deep learning is in efficient on small samples.
In order to realize the accurate detection of helmet wearing status, this paper proposes an new IBRFs. Based on HOG feature to construct random ferns, then weak classifiers are constructed. Selected the most discriminative ones to build a strong classifier to detect the wearing status of the safety helmet. The main contirbutions of our work are summarized as follows:
-
Feature extraction of image based on HOG domain solves the inaccurate feature description.
-
Weak classifiers are constructed based on BRFs, by selecting the position points and parameters with strong discriminative ability to improve their performance.
-
An improved ensemble learning algorithm is proposed to enhance the discriminative ability of strong classifiers.
The rest of this paper is composed of 4 sections. Section 2 briefly describes the theory of random ferns. Section 3 presents the proposed IBRFs. Section 4 submits experimental validation of IBRFs on GZMU-SHWD. And section 5 concludes the work and points out the future work.
2 RandomFerns Algorithm
Random Ferns algorithm (RFs) is an ensemble learning method that performs well in classification and regression tasks in machine learning [21, 25]. As shown in Fig. 1, RFs takes a particular decision tree as the basic meta-model, and there is only one judgment criterion in each layer of fern. In the random ferns, the training time increases linearly as the number of ferns increases, so the calculating feasibility can be confirmed.
2.1 Random ferns cluster based on HOG domain
In order to improve the robustness of the random ferns classifier for illumination and intra-class variation, we extract image HOG features referencing to the feature representation based on the intensity domain in the RFs [20]. Given an image window X, HOG is calculated in the center position U of the sub-window S. Each local gradient in the sub-window S contributes to the construction of the HOG, and is positioned in the corresponding box through weighting processing. In the HOG, two boxes are randomly selected for binary test:
Where I(a) is the index function, if ais true, then I(a) = 1, otherwiseI(a) = 0. θ = {b, b′} is two randomly selected dindexes in the interval [1, B], and B is the total number of cases in the histogram. A binary feature vector of fern is synthesized by aggregating M local features to represent S belong to one class. Therefore a single random fern f(x; u, θ) based on HOG domain is represented as follows:
In Fig. 2, the right one is random ferns based on HOG, each output of the random ferns is a M dimensional binary feature vector Z, Z ∈ 0, …, 2M − 1. In the image window X, When M = 3, the output feature of random fern s is Z = {011} = 3, Z = {0, …, 255}. The output of the random ferns is determined by u and θ = {θ1, …, θM}.
As shown in Fig. 3, when training N samples in the same class, random ferns will output a probability distribution P(F| C). For training samples with multiple classes, random ferns will output probability distribution P(F| Ck) of each class, Ck denotes the probability of the input sample belongs to class k. When testing a sample with an unknown class, using a fixed-size rectangular sliding window to scan it, its feature is calculated by random ferns. Semi-naive Bayes is used to get the final classification.
2.2 Boosted random ferns
In order to improve the performance of the classifier, BRFs [22] adopts the Real AdaBoost strategy [7] to select T weak classifiers ht(x), t = 1, …, T with strong discriminative ability to build a strong classifier H(x):
Where β is a threshold that determines the classifier tolerance, each weak classifier returns a confidence score:
Where ε is a small positive integer to avoid zero division. Higher score weak classifier ht(x) denotes there is a significant difference between object and background. It means the random ferns can produce a weak classifier with recognition ability on the location of u and parameter selection θ.
In order to get the most suitable u and θ for each weak classifier, using N samples S = {(x1, y1), …, (xN, yN)} to train the classifier, where yi ∈ {−1, +1}, yi = − 1 represents the image window xi belongs to the background class, and yi = + 1 represents xi belongs to the object. Every training sample also has an associated weight ωt(i), it is initialized as \({\omega}_1(i)=\frac{1}{N}\). The main steps of BRFs as follows:
Specifically, we first define a set {u1, …, uL} of all possible 2D pixel coordinates within a window X and a pool {θ1, …, θR} of R different sets of random pair of histogram bin indices.
Then, a weak classifier is constructed. Each iteration of a possible random pair (ul, θr) generates a random fern f(x; ul, θr). Each random fern is evaluated according to the whole training datasets, and HOG of object and background was constructed.
Where P(z| O) stands for P(f(xi; ul, θr)| O), the output valuezof random ferns under the parameters ut and θt represents the probability that the image windowxbelongs to the object. P(z| B) stands for P(f(xi; ul, θr)| B). It is the probability that the image window belongs to the background.
The discriminative ability of each weak classifier ht(x) is determined by the Bhattacharyya coefficient [16] Q between P(z| O) and P(z| B).
The value of Q is lower, the discriminative ability of weak classifier is stronger. A weak classifier ht(x) is constructed by retaining the parameters \(\left({u}_{l^{\ast }},{\theta}_{r^{\ast }}\right)\) that minimize Q.
Finally, sample weight is updated:
3 Algorithm design
3.1 Improved boosted random ferns algorithm
In order to enhance the detection accuracy, the Real AdaBoost method [7] is introduced in BRFs [22]. It selects the weak classifier ht(x) with strong discriminative ability, and obtains the classifier H(x) by accumulating sum.
This method simply combines multiple weak classifiers, and pays less attention to weak classifiers with low weight. In order to achieve optimal combination of classifiers, this paper enhances the BRFs by Real AdaBoost with the help of a new definition method [23]. Random variable is defined as:
Let \(D=\sum_{t=1}^T{\gamma}_t{D}_t\), then weighted combination is used to construct strong classifier H(x):
Where γt is the ratio of mean μt and variance \({\delta}_t^2\) of random variable D, μt and \({\delta}_t^2\) are expressed as:
After introducing the weighted coefficient, the sample weight is updated as follows:
IBRFs is show as algorithm 1:
3.2 Algorithm implementation
As shown in Fig. 4, the pipeline framework of IBRFs is given as follows.
At the training stage, for an input image, firstly, the feature is extracted by HOG with candidate box to form the feature domain space. After that, the random binary test is used to construct the random ferns. Next, a weak classifier is built by the random ferns. At last, the improved Real AdaBoost algorithm is used to select the most discriminative ones to construct IBRFs. At the testing stage, the HOG for input image with candidate box is obtained, and estimated by the IBRFs to complete the safety helmet wearing status detection.
4 Experimental results and analysis
4.1 Datasets and experimental platform
The experimental environment of this paper is as follows: window10, 64-bit operating system, Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz, 8G RAM.
In this experiment, an enlarged Safety Helmet Wearing-datasets (SHWDFootnote 1) called GZMU-SHWD is taken to evaluate the IBRFs. The GZMU-SHWD originates from Internet crawler data (Google-Net crawler) and SHWD. It consists of 7589 images, including 5000 training samples, 2481 test samples and 108 verification samples. Some data are shown in Fig. 5.
The image comes from the different scenarios, different lighting conditions and different angles, and the sample distribution is uneven. Therefore, image preprocessing is performed. The image is augmented by horizontal flipping and clipping, and normalized to 100*120.
4.2 Experimental parameter setting
In the training phase, some parameters of the model are fine-tuned with reference to BRFs [22]. The experimental parameters are shown in Table 1.
4.3 Experimental results
In order to evaluate the effectiveness of the proposed IBRFs, precision and recall are used in the measuring the effectiveness of the proposed method for safety helmet wearing status detection. The experimental evaluation formula is given as:
Where True Positive (TP) is the positive sample predicted to be positive, False Positive (FP) is the negative sample predicted to be positive, False Negative (FN) is the negative sample predicted to be negative.
4.3.1 Comparative analysis of different ensemble algorithms
The weighted coefficient is used to improve the Real AdaBoost algorithm to get the best combination coefficient. In order to verify the superiority of improved Real AdaBoost algorithm for classification, the algorithms are tested on Ionoshpere and Sonar datasets [23] and compared with other algorithms. The results are shown in Table 2.
As show in Table 2, the detection error rate and variance of Improved Real AdaBoost are lowest. On Ionoshpere datasets, the detection error rate of Improve Real AdaBoost is 0.0939, which is 0.0129 lower than Gentle AdaBoost, and 0.0111 lower than Real AdaBoost. This verifies the effectiveness of the Improve Real AdaBoost algorithm to help the IBRFs algorithm in the classification problem.
4.3.2 Analysis of BRFs and IBRFs
In order to verify the effectiveness and generalization ability of IBRFs.In the same experimental environment, the BRFs and IBRFs are trained on public datasets include UIUC cars [26], INRIA horses [6], and GZMU-SHWD. There are 108 images in UIUC cars datasets, including 139 detection objects. There are 35 images in the INRIA horses datasets, including 45 detection objects. There are 108 images in GZMU-SHWD datasets, including 124 detection objects. The detection results of the two models are shown in Table 3.
Table 3 Compares the performance of BRFs and IBRFs on different datasets, and the detection accuracy of the IBRFs on INRIA horses datasets, UIUC cars datasets and GZMU-SHWD datasets is improved compared with the BRFs, especially on GZMU-SHWD, the detection accuracy reaches 92.74%, which is about 9.5% higher than the BRFs, The results show that the IBRFs is effective to detect the wearing status of safety helmet.
Figure 6 is the PR (Precision and Recall) curves of GZMU-SHWD, it can be seen that the IBRFs is better than BRFs in detection accuracy and recall rate. The results show that the weighted coefficient introduced in this paper can improve the detection accuracy of the model.
The IBRFs can distinguish and select random ferns during the detection process, so that the classifier can focus on the object parts that are more relevant to the classification. In Fig. 7, we observe the results of feature selection for the three different object classifiers. The first row depict the spatial layout of the ferns used to ensemble the classifiers. The colored contour boxes indicate the positional density and weight of individual ferns that give rise to the strong classifier. Red contours indicate higher density of ferns. We can see how ferns concentrate on those semantically relevant regions, such as the wheels of cars, or the neck and head on horses. The second row contains shared ferns distributions map for each strong classifier, the height of the i column indicates the number of weak classifiers that use the parameters θi .
4.3.3 Analysis of experimental results
In order to verify the superiority of our algorithm, compared it with other algorithms in the same hardware environment. IBRFs, BRFs, SVM + HOG [9], SSD [19], Faster R-CNN [15] and YOLOv3 [17] are tested on GZMU-SHWD. The detailed detection results are shown in Table 4.
From Table 4, in the safety helmet wearing status detection task, the detection accuracy of IBRFs is 92.74%, which is higher than SSD, Fast R-CNN, BRFs, especially HOG + SVM. Compared with BRFs, the detection accuracy is improved by 9.5%, which verifies the effectiveness of IBRFs. In CPU environment, the detection speed of IBRFs is about 15 times faster than Fast R-CNN, compared with BRFs, the detection speed of IBRFs is also improved. It verifies IBRFs meets the requirements of real-time detection. Above all, in the helmet wearing status detection task, the IBRFs proposed in this paper can achieve faster detection speed and higher detection accuracy.
Figure 8 shows the detection results of IBRFs in the safety helmet detection task in different angles, partial occlusion and complex environment. The reason for the success of IBRFs is that it adopts a crowd voting strategy based on prior probability, takes the differences between various features into full consideration, and gains strong adaptability in generalization.
5 Conclusions
A novel object detection method, known as Improved Boosted Random Ferns algorithm (IBRFs) is proposed in this work for safety helmet wearing status detection. The IBRFs makes use of the advantage of basic BRFs and the improved Real AdaBoost algorithm for voting. In the proposed method, it adopts a crowd voting strategy based on prior probability, takes the differences between various features into full consideration, and gains strong adaptability in generalization for safety helmet wearing status detection. The proposed IBRFs shows more efficient outcomes compared to some deep object detectors. Furthermore, two other public datasets, INRIA horses datasets and UIUC cars datasets, are tested and compared with the basic BRFs. The results aslo verified the competitiveness of IBRFs.
Due to the effectiveness of the proposed IBRFs, it is suitable for safety helmet wearing status detection under various scenarios. Next, some recent object detection methods, such as FCOS and DETR, will be taken into account to enhance our IBRFs for object detection task so as to complete complex and various applications.
Notes
The SWHD database: [Online]. Available: https://github.com/njvisionpower/Safety-Helmet-Wearing-Dataset#model, October 11, 2019.
References
Bahaa E, Mneymneh et al (2017) Automated hardhat detection for construction safety applications[J]. Procedia Eng 196:895–902
Cai L, Qian J (2011) A method for detecting miners based on helmets detection in underground coal mine videos[J]. Min Sci Technol (China) 21(4):553–556
Cheng R, He X, Zheng Z, Wang Z (2021) Multi-scale safety helmet detection based on SAS-YOLOv3-tiny [J]. Appl Sci 11(8):3652–3652
Dalal N, Triggs B (2005) Histograms of oriented gradients for human detection[C]. Comput Vis Pattern Recognit 33(9):886–893
Fang M, Sun TT, Sao Z (2019) Fast helmet wearing detection based on improved yolov2 [J]. Opt Precis Eng 27(05):1196–1205
Ferrari V, Fevrier L, Jurie F, Schmid C (2008) Groups of adjacent contour segments for object detection. IEEE Trans Pattern Anal Mach Intell 30(1):36–51. https://doi.org/10.1109/TPAMI.2007.1144
Freund Y (1995) Boosting a weak learning algorithm by majority [J]. Inf Comput 121(2):256–285
Girshick R, Donahue J, Darrell T, Malik J (2014) Rich feature hierarchies for accurate object detection and semantic segmentation. 2014 IEEE Conference on Computer Vision and Pattern Recognition, pp 580–587. https://doi.org/10.1109/CVPR.2014.81
Jebril NA, Al-Zoubi HR, Abu Al-Haija Q (2018) Recognition of handwritten Arabic characters using histograms of oriented gradient (HOG). Pattern Recognit Image Anal 28:321–345. https://doi.org/10.1134/S1054661818020141
Lowe DG (2004) Distinctive image features from scale-invariant keypoints[J]. Int J Comput Vis 60(2):91–110
Martinez M, Yang K, Constantinescu A, Stiefelhagen R (2020) Helping the blind to get through covid-19: social distancing assistant using real-time semantic segmentation on rgb-d video. Sensors (Switzerland) 20:1–17. https://doi.org/10.3390/s20185202
Ojala T, Pietikainen M, Maenpaa T (2002) Multiresolution gray-scale and rotation invariant texture classification with local binary patterns[J]. IEEE Trans Pattern Anal Mach Intell 24(7):971–987
Park MW, Elsafty N, Zhu ZH (2015) Hardhat-wearing detection for enhancing on-site safety of construction workers [J]. J Constr Eng Manag 141(9):1–16
Redmon J, Divvala S, Girshick R, Farhadi A (2016) You only look once: unified, real-time object detection. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp 779–788. https://doi.org/10.1109/CVPR.2016.91
Ren S, He K, Girshick R, Sun J (2017) Faster R-CNN: towards real-time object detection with region proposal networks [J]. IEEE Trans Pattern Anal Mach Intell 39(6):1137–1149
Schapire RE, Singer Y (1999) Improved boosting algorithms using confidence-rated predictions [J]. Mach Learn 37(3):297–336. https://doi.org/10.1023/A:1007614523901
Shi T, Niu Y, Liu M, Yang Y, Wang C, Huang Y (2019) Underwater dense targets detection and classification based on YOLOv3. 2019 IEEE International Conference on Robotics and Biomimetics (ROBIO), pp 2595–2600. https://doi.org/10.1109/ROBIO49542.2019.8961615
Siebert FW, Lin H (2020) Detecting motorcycle helmet use with deep learning. Accid Anal Prev 134:105319. https://doi.org/10.1016/j.aap.2019.105319
Thakar V, Saini H, Ahmed W, Soltani MM, Aly A, Yu JY (2018) Efficient single-shot multibox detector for construction site monitoring. 2018 IEEE International Smart Cities Conference (ISC2), pp 1–6. https://doi.org/10.1109/ISC2.2018.8656929
Villamizar M, Moreno-Noguer F, Andrade-Cetto J, Sanfeliu A (2010) Shared random ferns for efficient detection of multiple categories. 2010 20th International Conference on Pattern Recognition, pp 388–391. https://doi.org/10.1109/ICPR.2010.103
Villamizar M, Andrade-Cetto J, Sanfeliu A, Moreno-Noguer F (2012) Bootstrapping boosted random ferns for discriminative and efficient object classification [J]. Pattern Recogn 45(9):3141–3153
Villamizar M, Andrade-Cetto J, Sanfeliu A, Moreno-Noguer F (2018) Boosted random ferns for object detection. IEEE Trans Pattern Anal Mach Intell 40(2):272–288. https://doi.org/10.1109/TPAMI.2017.2676778
Wang B, Chen F, Deng P (2014) Online object tracking based on sparse subspace representation. The 26th Chinese Control and Decision Conference (2014 CCDC), pp 3975–3980. https://doi.org/10.1109/CCDC.2014.6852876
Wu F, Jin G, Gao M, He Z, Yang Y Helmet detection based on improved YOLO V3 deep model. 2019 IEEE 16th International Conference on Networking, Sensing and Control (ICNSC), pp 363–368. https://doi.org/10.1109/ICNSC.2019.8743246
Xudong C, Yichen W, Fang W et al (2014) Face alignment by explicit shape regression [J]. Int J Comput Vis 107(2):177–190
Yokoya M, Iwasaki A (2015) Generalized-hough-transform object detection using class-specific sparse representation for local-feature detection. 2015 IEEE International Geoscience and Remote Sensing Symposium (IGARSS), pp 2852–2855. https://doi.org/10.1109/IGARSS.2015.7326409
Zhang J, Yang K, Stiefelhagen R (2020) ISSAFE: improving semantic segmentation in accidents by fusing event-based data. arXiv preprint arXiv:2008.08974
Acknowledgments
The work is supported by National Natural Science Foundation of China (61802082, 61762020, 61263034), Guizhou Provincial Department of Education (Qian Jiao He KY ZI [2018] 018) .
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Yue, S., Zhang, Q., Shao, D. et al. Safety helmet wearing status detection based on improved boosted random ferns. Multimed Tools Appl 81, 16783–16796 (2022). https://doi.org/10.1007/s11042-022-12014-y
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11042-022-12014-y