Safety helmet identification method, device, computer equipment and storage medium

By setting the preset position relationship between the reference object and the safety helmet in the safety helmet recognition system, it is determined whether there is a safety helmet in the image, which solves the problem of high error detection rate in the prior art and improves the accuracy of safety helmet recognition.

CN113592014BActive Publication Date: 2024-12-17GLODON CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202110902770.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2024-12-17
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

The existing hard helmet identification system is prone to identify non-harmet images as hard helmets in chaotic and diverse production industry sites, resulting in a high error detection rate.

Method used

By identifying the coordinate frames and labels in the image, setting the preset position relationship between the reference object and the safety helmet, determining whether the safety helmet exists in the image, and reducing false detection.

Benefits of technology

It improves the accuracy of safety helmet recognition, reduces the false detection rate, and enhances the accuracy of safety helmet recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113592014B_ABST
    Figure CN113592014B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, computer equipment and storage medium for identifying a helmet. The method for identifying a helmet comprises: acquiring an image to be identified; determining a coordinate frame and a label of the coordinate frame in the image through a recognition model, wherein the coordinate frame comprises a first coordinate frame with a label of wearing a helmet and a second coordinate frame with a label of a reference object; and when the first coordinate frame and the second coordinate frame meet a preset position relationship, determining that a helmet exists in the image at the first coordinate frame, wherein the preset position relationship is used to characterize the relative position relationship between the helmet and the reference object. Through the present invention, the false detection rate of the helmet can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method, device, computer equipment and storage medium for recognizing a helmet. Background Art

[0002] Safety helmets are an essential safety tool for workers in production safety in all walks of life and workers working at heights. The safety helmet recognition system can automatically detect whether a person is wearing a safety helmet, and promptly alarm when it detects that a person is not wearing a safety helmet. In high-risk industries such as construction sites, electricity, petrochemicals, metallurgy, and chemicals, it can effectively prevent safety accidents and realize automated and intelligent management of safety production without human intervention. It uses intelligent video analysis technology combined with the most cutting-edge deep learning technology, with high recognition rate, strong compatibility, stable performance, etc. It is the first choice for ensuring safety in production in all walks of life.

[0003] However, the inventors have found that since the image contents in various production industry sites are usually messy and diverse, other non-safety helmet image contents are identified as safety helmets, resulting in a certain amount of false detection.

[0004] Therefore, how to reduce the false detection rate of helmet recognition has become a technical problem that needs to be solved urgently in this field. Summary of the invention

[0005] The purpose of the present invention is to provide a method, device, computer equipment and storage medium for identifying a helmet, so as to solve the above-mentioned technical problems in the prior art.

[0006] On the one hand, to achieve the above-mentioned purpose, the present invention provides a method for identifying a safety helmet.

[0007] The method for identifying a safety helmet comprises: acquiring an image to be identified; determining a coordinate frame in the image and a label of the coordinate frame through a recognition model, wherein the coordinate frame comprises a first coordinate frame with a label of wearing a safety helmet and a second coordinate frame with a label of a reference object; and when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, determining that a safety helmet exists in the image at the first coordinate frame, wherein the preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

[0008] Further, the reference object is a pedestrian, and when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, determining that a safety helmet exists in the image at the first coordinate frame includes: when the center of the first coordinate frame is within the second coordinate frame, determining that a safety helmet exists in the image at the first coordinate frame.

[0009] Furthermore, the coordinate frame also includes a third coordinate frame whose label is not wearing a safety helmet, the second coordinate frame includes a fourth coordinate frame whose label is a pedestrian wearing reflective clothing and a fifth coordinate frame for pedestrians not wearing reflective clothing, and the method also includes: when the fourth coordinate frame satisfies the preset position relationship with the first coordinate frame, or with the third coordinate frame, determining that reflective clothing exists in the image at the fourth coordinate frame.

[0010] Furthermore, determining the coordinate frame and the label of the coordinate frame in the image through the recognition model includes: dividing the image into multiple pixel unit groups, wherein the pixel unit group includes n*m pixels, wherein n and m are both positive integers; extracting pixels at the same position in each of the pixel unit groups to constitute n*m ​​image slices of the image; determining the sub-coordinate frame and the label of the sub-coordinate frame in the image slice through the recognition model; and determining the coordinate frame and the label of the coordinate frame in the image according to the sub-coordinate frame and the label of the sub-coordinate frame.

