Disclosure of Invention
The invention provides a safety helmet wearing identification method and system, which are used for solving the problems that in the prior art, the wearing of a safety helmet in a monitoring video needs manual identification, time and labor are wasted, and judgment errors are easy to occur.
The specific technical scheme is as follows:
a headgear wear identification method, the method comprising:
carrying out scale division on the acquired image to obtain sub-images corresponding to N scales, wherein N is a positive integer greater than or equal to 2;
determining 3 feature points in each pixel point on each scale of the sub-image, wherein each feature point at least comprises a confidence value and non-maximum suppression;
filtering all the feature points according to the confidence values and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened feature points;
and determining whether to wear a safety helmet according to the color in the target detection frame.
Optionally, filtering all feature points according to the confidence value and the non-maximum suppression includes:
ignoring feature points with confidence values smaller than a threshold value;
sorting the rest feature points according to non-maximum value inhibition, and obtaining a detection frame with the highest score;
reducing the confidence value of the detection frame with the overlapping area of the detection frame larger than a specified proportion;
and taking the detection frame which is larger than the threshold value in the finally obtained sequencing result as a final target detection frame.
Optionally, each of the feature points includes a center point coordinate of the detection frame, a width and a height of the detection frame, a confidence of the detection frame, and a probability of each category of the detection frame.
Optionally, after determining whether to wear a safety helmet according to the color in the target detection frame, the method further includes:
when detecting that a person wears the safety helmet, marking the detection frame as green, and displaying and outputting the green;
when the person is detected not wearing the safety helmet, the detection frame is marked as red and is displayed and output.
A headgear wear identification system, the system comprising:
the dividing module is used for carrying out scale division on the acquired image to obtain sub-images corresponding to N scales, wherein N is a positive integer greater than or equal to 2;
the determining module is used for determining 3 feature points in each pixel point on each scale of the sub-image, wherein each feature point at least comprises a confidence value and non-maximum suppression;
the processing module is used for filtering all the feature points according to the confidence value and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened feature points; and determining whether to wear a safety helmet according to the color in the target detection frame.
Optionally, the processing module is specifically configured to ignore feature points whose confidence values are smaller than a threshold; sorting the rest feature points according to non-maximum value inhibition, and obtaining a detection frame with the highest score; reducing the confidence value of the detection frame with the overlapping area of the detection frame larger than a specified proportion; and taking the detection frame which is larger than the threshold value in the finally obtained sequencing result as a final target detection frame.
Optionally, the determining module is specifically configured to determine, for each of the feature points, coordinates of a center point of the detection frame, a width and a height of the detection frame, a confidence of the detection frame, and a probability of each category of the detection frame.
Optionally, the processing module is further configured to mark the detection frame as green and display and output the green when detecting that the person wears the safety helmet; when the person is detected not wearing the safety helmet, the detection frame is marked as red and is displayed and output.
By the aid of the method, images can be subjected to scale division, and the final detection frame is determined by detecting the characteristic points on the basis of the scale division, so that wearing identification of the safety helmet can be achieved by means of the method by fully utilizing video streams of the existing construction site, other monitoring equipment is not needed to be installed, cost is saved, stability, robustness and high precision of results can be guaranteed by the algorithm, accuracy is improved, and identification efficiency is improved.
Detailed Description
The technical solutions of the present invention are described in detail with reference to the drawings and the specific embodiments, and it should be understood that the embodiments and the specific technical features in the embodiments of the present invention are merely illustrative of the technical solutions of the present invention, and are not restrictive, and the embodiments and the specific technical features in the embodiments of the present invention may be combined with each other without conflict.
Fig. 1 is a flowchart illustrating a method for identifying wearing of a safety helmet according to an embodiment of the present invention, where the method includes:
s1, carrying out scale division on the acquired image to obtain sub-images corresponding to N scales;
first, the method provided by the invention is applied to a system, and the system comprises four parts: the camera carries out on-site video acquisition, the server carries out video processing and storage, and the client side displays the identification result and the alarm device. And transmitting the video stream collected by the camera to the server.
The server firstly obtains sub-images (feature) of three scales through a basic convolutional neural network, and the specific scale can be as follows: 13 × 21, 26 × 21, 52 × 21. Of course, only three dimensions are illustrated in the embodiment of the present invention, and may be adjusted according to actual situations in specific application scenarios.
S2, determining 3 feature points in each pixel point on each scale of the sub-image;
in the embodiment of the present invention, since the targets are classified into two categories, namely: wearing and not wearing the safety helmet, 3 characteristic points, namely 3 proposal can be further determined on each scale, wherein the number of the corresponding proposal in the three scales is 13 × 3+26 × 3+52 × 52 — 1067 proposal. Each propofol contains 7 messages: center _ x, center _ y, w, h, confidence, probability of 2classes, i.e., coordinates of the center point of the box, width, height, confidence of the target, probability of each class.
S3, filtering all the feature points according to the confidence values and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened feature points;
after all the propofol was obtained, all the propofol obtained was filtered. The filtering is divided into two aspects, confidence filtering and soft-nms (non-maxima suppression) filtering. Confidence filtering is that the proposal with a confidence below a threshold will be ignored. Softnms is to sort the detection boxes according to scores, then retain the box with the highest score, reduce the confidence of other boxes with the overlapping area larger than a certain proportion with the box, then assign a threshold, and finally retain the detection box with the score larger than the threshold. Relative to nms, soft-nms can reduce the condition of missed detection. And finally obtaining the target detection frame.
And S4, determining whether to wear a safety helmet according to the color in the target detection frame.
When detecting that a person wears the safety helmet, marking the detection frame as green, and displaying and outputting the green; when the person is detected not wearing the safety helmet, the detection frame is marked as red and is displayed and output. Specifically, as shown in fig. 2, the detection frame of the person wearing the safety helmet in fig. 2 is displayed in green, and if the person does not wear the safety helmet, the detection frame is displayed in red.
By the aid of the method, images can be subjected to scale division, and the final detection frame is determined by detecting the characteristic points on the basis of the scale division, so that wearing identification of the safety helmet can be achieved by means of the method by fully utilizing video streams of the existing construction site, other monitoring equipment is not needed to be installed, cost is saved, stability, robustness and high precision of results can be guaranteed by the algorithm, accuracy is improved, and identification efficiency is improved.
Corresponding to the method provided by the present invention, an embodiment of the present invention further provides a helmet wearing identification system, and as shown in fig. 3, the present invention provides a schematic structural diagram of a helmet wearing identification system in an embodiment of the present invention, where the system includes:
the dividing module 301 is configured to perform scale division on the acquired image to obtain sub-images corresponding to N scales, where N is a positive integer greater than or equal to 2;
a determining module 302, configured to determine 3 feature points in each pixel point on each scale of the sub-image, where each feature point at least includes a confidence value and a non-maximum suppression;
the processing module 303 is configured to filter all the feature points according to the confidence values and the non-maximum value inhibition, and obtain a final target detection frame according to the screened feature points; and determining whether to wear a safety helmet according to the color in the target detection frame.
Further, in this embodiment of the present invention, the processing module 303 is specifically configured to ignore feature points whose confidence values are smaller than a threshold; sorting the rest feature points according to non-maximum value inhibition, and obtaining a detection frame with the highest score; reducing the confidence value of the detection frame with the overlapping area of the detection frame larger than a specified proportion; and taking the detection frame which is larger than the threshold value in the finally obtained sequencing result as a final target detection frame.
Further, in this embodiment of the present invention, the determining module 302 is specifically configured to determine that each of the feature points includes a center point coordinate of the detection frame, a width and a height of the detection frame, a confidence of the detection frame, and a probability of each category of the detection frame.
Further, in the embodiment of the present invention, the processing module 303 is further configured to mark the detection frame as green and display and output the green when detecting that the person wears the safety helmet; when the person is detected not wearing the safety helmet, the detection frame is marked as red and is displayed and output.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the application, including the use of specific symbols, labels, or other designations to identify the vertices.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.