A mask wearing recognition detection method, device, storage medium and system

By performing defogging restoration and recognition detection on images under hazy weather conditions, and combining the CBAM attention model and deep convolutional neural network, the accuracy and efficiency problems of mask wearing recognition under hazy weather conditions were solved, and efficient mask wearing recognition was achieved.

CN115311711BActive Publication Date: 2026-04-24中原动力智能机器人有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
中原动力智能机器人有限公司
Filing Date
2022-08-05
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In smoggy weather, existing technologies struggle to accurately identify whether a person is wearing a mask, resulting in poor image visibility, color distortion, recognition difficulties, slow speed, and low accuracy.

Method used

By creating mixed image data, a filter module is used for dehazing and restoration. The CBAM attention model and deep convolutional neural network are combined for recognition and detection, including parameter prediction and model training. Finally, pruning, compression and inference acceleration are performed to improve recognition accuracy and efficiency.

Benefits of technology

The accuracy of mask-wearing recognition was improved in smoggy weather, and the utilization rate of computing resources was improved by making the model lightweight.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115311711B_ABST
    Figure CN115311711B_ABST
Patent Text Reader

Abstract

The application discloses a mask wearing identification detection method, device, storage medium and system. The method comprises the following steps: preparing mixed image data according to the initial image, filtering and defogging the mixed image data to obtain a to-be-identified image, and identifying the to-be-identified image according to a mask wearing identification detection model based on a CBAM attention model and a deep convolutional neural network. The method, device, storage medium and system improve the accuracy of mask wearing identification in foggy weather. Furthermore, the method, device, storage medium and system also realize the lightweight of model deployment by pruning and compressing a trained first mask wearing identification detection model and accelerating reasoning, thereby improving the utilization rate of computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mask wearing recognition and detection technology, and in particular to a mask wearing recognition and detection method, device, storage medium and system. Background Technology

[0002] Images captured in smoggy conditions are of very blurry quality, resulting in poor target detection. Accurately identifying whether people are wearing masks in smoggy conditions is a crucial task for intelligent robots, necessitating a high-precision, high-speed mask-wearing detection algorithm based on image processing.

[0003] In existing technologies, the process of mask recognition in hazy weather is typically broken down into two sub-tasks: haze removal and face mask detection. Haze removal involves decomposing the image acquired by the robot into a clean image and its corresponding haze interference information, which can recover more potential information about the original blurred objects and misidentified objects. This method studies the scattering effect of atmospheric suspended particles on light, establishes an atmospheric scattering model, understands the physical mechanism of image degradation, and inversely restores the image before degradation. This is a type of image restoration method specifically for hazy images, producing realistic images that closely resemble the original scene with degraded foreground objects. Face mask detection refers to using deep convolutional neural networks to detect pedestrian faces in clean images and then determining whether the people in the image are wearing masks. With the development of deep learning technology, these tasks can be better implemented using deep neural networks such as ResNet, MobileNet, and BiLSTM, along with their accompanying learning algorithms.

[0004] However, existing technologies still have the following drawbacks: in adverse weather conditions, such as fog and low light, the acquired images suffer from poor visibility, color distortion, and quality degradation, causing numerous problems for subsequent face mask recognition. Furthermore, the small size of the target further complicates recognition; the slow detection speed and low recognition accuracy also make it difficult to balance image enhancement and face mask recognition tasks.

[0005] Therefore, there is a current need for a mask wearing recognition and detection method, device, computer-readable storage medium, and system to overcome the aforementioned deficiencies in the existing technology. Summary of the Invention

[0006] This invention provides a method, apparatus, computer-readable storage medium, and system for identifying and detecting mask wearing, thereby improving the accuracy of mask wearing identification and detection.