[0011] Furthermore, determining the coordinate frame and the label of the coordinate frame in the image through the recognition model includes: judging whether the pixel width of the image is greater than a preset pixel width; when the pixel width of the image is greater than the preset pixel width, dividing the image into at least two sub-images, wherein adjacent sub-images partially overlap; determining the coordinate frame and the label of the coordinate frame in each of the sub-images through the recognition model; and counting the coordinate frame and the label of the coordinate frame in each of the sub-images to obtain the coordinate frame and the label of the coordinate frame in the image.

[0012] Furthermore, the recognition model is obtained by adopting the following steps: acquiring a training image; performing grayscale processing on the training image to obtain a grayscale training image; and training an initial model through the grayscale training image to obtain the recognition model.

[0013] Furthermore, the recognition model is obtained by adopting the following steps: obtaining a training image set; training an initial model through the training image set to obtain a recognition model to be tested; obtaining a test image set, wherein the test image set includes background images, and the background images do not include reference objects and safety helmets; recognizing the test image set through the recognition model to be tested; and when the recognition model to be tested recognizes the coordinate frame in the background image, adding the background image to the training image set and retraining the initial model.

[0014] On the other hand, to achieve the above object, the present invention provides a safety helmet identification device.

[0015] The safety helmet recognition device includes: an acquisition module, used to acquire an image to be recognized; a recognition module, used to determine a coordinate frame in the image and a label of the coordinate frame through a recognition model, wherein the coordinate frame includes a first coordinate frame with a label of wearing a safety helmet and a second coordinate frame with a label of a reference object; and a processing module, used to determine that a safety helmet exists in the image at the first coordinate frame when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, wherein the preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

[0016] To achieve the above objectives, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0017] To achieve the above object, the present invention also provides a computer-readable storage medium on which a computer program is stored, and the computer program implements the steps of the above method when executed by a processor.

[0018] The helmet recognition method, device, computer equipment and storage medium provided by the present invention first determine the coordinate frame and its label in the image through the trained recognition model, classify the coordinate frame based on the label, and obtain the first coordinate frame with the label of wearing a helmet. At the same time, the second coordinate frame with the label of a reference object can also be obtained. At this time, the pedestrian wearing a helmet at the first coordinate frame is not directly output as the recognition result, but whether the helmet actually exists at the first coordinate frame is checked, wherein the reference object is a reference that satisfies a specific position relationship with the helmet worn by the pedestrian. Having a reference object at a specific position is a necessary condition for the existence of the helmet. Therefore, if there is a second coordinate frame whose position relationship with the first coordinate frame satisfies a preset position relationship in the coordinate frame output by the recognition model, it can be determined that the image has a helmet at the first coordinate frame. If there is no second coordinate frame whose position relationship with the first coordinate frame satisfies the preset position relationship in the coordinate frame output by the recognition model, the first coordinate frame output by the recognition model is a false detection. Through the present invention, the recognition of the helmet is associated with the recognition of the reference object, and the recognition result of the helmet is checked based on the recognition result of the reference object, so that the false detection of the helmet can be reduced and the accuracy of the helmet recognition can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0020] Figure 1 A flowchart of a method for identifying a safety helmet provided in Embodiment 1 of the present invention;

[0021] Figure 2 A block diagram of a helmet recognition device provided in Embodiment 2 of the present invention; and

[0022] Figure 3 This is a hardware structure diagram of a computer device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0024] Embodiment 1

[0025] The embodiment of the present invention provides a method for identifying a helmet, through which the helmet identification is associated with a reference object for identifying the helmet, thereby improving the false detection rate of the helmet identification. Specifically, Figure 1 This is a flow chart of a method for identifying a safety helmet provided in Embodiment 1 of the present invention, as shown in FIG. Figure 1 As shown, the helmet recognition method provided in this embodiment includes the following steps S101 to S103.

[0026] Step S101: Acquire an image to be recognized.

