Method and device for identifying safety helmet in complex scene

文档序号:8367 发布日期:2021-09-17 浏览:21次 中文

1. A safety helmet identification method under a complex scene is characterized by comprising the following steps:

acquiring a safety helmet wearing state picture in a complex scene, and performing data annotation on the safety helmet wearing state picture to obtain an annotated picture;

preprocessing the marked picture by adopting a picture processing method of illumination equalization to obtain a preprocessed picture;

training a neural network model by adopting the preprocessed picture, and obtaining a safety helmet identification model by changing a network structure of the neural network model and adding an attention mechanism;

the method comprises the steps of collecting a picture to be identified in a complex scene, inputting the picture to be identified into a safety helmet identification model, and identifying the wearing state of a safety helmet of a worker in the picture to be identified by adopting a TTA method.

2. The method for identifying safety helmets under complex scenes according to claim 1, wherein the method further comprises the steps of, between "acquiring a picture of wearing states of safety helmets under complex scenes, labeling the picture of wearing states of safety helmets with data to obtain a labeled picture" and "preprocessing the labeled picture by using a picture processing method of illumination equalization to obtain a preprocessed picture":

and carrying out clustering analysis on the detection frame of the marked picture by using a k-means clustering method, and randomly erasing the picture area of the marked picture by using a random-erasing data enhancement method.

3. The method for identifying a safety helmet in a complex scene as claimed in claim 1, wherein the pre-processing is performed on the labeled picture by using a picture processing method of illumination equalization to obtain a pre-processed picture, specifically:

performing brightness equalization processing on the marked picture, reading three RGB color channels of the marked picture, and converting the color channels into YUV color space;

selecting Y-channel information of the YUV color space, counting a Y-channel value of each pixel, and calculating the probability of the occurrence of preset brightness according to the Y-channel value;

and obtaining a brightness histogram according to the occurrence probability of each brightness, and carrying out normalization processing on the brightness histogram to obtain a preprocessed picture.

4. The method for identifying a safety helmet in a complex scene according to claim 1, wherein the neural network is a Yolov5 model, the neural network model is trained by using the preprocessed pictures, and the safety helmet identification model is obtained by changing a network structure of the neural network model and adding an attention mechanism, specifically:

and adding a layer of SElayer in the network structure of the neural network model and adding a BackBone fused with an attention mechanism to obtain the safety helmet identification model.

5. The method for identifying safety helmets under complex scenes according to claim 1, further comprising:

when the wearing state of the safety helmet is identified to be that the safety helmet is not worn, generating voice information prompt;

and when the wearing state of the safety helmet is recognized as the wearing state of the safety helmet, classifying the wearing safety helmet by adopting a machine learning method to obtain the color class of the wearing safety helmet.

6. The method for identifying safety helmets under complex scenes according to claim 5, wherein the machine learning method is used for classifying the worn safety helmets to obtain the color classes of the worn safety helmets, and the method specifically comprises the following steps:

detecting the position of a safety helmet in the preprocessed picture;

manufacturing a plurality of color category templates of the safety helmet;

selecting the upper half part of the worn safety helmet according to the position of the safety helmet, converting the upper half part of the worn safety helmet into the YUV color space, and respectively calculating Euclidean distances from the upper half part of the worn safety helmet to a plurality of color category templates;

and respectively comparing the European distances with the distance threshold range, and obtaining the color category of the safety helmet according to the comparison result.

7. The method for identifying a safety helmet in a complex scene according to claim 6, wherein the comparing the euclidean distances with the distance threshold ranges respectively obtains the color class of the safety helmet according to the comparison result, specifically:

respectively comparing the Euclidean distances with a distance threshold range, and if at least one Euclidean distance is in the threshold range, selecting a color category template corresponding to the minimum Euclidean distance in the Euclidean distances as a final calculation result to obtain the color category of the safety helmet;

and if all the Euclidean distances are not within the distance threshold range, judging that the safety helmet is in other color categories.

8. A safety helmet identification device under complex scene, characterized by comprising:

