Disclosure of Invention
The invention provides a method and a system for identifying the wearing of a safety helmet, which are used for solving the problems that the wearing of the safety helmet in a monitoring video in the prior art needs manual identification, is time-consuming and labor-consuming, and causes easy judgment errors.
The specific technical scheme is as follows:
A method of headgear wear identification, the method comprising:
Performing 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 characteristic points according to the confidence value and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened characteristic points;
and determining whether to wear the safety helmet according to the color in the target detection frame.
Optionally, filtering all feature points according to the confidence value and non-maximum suppression includes:
ignoring feature points with confidence values smaller than a threshold value;
Sorting the rest characteristic points according to non-maximum suppression, and obtaining a detection frame with highest score;
Reducing the confidence value of the detection frame with the overlapping area larger than the appointed proportion;
And taking the detection frame with the ranking result larger than the threshold value 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 the safety helmet according to the color in the target detection frame, the method further includes:
when the personnel wearing the safety helmet is detected, marking the detection frame as green, and displaying and outputting;
when the personnel are detected not to wear the safety helmet, the detection frame is marked with red, and the output is displayed.
A headgear wear identification system, the system comprising:
The dividing module is used for dividing the acquired image into scales to obtain sub-images corresponding to N scales, wherein N is a positive integer greater than or equal to 2;
A determining module, configured to determine 3 feature points in each pixel point on each scale of the sub-image, where each feature point includes at least a confidence value and a non-maximum suppression;
the processing module is used for filtering all the characteristic points according to the confidence value and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened characteristic points; and determining whether to wear the safety helmet according to the color in the target detection frame.
Optionally, the processing module is specifically configured to ignore feature points with a confidence value smaller than a threshold value; sorting the rest characteristic points according to non-maximum suppression, and obtaining a detection frame with highest score; reducing the confidence value of the detection frame with the overlapping area larger than the appointed proportion; and taking the detection frame with the ranking result larger than the threshold value as a final target detection frame.
Optionally, the determining module is specifically configured to include a center point coordinate of the detection frame, a width and a height of the detection frame, a confidence level of the detection frame, and a probability of each category of the detection frame for each feature point in the feature points.
Optionally, the processing module is further configured to mark the detection frame as green and display output when detecting that the person wears the safety helmet; when the personnel are detected not to wear the safety helmet, the detection frame is marked with red, and the output is displayed.
The method provided by the embodiment of the invention can be used for carrying out scale division on the image and carrying out feature point detection on the basis of the scale division to determine the final detection frame, so that the wearing identification of the safety helmet can be realized by fully utilizing the existing building site video stream without installing other monitoring equipment, the cost is saved, the algorithm can ensure the stability, the robustness and the high precision of the result, the accuracy is improved, and the identification efficiency is also improved.
Detailed Description
The following detailed description of the technical solutions of the present invention will be given by way of the accompanying drawings and the specific embodiments, and it should be understood that the specific technical features of the embodiments and the embodiments of the present invention are merely illustrative of the technical solutions of the present invention, and not limiting, and that the embodiments and the specific technical features of the embodiments of the present invention may be combined with each other without conflict.
Fig. 1 is a flowchart of a method for identifying wearing of a 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;
in the first place, the method provided by the invention is applied to a system, and the system comprises four parts: the camera collects field video, the server processes and stores the video, the client side identifies the result and displays the result, and the alarm device. And transmitting the video stream acquired by the camera to a server.
Firstly, a server respectively obtains sub-images (feature maps) of three scales through a basic convolutional neural network, wherein the specific scales can be as follows: 13 x 21, 26 x 21, 52 x 21. Of course, only three dimensions are exemplified in the embodiment of the present invention, and may be adjusted according to actual situations in a specific application scenario.
S2, determining 3 characteristic 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: the helmet is worn and not worn, so 3 feature points, that is, 3 proposal, can be further determined on each scale, where the number of proposal corresponding to the three scales is 13×13×3+26×26×3+52×52×3=1067 pieces proposal. Each proposal contains 7 pieces of information: center_x, center_ y, w, h, confidence, probability of 2classes, i.e., center point coordinates of box, width, height, target confidence, probability of each category.
S3, filtering all the characteristic points according to the confidence value and the non-maximum value inhibition, and obtaining a final target detection frame according to the screened characteristic points;
after all proposal was obtained, all proposals obtained was filtered. The filtering is divided into two aspects, confidence filtering and soft-nms (non-maximum suppression) filtering. Confidence filtering is that proposal with confidence below the threshold will be ignored. Softnms is to sort the detection frames according to the scores, then keep the frame with the highest score, simultaneously reduce the confidence of other frames with the overlapping area larger than a certain proportion, then assign a threshold value, and finally keep the detection frame with the score larger than the threshold value. Soft-nms may reduce the instances of missed detection relative to nms. Finally, the target detection frame is obtained.
S4, determining whether to wear the safety helmet according to the color in the target detection frame.
When the personnel wearing the safety helmet is detected, marking the detection frame as green, and displaying and outputting; when the personnel are detected not to wear the safety helmet, the detection frame is marked with red, and the output is displayed. As shown in fig. 2, the detection frame is displayed green for the person wearing the helmet in fig. 2, and is displayed red for the worker not wearing the helmet.
The method provided by the embodiment of the invention can be used for carrying out scale division on the image and carrying out feature point detection on the basis of the scale division to determine the final detection frame, so that the wearing identification of the safety helmet can be realized by fully utilizing the existing building site video stream without installing other monitoring equipment, the cost is saved, the algorithm can ensure the stability, the robustness and the high precision of the result, the accuracy is improved, and the identification efficiency is also improved.
Corresponding to the method provided by the invention, the embodiment of the invention also provides a system for identifying wearing of the safety helmet, as shown in fig. 3, which is a schematic structural diagram of the system for identifying wearing of the safety helmet in the embodiment of the invention, and the system comprises:
the dividing module 301 is configured to scale-divide the acquired image to obtain N sub-images corresponding to the 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 includes at least a confidence value and a non-maximum suppression;
The processing module 303 is configured to filter all the feature points according to the confidence value and the non-maximum suppression, and obtain a final target detection frame according to the screened feature points; and determining whether to wear the safety helmet according to the color in the target detection frame.
Further, in the embodiment of the present invention, the processing module 303 is specifically configured to ignore feature points with confidence values smaller than a threshold value; sorting the rest characteristic points according to non-maximum suppression, and obtaining a detection frame with highest score; reducing the confidence value of the detection frame with the overlapping area larger than the appointed proportion; and taking the detection frame with the ranking result larger than the threshold value as a final target detection frame.
Further, in the embodiment of the present invention, the determining module 302 is specifically configured to use each of the feature points to include a center point coordinate of the detection frame, a width and a height of the detection frame, a confidence level 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 output when detecting that the person wears the helmet; when the personnel are detected not to wear the safety helmet, the detection frame is marked with red, and the output is displayed.
While 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 embodiments and all such alterations and modifications as fall within the scope of the application, including those modified to include the use of specific symbols, labels, and so forth to determine vertices.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.