[0027] Specifically, image data in an image database may be read as the image to be identified, or monitoring image data output by an upstream monitoring system may be received to obtain the image to be identified, or a client may be set to receive the image to be identified input by a user, etc. In an image to be identified, several pedestrians may be included, and the pedestrians may or may not be wearing helmets. Through this embodiment, whether the pedestrians are wearing helmets can be detected.

[0028] Step S102: Determine the coordinate frame and the label of the coordinate frame in the image by recognizing the model.

[0029] The coordinate frame includes a first coordinate frame with a label of wearing a safety helmet and a second coordinate frame with a label of a reference object.

[0030] Specifically, an initial recognition model can be constructed based on artificial intelligence algorithms in the prior art, for example, using EfficientDet series networks, SSD networks, and YOLO networks. Among them, the initial recognition model can be constructed using YOLO-V5, which can flexibly configure the width and depth of the network, and the number of convolution kernels can also be flexibly adjusted. High-precision models can be trained while ensuring performance for deployment on mobile devices.

[0031] The initial recognition model is trained by the training sample set to obtain a recognition model, which outputs the coordinate frame in the image and the label corresponding to the coordinate frame. Among them, the coordinate frame with the label of wearing a helmet is the first coordinate frame, which indicates that there is a helmet at the first coordinate frame; the coordinate frame with the label of a reference object is the second coordinate frame, which indicates that there is a reference object at the second coordinate frame, and the existence of the reference object has a spatial correlation with the existence of the helmet, so that in the following step S103, the accuracy of the first coordinate frame can be tested, that is, only when it is detected that there is a spatial correlation between the helmet and the human body at the first coordinate frame, can it be determined that the detection of the first coordinate frame is accurate. Optionally, the reference object is a human body, or the reference object is a specific tool existing in a certain engineering scene, such as an engineering vehicle, a tool, etc., which is not limited in this application.

[0032] Step S103: when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, it is determined that a safety helmet exists in the image at the first coordinate frame.

[0033] The preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

[0034] Through the above step S102, the image to be recognized is input into the recognition model, and the recognition model outputs several coordinate frames and the label of each coordinate frame. For the first coordinate frame, the positional relationship between the first coordinate frame and the second coordinate frame is judged to determine whether this positional relationship satisfies the preset positional relationship. When the first coordinate frame and the second coordinate frame satisfy the preset positional relationship, that is, there is a reference object in the image that has a spatial correlation with the helmet at the first coordinate frame. At this time, it can be determined that the image does detect a pedestrian wearing a helmet at the first coordinate frame, and this recognition result is output; optionally, the coordinate frame also includes a third coordinate frame labeled as not wearing a helmet. When the recognition model outputs the third coordinate frame, it is determined that the pedestrian in the image at the third coordinate frame is not wearing a helmet, and this result can also be output.

[0035] In the method for identifying a safety helmet provided in this embodiment, the coordinate frame and its label in the image are first determined by a trained recognition model, and the coordinate frames are classified based on the labels to obtain a first coordinate frame with a label of wearing a safety helmet. At the same time, a second coordinate frame with a label of a reference object can also be obtained. At this time, the pedestrian wearing a safety helmet in the first coordinate frame is not directly output as the recognition result, but a check is performed to determine whether a safety helmet actually exists in the first coordinate frame, wherein the set reference object is a reference that satisfies a specific positional relationship with the safety helmet worn by the pedestrian, and having a reference object at a specific position is a necessary condition for the existence of a safety helmet. Therefore, if in the coordinate frame output by the recognition model, there is a second coordinate frame whose positional relationship with the first coordinate frame satisfies a preset positional relationship, then it can be determined that there is a safety helmet in the image at the first coordinate frame. If in the coordinate frame output by the recognition model, there is no second coordinate frame whose positional relationship with the first coordinate frame satisfies the preset positional relationship, then the first coordinate frame output by the recognition model is a false detection. By adopting the safety helmet recognition method provided in this embodiment, the recognition of the safety helmet is associated with the recognition of the reference object, and the recognition result of the safety helmet is verified based on the recognition result of the reference object, which greatly eliminates background false detection of the safety helmet, can reduce false detection of the safety helmet, and improve the accuracy of safety helmet recognition.