[0007] An embodiment of the present invention provides a mask wearing recognition and detection method, the recognition and detection method comprising: acquiring an initial image; generating mixed image data based on the initial image; and inputting the mixed image data into a preset filter module to obtain an image to be recognized; the filter module is configured with parameters estimated and set by a preset parameter predictor; and performing recognition and detection on the image to be recognized using a preset mask wearing recognition and detection model to obtain the mask wearing status in the image to be recognized; the mask wearing recognition and detection model includes a preset deep convolutional neural network and a preset CBAM attention model.

[0008] As an improvement to the above scheme, a mixed image data is generated based on the initial image, and the mixed image data is input into a preset filter module to obtain the image to be recognized. Specifically, this includes: generating mixed image data based on the initial image, and performing dark channel prior and definition on the mixed image data to obtain a grayscale image accordingly; performing minimum value filtering on the grayscale image to obtain a filtered image; calculating the refractive index based on the filtered image and spatial perspective phenomena, and establishing an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; and restoring the mixed image data based on the atmospheric scattering model to obtain the image to be recognized.

[0009] As an improvement to the above scheme, the filter module is parameter estimated and set by a preset parameter predictor, specifically including: resizing the mixed image data according to a preset size to obtain an adjusted image; inputting the adjusted image into the preset parameter predictor to estimate the hyperparameter set of the filter module; the parameter predictor is formed according to a preset ResNet network; and setting the parameters of the filter module according to the hyperparameter set.

[0010] As an improvement to the above scheme, the recognition and detection method further includes: acquiring mixed image data and a preset model to be trained, initializing the network backbone, and setting the network learning rate; the model to be trained includes a preset first CBAM attention model and a preset first deep convolutional neural network; adjusting the mixed image data according to a preset size to obtain a first training image, and inputting the first training image into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module; adjusting the parameters of the filter module according to the hyperparameters, and inputting the mixed image data into the filter module to obtain an enhanced image group; the enhanced image group includes multiple enhanced images; and extracting and fusing features from the enhanced images according to the feature pyramid network and the preset first CBAM attention model to obtain the features to be detected. Based on a preset detection head and the features to be detected, a detection result and a corresponding first loss value are obtained, and the first loss value is backpropagated to update the first CBAM attention model. Based on the detection result and a preset extraction and enhancement method, the enhanced image is processed to obtain an enhanced image and a corresponding secondary enhancement feature. The enhanced image is then recognized using a preset recognition head and the secondary enhancement feature to obtain a recognition result and a corresponding second loss value. The second loss value is backpropagated, and it is determined whether the model to be trained has converged. If it has not converged, the first deep convolutional neural network is updated based on the second loss value, and the above steps are repeated. If it has converged, the model to be trained is stored as a first mask wearing recognition detection model, and the first mask wearing recognition model is output as a mask wearing recognition model.

[0011] As an improvement to the above scheme, the identification and detection method further includes: pruning and compressing the first mask wearing identification and detection model to obtain a first lightweight model; and accelerating the inference of the first lightweight model using TensorRT to obtain a mask wearing identification and detection model.

[0012] As an improvement to the above scheme, based on the detection results and the preset extraction and enhancement method, the enhanced image is processed to obtain an enhanced image and corresponding secondary enhancement features. Specifically, this includes: performing image correction processing on the enhanced image to obtain an enhanced image; passing the enhanced image to a preset ResNet34 network to extract corrected image features, and inputting the corrected image features into a preset BiLSTM network for feature enhancement to obtain secondary enhancement features.

[0013] As an improvement to the above scheme, the preset dehazing image processing formula is: Where x represents the position of the pixel. Indicates the wavelength of light. This represents the atmospheric light value at infinity. This represents the foggy images obtained by the detection system. This indicates the haze-free image to be restored. The proportion of light that can be attenuated by particles to reach the level of the detection system.