the data labeling module is used for acquiring a safety helmet wearing state picture in a complex scene, and performing data labeling on the safety helmet wearing state picture to obtain a labeled picture;

the pre-processing module is used for pre-processing the marked picture by adopting a picture processing method of illumination equalization to obtain a pre-processed picture;

the model training module is used for training a neural network model by adopting the preprocessed pictures, and obtaining a safety helmet identification model by changing the network structure of the neural network model and adding an attention mechanism;

the identification module is used for acquiring a picture to be identified in a complex scene, inputting the picture to be identified into the safety helmet identification model, and identifying the wearing state of the safety helmet of a worker in the picture to be identified by adopting a TTA (time to arrival) method.

Background

The safety helmet can play the role of buffering and damping, and is an essential safety tool for safety production workers and high-altitude operation personnel in all walks of life. The wearing relation of operation safety and safety helmets under complex scenes is closely related, the existing safety helmet identification method mainly aims at comprehensively utilizing each mainstream algorithm model to improve the detection identification rate of the safety helmets, and most of relevant researches aim at the safety helmet identification under the simple scenes, and influence of various factors of actual construction site environments on the safety helmet identification is not considered, so that the wearing condition of the safety helmets under the complex scenes is difficult to identify.

Disclosure of Invention

The invention provides a safety helmet identification method and device in a complex scene, and aims to solve the problem that the existing safety helmet identification method does not consider the influence of various factors of the actual construction site environment on safety helmet identification, so that the wearing condition of a safety helmet in the complex scene is difficult to identify.

The first embodiment of the invention provides a method for identifying a safety helmet in a complex scene, which comprises the following steps:

acquiring a safety helmet wearing state picture in a complex scene, and performing data annotation on the safety helmet wearing state picture to obtain an annotated picture;

preprocessing the marked picture by adopting a picture processing method of illumination equalization to obtain a preprocessed picture;

training a neural network model by adopting the preprocessed picture, and obtaining a safety helmet identification model by changing a network structure of the neural network model and adding an attention mechanism;

the method comprises the steps of collecting a picture to be identified in a complex scene, inputting the picture to be identified into a safety helmet identification model, and identifying the wearing state of a safety helmet of a worker in the picture to be identified by adopting a TTA method.

Further, the method further includes, between "acquiring a helmet wearing state picture in a complex scene, performing data annotation on the helmet wearing state picture to obtain an annotated picture" and "preprocessing the annotated picture by using a picture processing method of illumination equalization to obtain a preprocessed picture":

and carrying out clustering analysis on the detection frame of the marked picture by using a k-means clustering method, and randomly erasing the picture area of the marked picture by using a random-erasing data enhancement method.

Further, the pre-processing is performed on the labeled picture by using a picture processing method with illumination equalization to obtain a pre-processed picture, which specifically comprises:

performing brightness equalization processing on the marked picture, reading three RGB color channels of the marked picture, and converting the color channels into YUV color space;

selecting Y-channel information of the YUV color space, counting a Y-channel value of each pixel, and calculating the probability of the occurrence of preset brightness according to the Y-channel value;

and obtaining a brightness histogram according to the occurrence probability of each brightness, and carrying out normalization processing on the brightness histogram to obtain a preprocessed picture.

Further, the neural network is a Yolov5 model, the neural network model is trained by using the preprocessed pictures, and a helmet identification model is obtained by changing a network structure of the neural network model and adding an attention mechanism, specifically:

and adding a layer of SElayer in the network structure of the neural network model and adding a BackBone fused with an attention mechanism to obtain the safety helmet identification model.

Further, the method further comprises:

when the wearing state of the safety helmet is identified to be that the safety helmet is not worn, generating voice information prompt;

and when the wearing state of the safety helmet is recognized as the wearing state of the safety helmet, classifying the wearing safety helmet by adopting a machine learning method to obtain the color class of the wearing safety helmet.

Further, the step of classifying the worn safety helmet by using a machine learning method to obtain the color class of the worn safety helmet comprises the following steps:

detecting the position of a safety helmet in the preprocessed picture;

manufacturing a plurality of color category templates of the safety helmet;

selecting the upper half part of the worn safety helmet according to the position of the safety helmet, converting the upper half part of the worn safety helmet into the YUV color space, and respectively calculating Euclidean distances from the upper half part of the worn safety helmet to a plurality of color category templates;

and respectively comparing the European distances with the distance threshold range, and obtaining the color category of the safety helmet according to the comparison result.

Further, the comparing the european distances with the distance threshold ranges respectively, and obtaining the color category of the safety helmet according to the comparison result specifically include:

respectively comparing the Euclidean distances with a distance threshold range, and if at least one Euclidean distance is in the threshold range, selecting a color category template corresponding to the minimum Euclidean distance in the Euclidean distances as a final calculation result to obtain the color category of the safety helmet;

and if all the Euclidean distances are not within the distance threshold range, judging that the safety helmet is in other color categories.

A second embodiment of the present invention provides a device for identifying a helmet in a complex scene, including:

the data labeling module is used for acquiring a safety helmet wearing state picture in a complex scene, and performing data labeling on the safety helmet wearing state picture to obtain a labeled picture;

the pre-processing module is used for pre-processing the marked picture by adopting a picture processing method of illumination equalization to obtain a pre-processed picture;

the model training module is used for training a neural network model by adopting the preprocessed pictures, and obtaining a safety helmet identification model by changing the network structure of the neural network model and adding an attention mechanism;

the identification module is used for acquiring a picture to be identified in a complex scene, inputting the picture to be identified into the safety helmet identification model, and identifying the wearing state of the safety helmet of a worker in the picture to be identified by adopting a TTA (time to arrival) method.

The embodiment of the invention fully considers the influence of factors such as strong light, weak light, shielding and the like on the state identification of the safety helmet in a complex scene, adopts a picture processing method of illumination equalization to carry out data preprocessing, can effectively reduce the influence of actual environmental factors on an identification result in the complex scene, and thus can enable the safety helmet identification to be more accurate; according to the embodiment of the invention, the attention of the model on the space is more concentrated by modifying the network structure of the Yolov neural network and fusing the attention mechanism, so that the accuracy of identification is improved; the embodiment of the invention can improve the reliability of the safety helmet identification model by adding the TTA method.

Furthermore, after the safety helmet is recognized to be worn by a worker in a complex scene, the color types of the safety helmet can be further distinguished by manufacturing different color type templates of the safety helmet and calculating the Euclidean distance between the position of the safety helmet and the color type templates, and the management efficiency of the complex scene on the wearing state of the safety helmet is improved.

Drawings

Fig. 1 is a schematic flowchart of a method for identifying a safety helmet in a complex scenario according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a neural network model structure provided by an embodiment of the present invention;

fig. 3 is another schematic flow chart of a method for identifying a safety helmet in a complex scenario according to an embodiment of the present invention;

fig. 4 is a schematic structural diagram of a safety helmet identification device in a complex scenario according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

In the description of the present application, it is to be understood that the terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless otherwise specified.

In the description of the present application, it is to be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art.

Referring to fig. 1 to 3, in a first embodiment of the present invention, a method for identifying a safety helmet in a complex scenario shown in fig. 1 is provided, including:

s1, acquiring a helmet wearing state picture in a complex scene, and performing data annotation on the helmet wearing state picture to obtain an annotated picture;

in step S1, the embodiment of the present invention collects images of the wearing state of the crash helmet in a complex scene as a crash helmet data set, where the images of the wearing state of the crash helmet include an image of a worn crash helmet and an image of an unworn crash helmet. According to the invention, data is labeled by the safety helmet wearing state picture, so that data balance is ensured.

S2, preprocessing the marked picture by adopting a picture processing method of illumination equalization to obtain a preprocessed picture;

illustratively, the complex scene comprises a construction environment, and the problems of strong light, weak light and the like exist in a use environment.

S3, training the neural network model by adopting the preprocessed pictures, and obtaining a safety helmet identification model by changing the network structure of the neural network model and adding an attention mechanism;