[0036] Optionally, in one embodiment, the reference object is a pedestrian, and when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, determining that a safety helmet exists in the image at the first coordinate frame includes: when the center of the first coordinate frame is within the second coordinate frame, determining that a safety helmet exists in the image at the first coordinate frame.

[0037] Specifically, in this embodiment, the reference object is set to a pedestrian, the second coordinate frame output by the recognition model is a coordinate frame surrounding the pedestrian, and the first coordinate frame is a coordinate frame surrounding the human head. If a safety helmet worn by a pedestrian does exist in the image at the first coordinate frame, then the first coordinate frame has an overlapping portion with a second coordinate frame in the image. In order to accurately and quickly determine whether there is a second coordinate frame mentioned above in the image, the preset position relationship is set so that the center of the first coordinate frame is within the second coordinate frame. Therefore, when determining whether there is a second coordinate frame in the image that satisfies the preset position relationship with the first coordinate frame, the center of the first coordinate frame can be calculated, and the second coordinate frame output by the recognition model can be traversed. If there is a second coordinate frame surrounding the center, that is, the center of the first coordinate frame is within a second coordinate frame, it can be determined that the image does detect a pedestrian wearing a safety helmet at the first coordinate frame.

[0038] The safety helmet recognition method provided in this embodiment is used, and the reference object is set as a pedestrian. The recognition result of the safety helmet is checked by judging whether the center of the first coordinate frame is within the second coordinate frame to ensure the accuracy of the check. At the same time, the check process is simple, and the timeliness of the check process is guaranteed. Rapid reasoning can be achieved, so that the safety helmet recognition method can be deployed on cloud servers and mobile devices.

[0039] Optionally, in one embodiment, the coordinate frame also includes a third coordinate frame labeled as not wearing a safety helmet, the second coordinate frame includes a fourth coordinate frame labeled as pedestrians wearing reflective clothing and a fifth coordinate frame labeled as pedestrians not wearing reflective clothing, and the safety helmet recognition method also includes: when the fourth coordinate frame satisfies a preset position relationship with the first coordinate frame, or with the third coordinate frame, determining that there is reflective clothing in the image at the fourth coordinate frame.

[0040] Specifically, the coordinate frame for detecting the helmet output by the recognition model includes, in addition to the first coordinate frame labeled as wearing a helmet, a third coordinate frame labeled as not wearing a helmet. Therefore, when the recognition model outputs the first coordinate frame, the first coordinate frame is checked using the recognition result of the reference object to determine whether there is a helmet at the first coordinate frame; when the recognition model outputs the third coordinate frame, it can be directly determined that there is no helmet at the third coordinate frame. In addition, there are two types of second coordinate frames output by the recognition model, one is the fourth coordinate frame labeled as a pedestrian wearing reflective clothing, and the other is the fifth coordinate frame for pedestrians not wearing reflective clothing, so that while identifying the helmet, it is possible to identify whether the pedestrian is wearing reflective clothing.

[0041] It should be noted here that the "first", "second", etc. in the "first coordinate frame", "second coordinate frame" to "fifth coordinate frame" in this application are only used to distinguish the name definitions and do not constitute a limitation on the order.

[0042] Furthermore, based on the positional relationship between the safety helmet and the pedestrian, in addition to using the recognition result of the pedestrian to verify the recognition result of the safety helmet, the recognition result of the safety helmet can also be used to verify the recognition result of the reflective clothing, thereby reducing the false detection rate of the reflective clothing and improving the accuracy of the reflective clothing recognition. Specifically, when the recognition model outputs the fourth coordinate frame, if the fourth coordinate frame and the first coordinate frame, or the third coordinate frame meet the preset positional relationship, it can be determined that the reflective clothing does exist in the image at the fourth coordinate frame. Furthermore, if the fourth coordinate frame contains the center of the first coordinate frame or the center of the third coordinate frame, it is determined that the reflective clothing does exist in the image at the fourth coordinate frame.