[0014] Another embodiment of the present invention provides a mask wearing recognition and detection device, which includes a filtering processing unit and a wearing recognition unit. The filtering processing unit is used to acquire an initial image, generate mixed image data based on the initial image, and input the mixed image data into a preset filter module to obtain an image to be recognized. The filter module is used to estimate and set parameters by a preset parameter predictor. The wearing recognition unit is used to recognize and detect the image to be recognized through a preset mask wearing recognition and detection model to obtain the mask wearing status in the image to be recognized. The mask wearing recognition and detection model includes a preset deep convolutional neural network and a preset CBAM attention model.

[0015] As an improvement to the above scheme, the filtering processing unit is further configured to: generate mixed image data based on the initial image, and perform dark channel prior and definition on the mixed image data to obtain a grayscale image accordingly; perform minimum value filtering on the grayscale image to obtain a filtered image; calculate the refractive index based on the filtered image and spatial perspective phenomena, and establish an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; and restore the mixed image data based on the atmospheric scattering model to obtain the image to be identified.

[0016] As an improvement to the above scheme, the filtering processing unit is further configured to: resize the mixed image data according to a preset size to obtain an adjusted image; input the adjusted image into a preset parameter predictor to estimate the hyperparameter set of the filter module; the parameter predictor is formed according to a preset ResNet network; and set the parameters of the filter module according to the hyperparameter set.

[0017] As an improvement to the above scheme, the recognition and detection device further includes a model training unit, which is used for: acquiring mixed image data and a preset model to be trained, initializing the network backbone, and setting the network learning rate; the model to be trained includes a preset first CBAM attention model and a preset first deep convolutional neural network; adjusting the mixed image data according to a preset size to obtain a first training image, and inputting the first training image into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module; adjusting the parameters of the filter module according to the hyperparameters, and inputting the mixed image data into the filter module to obtain an enhanced image group; the enhanced image group includes multiple enhanced images; and performing feature extraction and fusion on the enhanced images according to the feature pyramid network and the preset first CBAM attention model. The system combines the detection features to be detected, obtains the detection result and the corresponding first loss value based on the preset detection head and the detection features, and backpropagates the first loss value to update the first CBAM attention model; based on the detection result and the preset extraction and enhancement method, the enhanced image is processed to obtain the enhanced image and the corresponding secondary enhancement features, and the enhanced image is recognized through the preset recognition head and the secondary enhancement features to obtain the recognition result and the corresponding second loss value, backpropagates the second loss value and determines whether the model to be trained has converged; if it has not converged, the first deep convolutional neural network is updated according to the second loss value and the above steps are repeated; if it has converged, the model to be trained is stored as a first mask wearing recognition detection model and the first mask wearing recognition model is output as a mask wearing recognition model.

[0018] As an improvement to the above scheme, the model training unit is further used to: prune and compress the first mask wearing recognition and detection model to obtain a first lightweight model; and accelerate the inference of the first lightweight model using TensorRT to obtain a mask wearing recognition and detection model.

[0019] As an improvement to the above scheme, the model training unit is further configured to: perform image correction processing on the enhanced image to obtain an enhanced image; pass the enhanced image to a preset ResNet34 network to extract the corrected image features, and input the corrected image features into a preset BiLSTM network for feature enhancement to obtain secondary enhanced features.

[0020] Another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the identification and detection method as described above.

[0021] Another embodiment of the present invention provides an identification and detection system, the identification and detection system including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the identification and detection method as described above.

[0022] Compared with existing technologies, this technical solution has the following beneficial effects:

[0023] This invention provides a mask wearing recognition and detection method, device, computer-readable storage medium, and system. The method involves creating mixed image data based on an initial image, filtering and defogging the mixed image data to obtain an image to be recognized, and then recognizing the image based on a mask wearing recognition and detection model using a CBAM attention model and a deep convolutional neural network. This recognition and detection method, device, computer-readable storage medium, and system improve the accuracy of mask wearing recognition in hazy weather.

[0024] Furthermore, the mask wearing recognition and detection method, device, computer-readable storage medium, and system provided by the present invention also achieve lightweight model deployment and improve the utilization rate of computing resources by pruning, compressing, and accelerating inference of the trained first mask wearing recognition and detection model. Attached Figure Description