according to the embodiment of the invention, the network structure of the neural network model is modified and the attention mechanism is fused, so that the attention of the trained helmet identification model in space is more concentrated, and the accuracy and the efficiency of the helmet wearing state identification can be improved.

S4, acquiring a picture to be recognized in a complex scene, inputting the picture to be recognized into a safety helmet recognition model, and recognizing the wearing state of the safety helmet of a worker in the picture to be recognized by adopting a TTA method.

Specifically, when the identification picture is used for identifying the wearing state of the safety helmet, the picture is randomly turned and zoomed by adopting a TTA method in a safety helmet identification model, and a final safety helmet wearing state identification result is obtained by comprehensively analyzing a plurality of results, so that the reliability of the identification of the wearing state of the safety helmet can be effectively improved.

As a specific implementation manner of the embodiment of the present invention, between "acquiring a helmet wearing state picture in a complex scene, performing data annotation on the helmet wearing state picture to obtain an annotated picture" and "performing preprocessing on the annotated picture by using a picture processing method with illumination equalization to obtain a preprocessed picture", the method further includes:

and performing clustering analysis on the detection frame of the marked picture by using a k-means clustering method, and performing random-erasing on the picture area of the marked picture by using a random-erasing data enhancement method.

In the embodiment of the invention, the detection frame of the marked picture is subjected to clustering analysis by using a k-means clustering method to obtain the size of the detection frame suitable for the wearing state identification of the safety helmet, so that the identification accuracy is improved. In addition, the random-erasing data enhancement method is adopted to randomly erase the image area of the marked image, so that the anti-blocking capability of the model can be effectively improved.

As a specific implementation manner of the embodiment of the present invention, the pre-processing is performed on the labeled picture by using a picture processing method with illumination equalization to obtain a pre-processed picture, which specifically includes:

performing brightness equalization processing on the marked picture, reading three RGB color channels of the marked picture, and converting the color channels into YUV color space;

YUV is a color coding method that is divided into three components, where "Y" denotes brightness and "U" and "V" denote chroma, which is used to describe the color of a given pixel affecting color and saturation. The embodiment of the invention converts the marked picture into the YUV color space, is favorable for balancing the brightness information of the marked picture, and can effectively reduce the influence of various factors on the state identification of the safety helmet in a complex environment.

Selecting Y-channel information of a YUV color space, counting a Y-channel value of each pixel, and calculating according to the Y-channel value to obtain the probability of the occurrence of preset brightness;

and obtaining a brightness histogram according to the probability of each brightness, and performing normalization processing on the brightness histogram to obtain a preprocessed picture.

Specifically, in one discrete picture { x }, the number of occurrences of the luminance i is represented by ni, i.e., the probability of occurrence of a pixel with luminance i in the picture is:

where L is the number of all the brightnesses in the picture (typically 256), n is the number of all the pixels in the picture, px (i) is in fact the image histogram with the pixel value i, normalized to [0,1 ].

The cumulative distribution function corresponding to px is defined as:

optionally, creating a transform of the form y ═ t (x), and generating a cumulative probability function of y for each value in the original image can be linearized across all ranges of values, where the conversion formula is defined as:

cdfy(i)=iK

as a specific implementation manner of the embodiment of the present invention, the neural network is a Yolov5 model, the neural network model is trained by using the preprocessed pictures, and the helmet identification model is obtained by changing a network structure of the neural network model and adding an attention mechanism, specifically:

and adding a layer of SElayer in the network structure of the neural network model and adding a BackBone fused with an attention mechanism to obtain the safety helmet identification model.

Specifically, when the preprocessed picture is input, a layer of SElayer is added to the network structure of the neural network model to pay attention to the importance degree of different channel characteristics. The added SElayer sequentially carries out average pooling and linear classification, and then learns the correlation among different channels through a Relu activation function and linear classification, so that the attention for the channels can be screened out.