[0043] By adopting the safety helmet recognition method provided in this embodiment, on the basis of setting the reference object as a pedestrian, it is detected whether the pedestrian is wearing reflective clothing, so that the wearing of the reflective clothing can be detected while detecting the safety helmet. Further, the recognition result of the safety helmet is used to verify the recognition result of the reflective clothing, thereby reducing the false detection rate of the reflective clothing and improving the accuracy of the recognition of the reflective clothing.

[0044] Optionally, in one embodiment, determining the coordinate frame and the label of the coordinate frame in the image through the recognition model includes: dividing the image into multiple pixel unit groups, wherein the pixel unit group includes n*m pixels, wherein n and m are both positive integers; extracting pixels at the same position in each pixel unit group to constitute n*m ​​image slices of the image; determining the sub-coordinate frame and the label of the sub-coordinate frame in the image slice through the recognition model; and determining the coordinate frame and the label of the coordinate frame in the image according to the sub-coordinate frame and the label of the sub-coordinate frame.

[0045] Specifically, before the image is processed by the recognition model, the image can be filtered and preprocessed, for example, filtering out images with substandard resolution, repeated images, or problematic images caused by equipment failure, etc., to avoid wasting recognition resources. The preprocessing of the image includes cropping the image, adjusting the size of the image to ensure the uniform size of the image, etc. For example, for some images obtained from a fixed position, some edge positions in the image are positions where a helmet cannot appear, so these edge positions can be cropped to reduce the amount of data processing. The size of images taken by different devices is adjusted and processed as images of the same size to reduce the complexity of the subsequent recognition model. For example, camera surveillance videos are collected for a specific construction site, video frames are intercepted at predetermined intervals, and data cleaning is performed, including discarding blurry and poorly shot images.

[0046] In this example, preprocessing also includes pixel-level slicing of the image. Specifically, n*m pixels are first set as a pixel unit group to divide the image into multiple pixel unit groups. Then, for each pixel unit group, pixels at the same position are extracted to form an image slice, so as to divide the image into n*m image slices, and the number of pixels included in each image slice is the same as the number of pixel unit groups in the image. For each image slice, the recognition model is used to identify the sub-coordinate frame and the label of the sub-coordinate frame in the image slice. The label of the sub-coordinate frame is consistent with the label of the coordinate frame, and also includes wearing a safety helmet and a reference object, etc. Finally, the sub-coordinate frames corresponding to each image slice are pixel-fused according to their coordinate positions to obtain several coordinate frames of the image, and the label of the image is determined with reference to the label of the sub-coordinate frame. For example, a coordinate frame can be obtained by pixel fusion of x sub-coordinate frames, where x is less than or equal to the number of image slices. The label of this coordinate frame is determined by the labels of the x sub-coordinate frames. If there are greater than or equal to x / 2 sub-coordinate frames whose labels are all a certain label, then this label is the label of the coordinate frame determined by the x sub-coordinate frames.

[0047] By adopting the helmet recognition method provided in this embodiment, the image is sliced ​​at the pixel level, the data set is expanded through a convolution-like operation, each image slice is processed and recognized separately, and finally the recognition results of each image slice are fused to determine the image recognition result, which can improve the accuracy of image recognition.

[0048] Optionally, in one embodiment, determining the coordinate frame and the label of the coordinate frame in the image through the recognition model includes: judging whether the pixel width of the image is greater than a preset pixel width; when the pixel width of the image is greater than the preset pixel width, dividing the image into at least two sub-images, wherein adjacent sub-images partially overlap; determining the coordinate frame and the label of the coordinate frame in each sub-image through the recognition model; and counting the coordinate frame and the label of the coordinate frame in each sub-image to obtain the coordinate frame and the label of the coordinate frame in the image.