[0025] Figure 1 This is a schematic flowchart of a mask wearing recognition and detection method provided in an embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the structure of a mask wearing recognition and detection device provided in an embodiment of the present invention. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Specific Implementation Example 1

[0029] The present invention first describes a method for detecting and identifying mask wearing. Figure 1 This is a schematic flowchart of a mask wearing recognition and detection method provided in an embodiment of the present invention.

[0030] like Figure 1 As shown, the mask wearing recognition and detection method includes:

[0031] S1: Obtain an initial image, generate mixed image data based on the initial image, and input the mixed image data into a preset filter module to obtain the image to be recognized.

[0032] After generating the mixed data, the dark channel prior and definition are performed. The significance of the dark channel definition is to find the minimum value of the RGB components of each pixel and store it in a grayscale image of the same size as the original image. The grayscale image is then subjected to minimum value filtering. Then, the refractive index is calculated based on the spatial perspective phenomenon, and atmospheric light is estimated.

[0033] This method studies the scattering effect of atmospheric suspended particles on light, establishes an atmospheric scattering model, understands the physical mechanism of image degradation, and reconstructs the image before degradation. This is a method specifically designed for image restoration in foggy weather, producing realistic images that closely resemble the original scene of degraded foreground objects. It performs well in processing complex scenes and preserves image information relatively completely. The filter module uses a preset parameter predictor for parameter estimation and setting. The collected light sources mainly come from two parts: light reflected from the target that reaches the detection system after particle attenuation and atmospheric light formed by particle scattering. During propagation, the intensity of the reflected light gradually decreases with increasing transmission distance. Assuming the beam has a unit cross-sectional area, the intensity change of dx from position x for each transmission distance is:

[0034] ;

[0035] in Indicates the light intensity after attenuation. This is the scattering coefficient, describing the ability of a medium to scatter light of different wavelengths. When the input light is parallel and attenuated, the light intensity is... By integrating the above differential equation from x=0 to x=d, we can obtain the intensity of the parallel beam after attenuation at x=d.

[0036] ;

[0037] When the input light is a point source and the intensity of the unattenuated beam is By integrating the differential equation from x=0 to x=d, we can obtain the light intensity of the point source after attenuation at x=d.

[0038] ;

[0039] In image processing, most dehazing of foggy images obtained through detection systems is based on the theoretical model of the following formula:

[0040] ;

[0041] Where x represents the position of the pixel. Indicates the wavelength of light. This represents the atmospheric light value at infinity. This represents the foggy images obtained by the detection system. This indicates the haze-free image to be restored. This is the transfer function, representing the influence of particles on the actual target image. Physically, it represents the proportion of light that reaches the detection system after particle attenuation. For ease of calculation, let the atmospheric transmittance be 1 / 3. The target reflected light is Atmospheric light is The final atmospheric scattering model formula is: Where I(x) represents the image to be dehazed, J(x) represents the haze-free image, A represents the global atmospheric light composition, t represents the refractive index (atmospheric transfer coefficient), and t0 = 0 or 1.

[0042] In one embodiment, the initial image is used to generate mixed image data, and the mixed image data is input into a preset filter module to obtain an image to be recognized. Specifically, this includes: generating mixed image data based on the initial image, and performing a dark channel prior and definition on the mixed image data to obtain a grayscale image accordingly; performing minimum filtering on the grayscale image to obtain a filtered image; calculating the refractive index based on the filtered image and spatial perspective phenomena; and establishing an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; and restoring the mixed image data based on the atmospheric scattering model to obtain the image to be recognized.

[0043] In one embodiment, the preset dehazing image processing formula is:

[0044] ;

[0045] Where x represents the position of the pixel. Indicates the wavelength of light. This represents the atmospheric light value at infinity. This represents the foggy images obtained by the detection system. This indicates the haze-free image to be restored. The proportion of light that can be attenuated by particles to reach the level of the detection system.