Referring to fig. 2, in the embodiment of the present invention, after passing through the SElayer, the preprocessed picture sequentially passes through the Focus, the CBL, the CSP _1, the CBL, the CDP _3, the CBL, the CSP1_3, the CBL, and the SPP modules, the SElayer is added to the last layer of the BackBone, the convolved feature map is processed to obtain a one-dimensional vector having the same number as that of channels as an evaluation score of each channel, and then the evaluation scores are respectively applied to corresponding channels. After the preprocessed picture passes through a BackBone fused with an attention mechanism, the feature graph is transmitted into a YOLOv5-Neck structure to obtain a safety helmet identification model.

As a specific implementation manner of the embodiment of the present invention, the method further includes:

when the wearing state of the safety helmet is identified to be that the safety helmet is not worn, generating voice information prompt;

and when the wearing state of the safety helmet is recognized as the wearing state of the safety helmet, classifying the wearing safety helmet by adopting a machine learning method to obtain the color class of the wearing safety helmet.

Illustratively, the color classifications of the headgear include red, white, yellow, and blue.

As a specific implementation manner of the embodiment of the present invention, a machine learning method is adopted to classify the worn safety helmet, and the color class of the worn safety helmet is obtained, specifically:

detecting the position of a safety helmet in the preprocessed picture;

manufacturing a plurality of color category templates of the safety helmet;

in the embodiment of the invention, four full-white, full-red, full-yellow and full-blue pictures are selected as the color category templates

Selecting the upper half part of the worn safety helmet according to the position of the safety helmet, converting the upper half part of the worn safety helmet into a YUV color space, and respectively calculating Euclidean distances from the upper half part of the worn safety helmet to a plurality of color category templates;

and comparing the European distances with the distance threshold ranges respectively, and obtaining the color category of the safety helmet according to the comparison result.

According to the embodiment of the invention, four full-white, full-red, full-yellow and full-blue pictures are selected as the color category templates, and the color category of the safety helmet is accurately identified and obtained according to the Euclidean distance between the color category templates and the upper half part of the safety helmet position.

As a specific implementation manner of the embodiment of the present invention, the european distances are compared with the distance threshold ranges, and the color category of the safety helmet is obtained according to the comparison result, specifically:

respectively comparing the Euclidean distances with a distance threshold range, and if at least one Euclidean distance is in the threshold range, selecting a color category template corresponding to the minimum Euclidean distance in the Euclidean distances as a final calculation result to obtain the color category of the safety helmet;

and if all the Euclidean distances are not within the range of the distance threshold, judging that the safety helmet is in other color categories.

Please refer to fig. 3, which is another flow chart of a method for identifying a safety helmet in a complex scenario according to an embodiment of the present invention.

The embodiment of the invention has the following beneficial effects:

the embodiment of the invention fully considers the influence of factors such as strong light, weak light, shielding and the like on the state identification of the safety helmet in a complex scene, adopts a picture processing method of illumination equalization to carry out data preprocessing, can effectively reduce the influence of actual environmental factors on an identification result in the complex scene, and thus can enable the safety helmet identification to be more accurate; according to the embodiment of the invention, the attention of the model on the space is more concentrated by modifying the network structure of the Yolov neural network and fusing the attention mechanism, so that the accuracy of identification is improved; the embodiment of the invention can improve the reliability of the safety helmet identification model by adding the TTA method.

Furthermore, after the safety helmet is recognized to be worn by a worker in a complex scene, the color types of the safety helmet can be further distinguished by manufacturing different color type templates of the safety helmet and calculating the Euclidean distance between the position of the safety helmet and the color type templates, and the management efficiency of the complex scene on the wearing state of the safety helmet is improved.

Referring to fig. 4, a second embodiment of the present invention provides a device for identifying a safety helmet in a complex scenario, including:

the data labeling module 10 is used for acquiring a helmet wearing state picture in a complex scene, and performing data labeling on the helmet wearing state picture to obtain a labeled picture;