[0049] Specifically, as the resolution of the camera increases, the resolution of the image to be identified increases accordingly. When the resolution of the image to be identified is too large and the input vector size of the recognition model is too small, if the original image is reduced, pixel information will inevitably be lost, so that a small helmet in the distance will be missed. In this embodiment, the image is judged by pixel points. When the pixel width of the image is less than the preset pixel width, the image is directly processed without segmenting the image into sub-images. When the pixel width of the image is greater than or equal to the preset pixel width, the image is first segmented into sub-images and divided into at least two sub-images. For example, when the pixel width of the image is less than 1920, the image is processed normally; when the pixel width of the image is greater than or equal to 1920, an overlapping segmentation operation is performed. The coordinate frame and the label of the coordinate frame in the sub-image are identified by the recognition model, and finally the coordinate frame in the sub-image is counted to obtain the coordinate frame in the image and its corresponding label. In order to avoid the loss of the target at the segmentation point, a non-uniform segmentation method is adopted when segmenting the sub-images. The adjacent sub-images are partially overlapped. When counting the coordinate frames, the coordinate frames obtained from the overlapping parts are deduplicated.

[0050] The helmet recognition method provided in this embodiment is used to segment an image with a pixel width that is too wide into several sub-images, so that the information lost in the image after the size change of the model is reduced, and more information of small distant targets is retained. The detection results of the sub-images are then statistically analyzed, so that the recall rate of small targets in the recognition results is improved and the missed detection rate is reduced.

[0051] Optionally, in one embodiment, the recognition model is obtained by adopting the following steps: acquiring a training image; grayscale processing the training image to obtain a grayscale training image; and training an initial model with the grayscale training image to obtain a recognition model.

[0052] Specifically, when the initial model is trained to obtain the recognition model, training images are needed to train the initial model. For example, more than 24,000 images of the construction site are collected through the cameras at the construction site, including images of people wearing safety helmets and images of people not wearing safety helmets, with labels evenly distributed, as training images.

[0053] In this embodiment, the training image is gray-scaled, and the initial model is trained by the gray-scale training image. For example, for an image with a pixel width that is too large, it is first segmented to obtain multiple sub-images, and then the sub-images are gray-scaled, or the image is first gray-scaled, and then segmented to obtain multiple sub-images, and the initial model is trained by the gray-scaled sub-images; for another example, the image is first segmented at the pixel level to obtain image slices, and then the image slices are gray-scaled, or the image is first gray-scaled, and then segmented at the pixel level to obtain gray-scaled image slices, and the initial model is trained by the gray-scaled image slices.

[0054] When using the helmet recognition method provided in this embodiment, in addition to directly using the training model for training during the training stage of the recognition model, the training image can also be processed into a grayscale image before training. This not only expands the training data set, but also makes the recognition model more robust to helmets of different colors, thereby improving the accuracy of recognition.

[0055] Optionally, in one embodiment, the recognition model is obtained by the following steps: obtaining a training image set; training an initial model through the training image set to obtain a recognition model to be tested; obtaining a test image set, wherein the test image set includes background images, and the background images do not include reference objects and safety helmets; recognizing the test image set through the recognition model to be tested; and when the recognition model to be tested recognizes a coordinate box in the background image, adding the background image to the training image set and retraining the initial model.

[0056] Specifically, after the initial model is trained using the training image set, a recognition model to be tested can be obtained, and the recognition model to be tested is tested using the test image set. If the recognition model to be tested recognizes a coordinate frame in a background image that does not include reference objects and safety helmets, it indicates that the recognition model to be tested mistakenly detects background objects as safety helmets and / or reference objects. At this time, this type of background images is added to the training set as negative samples in the training set, and the initial model is retrained.

[0057] By using the helmet recognition method provided in this example, background images are added to the training image set to prevent background misdetections, thus fundamentally suppressing background misdetections and improving the accuracy of helmet recognition.

[0058] In summary, the helmet recognition method provided by the present invention can automatically recognize helmets, reduce manual labor, and can be deployed on the cloud and mobile terminals, which is convenient and easy to use; by combining reference objects, the false detection rate can be reduced; by slicing images and sub-images, the missed detection rate can be reduced; the grayscale processing of images in the training stage increases the robustness of the recognition of helmets of different colors, especially in the case of small targets in distant scenes. Each of the real-time methods of the present invention can accurately recognize helmets in construction site scenarios with a lightweight algorithm model, and can quickly and timely warn based on the recognition results to achieve the purpose of real-time detection.

[0059] Embodiment 2