[0046] The hyperparameters of tunable filters (described herein as "filter modules") are typically manually tuned by experienced engineers through visual inspection. This tuning process is cumbersome and expensive. Using an RN-PP network as a parameter predictor for the filter to estimate hyperparameters is highly efficient. Therefore, in one embodiment, the filter module is parameter-estimated and set by a preset parameter predictor, specifically including: resizing the mixed image data according to a preset size to obtain an adjusted image; inputting the adjusted image into the preset parameter predictor to estimate a set of hyperparameters for the filter module; the parameter predictor being formed based on a preset ResNet network; and setting the parameters of the filter module according to the set of hyperparameters.

[0047] S2: Using a preset mask wearing recognition and detection model, the image to be recognized is identified and detected to obtain the mask wearing status in the image to be recognized.

[0048] To further improve recognition efficiency and rationally allocate neural network computing resources, this invention proposes an end-to-end hybrid data training scheme. The RN-PP module, without manually labeling real images, is weakly supervised by the face mask recognition and detection loss, enabling it to learn appropriate hyperparameters and enhance target detection in the image through weak supervision. Specifically, a mask-wearing recognition and detection model based on deep neural networks and visual attention is adopted. The complete mask detection approach uses a deep convolutional neural network (CNN) as a classifier. Based on the CNN, a CBAM attention mechanism is embedded before each detection head to achieve mask detection inference for the robot. The mask-wearing recognition and detection model includes a pre-defined deep convolutional neural network and a pre-defined CBAM attention model.

[0049] In one embodiment, the recognition and detection method further includes: acquiring mixed image data and a preset model to be trained, initializing a network backbone, and setting a network learning rate; the model to be trained includes a preset first CBAM attention model and a preset first deep convolutional neural network; adjusting the mixed image data according to a preset size to obtain a first training image, and inputting the first training image into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module; adjusting the parameters of the filter module according to the hyperparameters, and inputting the mixed image data into the filter module to obtain an enhanced image group; the enhanced image group includes multiple enhanced images; performing feature extraction and fusion on the enhanced images according to the feature pyramid network and the preset first CBAM attention model to obtain features to be detected; obtaining detection results and corresponding first loss values ​​according to a preset detection head and the features to be detected, and backpropagating the first loss value to update the first CBAM attention model; performing image processing on the enhanced images according to the detection results and a preset extraction and enhancement method to obtain enhanced processed images and corresponding secondary enhanced features, and passing them through a preset recognition head. The head) and the secondary enhancement features are used to identify the enhanced image to obtain the recognition result and the corresponding second loss value. The second loss value is passed in reverse and it is determined whether the model to be trained has converged. If it has not converged, the first deep convolutional neural network is updated according to the second loss value and the above steps are repeated. If it has converged, the model to be trained is stored as a first mask wearing recognition detection model and the first mask wearing recognition model is output as a mask wearing recognition model.

[0050] In one embodiment, the detection result and the preset extraction and enhancement method perform image processing on the enhanced image to obtain an enhanced image and corresponding secondary enhancement features, specifically including: performing image correction processing on the enhanced image to obtain an enhanced image; passing the enhanced image to a preset ResNet34 network to extract corrected image features, and inputting the corrected image features into a preset BiLSTM network for feature enhancement to obtain secondary enhancement features.

[0051] In one embodiment, the identification and detection method further includes: pruning and compressing the first mask wearing identification and detection model to obtain a first lightweight model; and accelerating the inference of the first lightweight model using TensorRT to obtain a mask wearing identification and detection model.

[0052] This invention describes a mask-wearing recognition and detection method. It involves creating mixed image data from an initial image, filtering and dehazing the mixed image data to obtain an image to be recognized, and then using a mask-wearing recognition and detection model based on a CBAM attention model and a deep convolutional neural network to recognize the image. This method improves the accuracy of mask-wearing recognition in hazy weather. Furthermore, this invention also prunes and compresses the trained first mask-wearing recognition and detection model and accelerates inference, thereby achieving lightweight model deployment and improving the utilization of computing resources. Specific Implementation Example 2