in step S1, the embodiment of the present invention collects images of the wearing state of the crash helmet in a complex scene as a crash helmet data set, where the images of the wearing state of the crash helmet include an image of a worn crash helmet and an image of an unworn crash helmet. According to the invention, data is labeled by the safety helmet wearing state picture, so that data balance is ensured.

The preprocessing module 20 is configured to preprocess the tagged picture by using a picture processing method of illumination equalization to obtain a preprocessed picture;

illustratively, the complex scene comprises a construction environment, and the problems of strong light, weak light and the like exist in a use environment.

The model training module 30 is used for training the neural network model by adopting the preprocessed pictures, and obtaining a safety helmet identification model by changing the network structure of the neural network model and adding an attention mechanism;

according to the embodiment of the invention, the network structure of the neural network model is modified and the attention mechanism is fused, so that the attention of the trained helmet identification model in space is more concentrated, and the accuracy and the efficiency of the helmet wearing state identification can be improved.

The identification module 40 is configured to acquire a picture to be identified in a complex scene, input the picture to be identified into the helmet identification model, and identify the wearing state of the helmet of a worker in the picture to be identified by using a TTA method.

Specifically, when the identification picture is used for identifying the wearing state of the safety helmet, the picture is randomly turned and zoomed by adopting a TTA method in a safety helmet identification model, and a final safety helmet wearing state identification result is obtained by comprehensively analyzing a plurality of results, so that the reliability of the identification of the wearing state of the safety helmet can be effectively improved.

As a specific implementation manner of the embodiment of the present invention, the preprocessing module 20 is further configured to:

and performing clustering analysis on the detection frame of the marked picture by using a k-means clustering method, and performing random-erasing on the picture area of the marked picture by using a random-erasing data enhancement method.

In the embodiment of the invention, the detection frame of the marked picture is subjected to clustering analysis by using a k-means clustering method to obtain the size of the detection frame suitable for the wearing state identification of the safety helmet, so that the identification accuracy is improved. In addition, the random-erasing data enhancement method is adopted to randomly erase the image area of the marked image, so that the anti-blocking capability of the model can be effectively improved.

As a specific implementation manner of the embodiment of the present invention, the preprocessing module 20 is further configured to:

performing brightness equalization processing on the marked picture, reading three RGB color channels of the marked picture, and converting the color channels into YUV color space;

YUV is a color coding method that is divided into three components, where "Y" denotes brightness and "U" and "V" denote chroma, which is used to describe the color of a given pixel affecting color and saturation. The embodiment of the invention converts the marked picture into the YUV color space, is favorable for balancing the brightness information of the marked picture, and can effectively reduce the influence of various factors on the state identification of the safety helmet in a complex environment.

Selecting Y-channel information of a YUV color space, counting a Y-channel value of each pixel, and calculating according to the Y-channel value to obtain the probability of the occurrence of preset brightness;

and obtaining a brightness histogram according to the probability of each brightness, and performing normalization processing on the brightness histogram to obtain a preprocessed picture.

Specifically, in one discrete picture { x }, the number of occurrences of the luminance i is represented by ni, i.e., the probability of occurrence of a pixel with luminance i in the picture is:

where L is the number of all the brightnesses in the picture (typically 256), n is the number of all the pixels in the picture, px (i) is in fact the image histogram with the pixel value i, normalized to [0,1 ].

The cumulative distribution function corresponding to px is defined as:

optionally, creating a transform of the form y ═ t (x), and generating a cumulative probability function of y for each value in the original image can be linearized across all ranges of values, where the conversion formula is defined as:

cdfy(i)=iK

as a specific implementation manner of the embodiment of the present invention, the neural network is a Yolov5 model, and the model training module 30 is specifically configured to:

and adding a layer of SElayer in the network structure of the neural network model and adding a BackBone fused with an attention mechanism to obtain the safety helmet identification model.

Specifically, when the preprocessed picture is input, a layer of SElayer is added to the network structure of the neural network model to pay attention to the importance degree of different channel characteristics. The added SElayer sequentially carries out average pooling and linear classification, and then learns the correlation among different channels through a Relu activation function and linear classification, so that the attention for the channels can be screened out.