[0060] Corresponding to the above-mentioned embodiment 1, embodiment 2 of the present invention provides a safety helmet identification device. The corresponding technical feature details and corresponding technical effects can be referred to the above-mentioned embodiment 1, and will not be repeated in this embodiment. Figure 2 A block diagram of a helmet recognition device provided in Embodiment 2 of the present invention, such as Figure 2 As shown, the device includes: an acquisition module 201, an identification module 202 and a processing module 203.

[0061] The acquisition module 201 is used to acquire an image to be identified; the identification module 202 is used to determine the coordinate frame in the image and the label of the coordinate frame through a recognition model, wherein the coordinate frame includes a first coordinate frame with a label of wearing a safety helmet and a second coordinate frame with a label of a reference object; and the processing module 203 is used to determine that there is a safety helmet in the image at the first coordinate frame when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, wherein the preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

[0062] Optionally, in one embodiment, the reference object is a pedestrian, and when the processing module 203 determines that a safety helmet exists in the image at the first coordinate frame, the specific steps performed include: when the center of the first coordinate frame is within the second coordinate frame, determining that a safety helmet exists in the image at the first coordinate frame.

[0063] Optionally, in one embodiment, the coordinate frame also includes a third coordinate frame with the label of not wearing a safety helmet, the second coordinate frame includes a fourth coordinate frame with the label of a pedestrian wearing reflective clothing and a fifth coordinate frame of a pedestrian not wearing reflective clothing, and the processing module 203 is also used to: when the fourth coordinate frame satisfies the preset position relationship with the first coordinate frame, or with the third coordinate frame, determine that there is reflective clothing in the image at the fourth coordinate frame.

[0064] Optionally, in one embodiment, the recognition module 202 includes: a division unit, used to divide the image into multiple pixel unit groups, wherein the pixel unit group includes n*m pixels, wherein n and m are both positive integers; an extraction unit, used to extract pixels at the same position in each of the pixel unit groups to constitute n*m ​​image slices of the image; a first determination unit, used to determine the sub-coordinate frame and the label of the sub-coordinate frame in the image slice through the recognition model; and a second determination unit, used to determine the coordinate frame and the label of the coordinate frame in the image based on the sub-coordinate frame and the label of the sub-coordinate frame.

[0065] Optionally, in one embodiment, the recognition module 202 includes: a judgment unit, used to judge whether the pixel width of the image is greater than a preset pixel width; a segmentation unit, used to segment the image into at least two sub-images when the pixel width of the image is greater than the preset pixel width, wherein adjacent sub-images partially overlap; a third determination unit, used to determine the coordinate frame and the label of the coordinate frame in each of the sub-images through the recognition model; and a statistical unit, used to count the coordinate frame and the label of the coordinate frame in each of the sub-images to obtain the coordinate frame and the label of the coordinate frame in the image.

[0066] Optionally, in one embodiment, the device further includes a training module for obtaining the recognition model by adopting the following steps: acquiring a training image; performing grayscale processing on the training image to obtain a grayscale training image; and training an initial model through the grayscale training image to obtain the recognition model.

[0067] Optionally, in one embodiment, the device also includes a training module, which is used to obtain the recognition model by adopting the following steps: obtaining a training image set; training an initial model through the training image set to obtain a recognition model to be tested; obtaining a test image set, wherein the test image set includes background images, and the background images do not include reference objects and safety helmets; identifying the test image set through the recognition model to be tested; and when the recognition model to be tested recognizes the coordinate box in the background image, adding the background image to the training image set and retraining the initial model.

[0068] Embodiment 3

[0069] This third embodiment also provides a computer device, such as a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that can execute programs. Figure 3 As shown, the computer device 01 of this embodiment includes at least but is not limited to: a memory 011 and a processor 012 which can be interconnected through a system bus. Figure 3 It should be pointed out that Figure 3 Only a computer device 01 having components memory 011 and processor 012 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0070] In this embodiment, the memory 011 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 011 can be an internal storage unit of the computer device 01, such as a hard disk or memory of the computer device 01. In other embodiments, the memory 011 can also be an external storage device of the computer device 01, such as a plug-in hard disk equipped on the computer device 01, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 011 can also include both the internal storage unit of the computer device 01 and its external storage device. In this embodiment, the memory 011 is generally used to store the operating system and various application software installed on the computer device 01, such as the program code of the helmet recognition device in the second embodiment. In addition, the memory 011 can also be used to temporarily store various types of data that have been output or are to be output.