[0054] In addition to the methods described above, this invention also discloses a mask wearing recognition and detection device. Figure 2 This is a schematic diagram of the structure of a mask wearing recognition and detection device provided in an embodiment of the present invention.

[0055] like Figure 2 As shown, the identification and detection device includes a filtering processing unit 11 and a wearing identification unit 12.

[0056] The filtering unit 11 is used to acquire an initial image, generate mixed image data based on the initial image, and input the mixed image data into a preset filter module to obtain an image to be identified. The filter module uses a preset parameter predictor for parameter estimation and setting.

[0057] In one embodiment, the filtering processing unit 11 is further configured to: generate mixed image data based on the initial image, and perform dark channel prior and definition on the mixed image data to obtain a grayscale image accordingly; perform minimum value filtering on the grayscale image to obtain a filtered image; calculate the refractive index based on the filtered image and spatial perspective phenomena, and establish an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; and restore the mixed image data based on the atmospheric scattering model to obtain an image to be identified.

[0058] In one embodiment, the filtering unit 11 is further configured to: resize the mixed image data according to a preset size to obtain an adjusted image; input the adjusted image into a preset parameter predictor to estimate the hyperparameter set of the filter module; the parameter predictor is formed according to a preset ResNet network; and set the parameters of the filter module according to the hyperparameter set.

[0059] The mask-wearing recognition unit 12 is used to identify and detect the mask in the image to be recognized using a preset mask-wearing recognition and detection model, thereby obtaining the mask-wearing status in the image. The mask-wearing recognition and detection model includes a preset deep convolutional neural network and a preset CBAM attention model.

[0060] In one embodiment, the recognition and detection device further includes a model training unit, which is configured to: acquire mixed image data and a preset model to be trained, initialize a network backbone, and set a network learning rate; the model to be trained includes a preset first CBAM attention model and a preset first deep convolutional neural network; adjust the mixed image data according to a preset size to obtain a first training image, and input the first training image into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module; adjust the parameters of the filter module according to the hyperparameters, and input the mixed image data into the filter module to obtain an enhanced image group; the enhanced image group includes multiple enhanced images; and perform feature extraction and fusion on the enhanced images according to the feature pyramid network and the preset first CBAM attention model to obtain a model to be trained. The system acquires the features to be detected, obtains the detection result and the corresponding first loss value based on the preset detection head and the features to be detected, and backpropagates the first loss value to update the first CBAM attention model; based on the detection result and the preset extraction and enhancement method, it performs image processing on the enhanced image to obtain the enhanced image and the corresponding secondary enhancement features, and performs recognition on the enhanced image through the preset recognition head and the secondary enhancement features to obtain the recognition result and the corresponding second loss value, backpropagates the second loss value and determines whether the model to be trained has converged; if it has not converged, it updates the first deep convolutional neural network based on the second loss value and repeats the above steps; if it has converged, it stores the model to be trained as a first mask wearing recognition detection model and outputs the first mask wearing recognition model as a mask wearing recognition model.

[0061] In one embodiment, in order to provide an optimal model and reduce hardware deployment costs, the model training unit is further configured to: prune and compress the first mask-wearing recognition and detection model to obtain a first lightweight model; and accelerate the inference of the first lightweight model using TensorRT to obtain a mask-wearing recognition and detection model.

[0062] In one embodiment, the model training unit is further configured to: perform image correction processing on the enhanced image to obtain an enhanced image; pass the enhanced image to a preset ResNet34 network to extract the corrected image features, and input the corrected image features into a preset BiLSTM network for feature enhancement to obtain secondary enhanced features.

[0063] If the integrated unit of the identification and detection device is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. Another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the identification and detection method as described above.