Referring to fig. 2, in the embodiment of the present invention, after passing through the SElayer, the preprocessed picture sequentially passes through the Focus, the CBL, the CSP _1, the CBL, the CDP _3, the CBL, the CSP1_3, the CBL, and the SPP modules, the SElayer is added to the last layer of the BackBone, the convolved feature map is processed to obtain a one-dimensional vector having the same number as that of channels as an evaluation score of each channel, and then the evaluation scores are respectively applied to corresponding channels. After the preprocessed picture passes through a BackBone fused with an attention mechanism, the feature graph is transmitted into a YOLOv5-Neck structure to obtain a safety helmet identification model.

As a specific implementation manner of the embodiment of the present invention, the identification module 40 is further configured to:

when the wearing state of the safety helmet is identified to be that the safety helmet is not worn, generating voice information prompt;

and when the wearing state of the safety helmet is recognized as the wearing state of the safety helmet, classifying the wearing safety helmet by adopting a machine learning method to obtain the color class of the wearing safety helmet.

Illustratively, the color classifications of the headgear include red, white, yellow, and blue.

As a specific implementation manner of the embodiment of the present invention, a machine learning method is adopted to classify the worn safety helmet, and the color class of the worn safety helmet is obtained, specifically:

detecting the position of a safety helmet in the preprocessed picture;

manufacturing a plurality of color category templates of the safety helmet;

in the embodiment of the invention, four full-white, full-red, full-yellow and full-blue pictures are selected as the color category templates

Selecting the upper half part of the worn safety helmet according to the position of the safety helmet, converting the upper half part of the worn safety helmet into a YUV color space, and respectively calculating Euclidean distances from the upper half part of the worn safety helmet to a plurality of color category templates;

and comparing the European distances with the distance threshold ranges respectively, and obtaining the color category of the safety helmet according to the comparison result.

According to the embodiment of the invention, four full-white, full-red, full-yellow and full-blue pictures are selected as the color category templates, and the color category of the safety helmet is accurately identified and obtained according to the Euclidean distance between the color category templates and the upper half part of the safety helmet position.

As a specific implementation manner of the embodiment of the present invention, the european distances are compared with the distance threshold ranges, and the color category of the safety helmet is obtained according to the comparison result, specifically:

respectively comparing the Euclidean distances with a distance threshold range, and if at least one Euclidean distance is in the threshold range, selecting a color category template corresponding to the minimum Euclidean distance in the Euclidean distances as a final calculation result to obtain the color category of the safety helmet;

and if all the Euclidean distances are not within the range of the distance threshold, judging that the safety helmet is in other color categories.

Please refer to fig. 3, which is another flow chart of a method for identifying a safety helmet in a complex scenario according to an embodiment of the present invention.

The embodiment of the invention has the following beneficial effects:

the embodiment of the invention fully considers the influence of factors such as strong light, weak light, shielding and the like on the state identification of the safety helmet in a complex scene, adopts a picture processing method of illumination equalization to carry out data preprocessing, can effectively reduce the influence of actual environmental factors on an identification result in the complex scene, and thus can enable the safety helmet identification to be more accurate; according to the embodiment of the invention, the attention of the model on the space is more concentrated by modifying the network structure of the Yolov neural network and fusing the attention mechanism, so that the accuracy of identification is improved; the embodiment of the invention can improve the reliability of the safety helmet identification model by adding the TTA method.

Furthermore, after the safety helmet is recognized to be worn by a worker in a complex scene, the color types of the safety helmet can be further distinguished by manufacturing different color type templates of the safety helmet and calculating the Euclidean distance between the position of the safety helmet and the color type templates, and the management efficiency of the complex scene on the wearing state of the safety helmet is improved.

The foregoing is a preferred embodiment of the present invention, and it should be noted that it would be apparent to those skilled in the art that various modifications and enhancements can be made without departing from the principles of the invention, and such modifications and enhancements are also considered to be within the scope of the invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种低频超宽带合成孔径雷达图像叶簇覆盖目标检测方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!