[0071] In some embodiments, the processor 012 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 012 is generally used to control the overall operation of the computer device 01. In this embodiment, the processor 012 is used to run the program code stored in the memory 011 or process data, such as a method for identifying a helmet.

[0072] Embodiment 4

[0073] The fourth embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program realizes the corresponding function when executed by the processor. The computer-readable storage medium of this embodiment is used to store a helmet recognition device, and when executed by the processor, the helmet recognition method of the first embodiment is realized.

[0074] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0075] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0076] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0077] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for identifying a safety helmet, characterized in that: include: Obtain an image to be recognized; Determining, by recognizing the model, a coordinate frame in the image and a label of the coordinate frame, wherein the coordinate frame includes a first coordinate frame with a label of wearing a safety helmet and a second coordinate frame with a label of a reference object, and the reference object includes a predetermined tool existing in the engineering scene; and When the first coordinate frame and the second coordinate frame satisfy a preset position relationship, it is determined that a safety helmet exists in the image at the first coordinate frame, wherein the preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

2. The method for identifying a safety helmet according to claim 1, characterized in that: Determining the coordinate frame in the image and the label of the coordinate frame by using the recognition model includes: Dividing the image into a plurality of pixel unit groups, wherein the pixel unit group includes n*m pixels, wherein n and m are both positive integers; Extracting pixels at the same position in each of the pixel unit groups to form n*m image slices of the image; Determining, by means of the recognition model, a sub-coordinate frame in the image slice and a label of the sub-coordinate frame; and A coordinate frame in the image and a label of the coordinate frame are determined according to the sub-coordinate frame and the label of the sub-coordinate frame.

3. The method for identifying a safety helmet according to claim 1, characterized in that: Determining the coordinate frame in the image and the label of the coordinate frame by using the recognition model includes: Determining whether the pixel width of the image is greater than a preset pixel width; When the pixel width of the image is greater than the preset pixel width, the image is divided into at least two sub-images, wherein adjacent sub-images partially overlap; Determining the coordinate frame and the label of the coordinate frame in each of the sub-images by using the recognition model; and The coordinate frames and labels of the coordinate frames in each of the sub-images are counted to obtain the coordinate frames and labels of the coordinate frames in the image.

4. The method for identifying a safety helmet according to claim 1, characterized in that: The recognition model is obtained by following the steps below: Get training images; Performing grayscale processing on the training image to obtain a grayscale training image; and The recognition model is obtained by training an initial model using the grayscale training image.

5. The method for identifying a safety helmet according to claim 1, characterized in that: The recognition model is obtained by following the steps below: Get a training image set; Train the initial model using the training image set to obtain a recognition model to be tested; Acquire a test image set, wherein the test image set includes background images, and the background images do not include reference objects and safety helmets; Identify the test image set by using the recognition model to be tested; and When the recognition model to be tested recognizes the coordinate frame in the background image, the background image is added to the training image set, and the initial model is retrained.

6. A helmet identification device, characterized in that: include: An acquisition module, used for acquiring an image to be recognized; a recognition module, configured to determine a coordinate frame in the image and a label of the coordinate frame by using a recognition model, wherein the coordinate frame includes a first coordinate frame labeled as wearing a safety helmet and a second coordinate frame labeled as a reference object, and the reference object includes a predetermined tool existing in an engineering scene; and A processing module is used to determine that a safety helmet exists in the image at the first coordinate frame when the first coordinate frame and the second coordinate frame satisfy a preset position relationship, wherein the preset position relationship is used to characterize the relative position relationship between the safety helmet and the reference object.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method and device for detecting wearing condition of safety helmet

    CN108921159A

  • Safety helmet positioning and color recognition method and system based on deep learning

    CN110188724A

  • Method for detecting and describing wearing condition of safety helmet in construction scene

    CN110399905A

  • Safety helmet recognition method and device, electronic equipment and storage medium

    CN111401278A

  • Method and device for detecting whether pedestrian wears safety helmet or not

    CN111914636A