[0064] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0065] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between units indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0066] This invention describes a mask-wearing recognition and detection device and a computer-readable storage medium. The device generates mixed image data based on an initial image, filters and defogging the mixed image data to obtain an image to be recognized, and then identifies the image based on a mask-wearing recognition and detection model using a CBAM attention model and a deep convolutional neural network. This device and computer-readable storage medium improve the accuracy of mask-wearing recognition in hazy weather. Furthermore, this invention also prunes, compresses, and accelerates inference on a trained first mask-wearing recognition and detection model, thereby achieving lightweight model deployment and improving the utilization of computing resources. Specific Implementation Example 3

[0068] In addition to the methods and apparatus described above, embodiments of the present invention also describe a mask wearing recognition and detection system.

[0069] The identification and detection system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the identification and detection method as described above.

[0070] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the device, connecting various parts of the device via various interfaces and lines.

[0071] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0072] This invention describes a mask-wearing recognition and detection system. It generates mixed image data based on an initial image, performs filtering and dehazing restoration on the mixed image data to obtain an image to be recognized, and then identifies the image based on a mask-wearing recognition and detection model using a CBAM attention model and a deep convolutional neural network. This system improves the accuracy of mask-wearing recognition in hazy weather. Furthermore, this invention also prunes and compresses the trained first mask-wearing recognition and detection model and accelerates inference, thereby achieving lightweight model deployment and improving the utilization of computing resources.

[0073] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for detecting and identifying mask wearing, characterized in that, The identification and detection method includes: The process involves acquiring an initial image, creating mixed image data based on the initial image, and inputting the mixed image data into a preset filter module to obtain an image to be recognized. This includes: creating mixed image data based on the initial image; performing a dark channel prior and definition on the mixed image data to obtain a grayscale image; performing minimum filtering on the grayscale image to obtain a filtered image; calculating the refractive index based on the filtered image and spatial perspective phenomena; establishing an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; restoring the mixed image data based on the atmospheric scattering model to obtain the image to be recognized; and the filter module is parameter-estimated and set by a preset parameter predictor. The mask-wearing recognition and detection model is used to identify and detect the mask-wearing status in the image to be identified. The mask-wearing recognition and detection model includes a preset deep convolutional neural network and a preset CBAM attention model. It also includes: acquiring mixed image data and a preset training model, initializing the network backbone, and setting the network learning rate. The training model includes a preset first CBAM attention model and a preset first deep convolutional neural network. The mixed image data is adjusted according to a preset size to obtain a first training image, which is then input into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module. The filter module is then adjusted according to the hyperparameters, and the mixed image data is input into the filter module to obtain an enhanced image group. The enhanced image group includes multiple enhanced images. Based on the feature pyramid network and a preset... The first CBAM attention model extracts and fuses features from the enhanced image to obtain detectable features. Based on a preset detection head and the detectable features, it obtains a detection result and a corresponding first loss value, and backpropagates the first loss value to update the first CBAM attention model. Based on the detection result and a preset extraction and enhancement method, it performs image processing on the enhanced image to obtain an enhanced image and corresponding secondary enhancement features. Through a preset recognition head and the secondary enhancement features, it recognizes the enhanced image to obtain a recognition result and a corresponding second loss value. It backpropagates the second loss value and determines whether the model to be trained has converged. If it has not converged, it updates the first deep convolutional neural network based on the second loss value and repeats the above steps. If it has converged, it stores the model to be trained as a first mask wearing recognition detection model and outputs the first mask wearing recognition model as a mask wearing recognition model.

2. The mask wearing recognition and detection method according to claim 1, characterized in that, The filter module uses a preset parameter predictor for parameter estimation and setting, specifically including: The size of the mixed image data is adjusted according to a preset size to obtain an adjusted image; The adjusted image is input into a preset parameter predictor to estimate the hyperparameter set of the filter module; the parameter predictor is formed based on a preset ResNet network; The filter module is configured with parameters according to the hyperparameter set.

3. The mask wearing identification and detection method according to claim 2, characterized in that, The identification and detection method further includes: The first mask wearing recognition and detection model is pruned and compressed to obtain a first lightweight model; The first lightweight model is accelerated for inference using TensorRT to obtain a mask-wearing recognition and detection model.

4. The mask wearing recognition and detection method according to claim 3, characterized in that, Based on the detection results and a preset extraction and enhancement method, the enhanced image is processed to obtain an enhanced image and corresponding secondary enhancement features, specifically including: The enhanced image is then subjected to image correction processing to obtain an enhanced image; The enhanced image is passed to a preset ResNet34 network to extract the corrected image features, and the corrected image features are input into a preset BiLSTM network for feature enhancement to obtain secondary enhanced features.

5. The mask wearing recognition and detection method according to claim 4, characterized in that, The preset dehazing image processing formula is: I(x)=D+A=J(x)t(x)+A ∞ (1-t(x)); Where x represents the position of the pixel, λ represents the wavelength of light, and L ∞ Let I(x,λ) represent the atmospheric light value at infinity, I(x,λ) represent the foggy image obtained by the detection system, and R(x,λ) represent the fog-free image to be recovered. -β(λ)d(x) The proportion of light that can be attenuated by particles to reach the level of the detection system.

6. A mask-wearing recognition and detection device, characterized in that, The identification and detection device includes a filtering processing unit and a wearing identification unit, wherein... The filtering unit is used to acquire an initial image, generate mixed image data based on the initial image, and input the mixed image data into a preset filter module to obtain an image to be recognized. This includes: generating mixed image data based on the initial image, performing dark channel prior and definition on the mixed image data to obtain a grayscale image; performing minimum filtering on the grayscale image to obtain a filtered image; calculating the refractive index based on the filtered image and spatial perspective phenomena; establishing an atmospheric scattering model based on the refractive index and a preset dehazing image processing formula; restoring the mixed image data based on the atmospheric scattering model to obtain the image to be recognized; the filter module uses a preset parameter predictor for parameter estimation and setting. The mask-wearing recognition unit is used to identify and detect the mask-wearing status in the image to be identified using a preset mask-wearing recognition and detection model. The mask-wearing recognition and detection model includes a preset deep convolutional neural network and a preset CBAM attention model, and further includes: acquiring mixed image data and a preset model to be trained, initializing the network backbone, and setting the network learning rate; the model to be trained includes a preset first CBAM attention model and a preset first deep convolutional neural network; adjusting the mixed image data according to a preset size to obtain a first training image, and inputting the first training image into the preset first deep convolutional neural network to obtain the hyperparameters of the filter module; adjusting the parameters of the filter module according to the hyperparameters, and inputting the mixed image data into the filter module to obtain an enhanced image group; the enhanced image group includes multiple enhanced images; based on the feature pyramid network... The system uses a preset first CBAM attention model to extract and fuse features from the enhanced image to obtain detectable features. Based on a preset detection head and the detectable features, it obtains detection results and corresponding first loss values, and backpropagates the first loss values ​​to update the first CBAM attention model. Based on the detection results and a preset extraction enhancement method, it performs image processing on the enhanced image to obtain an enhanced image and corresponding secondary enhancement features. Using a preset recognition head and the secondary enhancement features, it recognizes the enhanced image to obtain recognition results and corresponding second loss values. It backpropagates the second loss values ​​and determines whether the model to be trained has converged. If it has not converged, it updates the first deep convolutional neural network based on the second loss value and repeats the above steps. If it has converged, it stores the model to be trained as a first mask wearing recognition detection model and outputs the first mask wearing recognition model as a mask wearing recognition model.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the mask wearing recognition and detection method as described in any one of claims 1 to 5.

8. A mask-wearing recognition and detection system, characterized in that, The identification and detection system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the mask wearing identification and detection method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Mask wearing behavior detection method and device

    CN111507199A

  • Outdoor construction site-oriented dangerous source intelligent identification system and method

    CN112200043A