CN111523490A - Mask wearing detection method, device, equipment and readable storage medium - Google Patents

Mask wearing detection method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN111523490A
CN111523490A CN202010338359.5A CN202010338359A CN111523490A CN 111523490 A CN111523490 A CN 111523490A CN 202010338359 A CN202010338359 A CN 202010338359A CN 111523490 A CN111523490 A CN 111523490A
Authority
CN
China
Prior art keywords
mask
image
layer
target
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010338359.5A
Other languages
Chinese (zh)
Inventor
章放
杨海军
徐倩
杨强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202010338359.5A priority Critical patent/CN111523490A/en
Publication of CN111523490A publication Critical patent/CN111523490A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Evolutionary Computation (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Biology (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a mask wearing detection method, including: when a mask wearing detection request is received, acquiring a face picture to be detected associated with the mask wearing detection request; preprocessing the face picture to obtain a face gray image; skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image; and inputting the target characteristic diagram into a full-connection layer in a preset mask detection model to obtain a mask wearing detection result. The application also discloses a mask wearing detection device, equipment and a readable storage medium. This application improves the detection efficiency that the gauze mask detected, does not need professional check out test set to practice thrift the cost.

Description

Mask wearing detection method, device, equipment and readable storage medium
Technical Field
The present application relates to the field of machine learning technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for detecting wearing of a mask.
Background
With the change of environment, the types of infectious diseases are more and more, viruses spread by breathing are not fresh, and people are required to wear masks in special periods or special regions to reduce the spread of respiratory infectious viruses.
At present, the mode of detecting whether people wear gauze mask mainly has two kinds, mode one: usually, a physical instrument is used for face scanning and recognition, and the method two is as follows: carrying out mask wearing detection through an algorithm based on Fourier transform and linear Gaussian; however, the mask detection by the first method needs to depend on a physical instrument, the price of the physical instrument is generally higher and difficult to popularize, and the mask detection by the second method has more complex calculation process, lower detection efficiency and is difficult to apply to occasions with larger pedestrian volume.
Disclosure of Invention
The application mainly aims to provide a mask wearing detection method, device and equipment and a computer storage medium, and aims to solve the technical problems that in the prior art, a mask wearing detection mode is high in cost and low in detection efficiency.
In order to achieve the above object, an embodiment of the present application provides a mask wearing detection method, where the mask wearing detection method includes:
when a mask wearing detection request is received, acquiring a face picture to be detected associated with the mask wearing detection request;
preprocessing the face picture to obtain a face gray image;
skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and inputting the target characteristic diagram into a full-connection layer in a preset mask detection model to obtain a mask wearing detection result.
Optionally, the step of skipping the face grayscale image to the target convolution layer or the target pooling layer through a skipping connection layer in the preset mask detection model to process to obtain the target feature map includes:
inputting the face gray image into a preset mask detection model, and processing the face gray image through a convolution layer in the preset mask detection model to obtain a convolution image;
inputting the convolution image to a jump connection layer of a preset mask detection model, and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer;
processing the convolved image through the target convolutional layer to obtain a new convolved image, or processing the convolved image through the target pooling layer to obtain a pooled image;
and inputting the new convolution image or the pooled image to the jump connection layer until the new convolution image or the pooled image is input to the last pooled layer through the jump connection layer, and taking the pooled image output by the last pooled layer as a target feature map.
Optionally, the step of inputting the convolution image into a jump connection layer of a preset mask detection model, and inputting the convolution image into a target convolution layer or a target pooling layer through the jump connection layer includes:
inputting the convolution image to a jump connection layer in the preset mask detection model to obtain a gradient value of the convolution image;
when the gradient value is smaller than or equal to a preset gradient threshold value, determining a target convolutional layer corresponding to the gradient value through the jump connection layer, and inputting the convolutional image to the target convolutional layer;
and when the gradient value is larger than a preset gradient threshold value, determining a target pooling layer corresponding to the gradient value through the jump connection layer, and inputting the convolution image to the target pooling layer.
Optionally, the step of inputting the target feature map into a full connection layer in a preset mask detection model to obtain a mask wearing detection result includes:
inputting the target characteristic diagram into a full-connection layer of a preset mask detection model, acquiring a matrix vector product of matrix vectors corresponding to the target characteristic diagram through the full-connection layer, and classifying according to the matrix vector product;
when the matrix vector product is of a first type, outputting a mask wearing detection result as a wearing mask;
and when the matrix vector product is of a second type, outputting a mask wearing detection result as an unworn mask.
Optionally, before the step of skipping and inputting the face gray-scale image to the target convolution layer or the target pooling layer for processing through a skipping connection layer in the preset mask detection model to obtain the target feature map, the method includes:
acquiring a training sample set;
extracting training samples with preset proportion from the training sample set, inputting the training samples into an initial mask detection model, and performing iterative training on the initial mask detection model;
acquiring the recognition accuracy of the mask detection model obtained through training;
and when the identification accuracy is greater than or equal to a preset accuracy threshold, taking the mask detection model obtained by training as a preset mask detection model.
Optionally, the step of preprocessing the face picture to obtain a face gray-scale image includes:
counting pixel values of all pixel points in the face picture, and sequencing all the pixel values from small to large to obtain a pixel sequence;
and acquiring an intermediate pixel value in the pixel sequence, replacing the pixel value larger than the intermediate pixel value with the intermediate pixel value, so as to remove noise in the face picture and convert the face image into a face gray image.
Optionally, after the step of inputting the target feature map into a full connection layer in a preset mask detection model and obtaining a mask wearing detection result, the method further includes:
when the mask wearing detection result indicates that the mask is not worn, performing identity recognition on the face image to obtain identity information;
and outputting a mask wearing prompt containing the identity information.
The application still provides a detection device is worn to gauze mask, detection device is worn to gauze mask includes:
the mask wearing detection module is used for detecting whether the mask wearing detection request is received or not;
the processing module is used for preprocessing the face picture to obtain a face gray image;
the calling module is used for skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and the output module is used for inputting the target characteristic diagram to a full connection layer in a preset mask detection model to obtain a mask wearing detection result.
The application still provides a check out test set is worn to gauze mask, check out test set is worn to gauze mask includes: the mask wearing detection method comprises a memory, a processor and a mask wearing detection program which is stored on the memory and can run on the processor, wherein the steps of the mask wearing detection method are realized when the mask wearing detection program is executed by the processor.
The application also provides a computer storage medium, wherein the computer storage medium stores a mask wearing detection program, and the mask wearing detection program realizes the steps of the mask wearing detection method when being executed by a processor.
The invention provides a mask wearing detection method, a device, equipment and a readable storage medium, wherein when a mask wearing detection request is received, a to-be-detected face picture associated with the mask wearing detection request is obtained; preprocessing the face picture to obtain a face gray image; skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image; inputting the target characteristic diagram into a full-connection layer in a preset mask detection model to obtain a mask wearing detection result; in this embodiment, the mask detection model is preset, the face gray level image is skipped and input to the target convolution layer or the target pooling layer through the skipping connection layer in the preset mask detection model, so that the step of each processing layer in the preset mask detection model is not required to be executed in sequence, the processing steps of the face image are reduced through level skipping, the mask detection efficiency is improved, in addition, a physical instrument is not required to be purchased in the implementation, and the hardware cost is reduced.
Drawings
Fig. 1 is a schematic diagram of an alternative hardware structure of the device according to the embodiment of the present application;
fig. 2 is a schematic flow chart of a first embodiment of the mask wearing detection method according to the present application;
fig. 3 is a schematic structural view of a preset mask detection model in the first embodiment of the mask wearing detection method of the present application;
fig. 4 is a schematic view of a specific scene of mask inspection performed by a preset mask inspection model in the first embodiment of the mask wearing inspection method of the present application;
fig. 5 is a schematic functional block diagram of an embodiment of the mask wearing detection device according to the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present application.
Detection equipment is worn to this application embodiment gauze mask can be server equipment, as shown in fig. 1, this gauze mask is worn detection equipment and can include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operation network communication module, a user interface module, and a mask wearing detection program.
In the device shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call up the mask wearing detection stored in the memory 1005 and perform the operations in the mask wearing detection method described below.
In the mask wear detection apparatus shown in fig. 1, the processor 1001 is configured to execute a mask wear detection program stored in the memory 1005, and implement the following steps:
when a mask wearing detection request is received, acquiring a face picture to be detected associated with the mask wearing detection request;
preprocessing the face picture to obtain a face gray image;
skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and inputting the target characteristic diagram into a full-connection layer in a preset mask detection model to obtain a mask wearing detection result.
Further, the processor 1001 may call the mask wearing detection program stored in the memory 1005, and execute the step of skipping and inputting the face grayscale image to the target convolution layer or the target pooling layer for processing through a skipping connection layer in the preset mask detection model, so as to obtain the target feature map, including:
inputting the face gray image into a preset mask detection model, and processing the face gray image through a convolution layer in the preset mask detection model to obtain a convolution image;
inputting the convolution image to a jump connection layer of a preset mask detection model, and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer;
processing the convolved image through the target convolutional layer to obtain a new convolved image, or processing the convolved image through the target pooling layer to obtain a pooled image;
and inputting the new convolution image or the pooled image to the jump connection layer until the new convolution image or the pooled image is input to the last pooled layer through the jump connection layer, and taking the pooled image output by the last pooled layer as a target feature map.
Further, the processor 1001 may call a mask wearing detection program stored in the memory 1005, and execute the step of inputting the convolution image to a jump connection layer of a preset mask detection model, and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer, including:
inputting the convolution image to a jump connection layer in the preset mask detection model to obtain a gradient value of the convolution image;
when the gradient value is smaller than or equal to a preset gradient threshold value, determining a target convolutional layer corresponding to the gradient value through the jump connection layer, and inputting the convolutional image to the target convolutional layer;
and when the gradient value is larger than a preset gradient threshold value, determining a target pooling layer corresponding to the gradient value through the jump connection layer, and inputting the convolution image to the target pooling layer.
Further, the processor 1001 may call the mask wearing detection program stored in the memory 1005, and execute the step of inputting the target feature map to the full connection layer in the preset mask detection model to obtain the mask wearing detection result, including:
inputting the target characteristic diagram into a full-connection layer of a preset mask detection model, acquiring a matrix vector product of matrix vectors corresponding to the target characteristic diagram through the full-connection layer, and classifying according to the matrix vector product;
when the matrix vector product is of a first type, outputting a mask wearing detection result as a wearing mask;
and when the matrix vector product is of a second type, outputting a mask wearing detection result as an unworn mask.
Further, the processor 1001 may call the mask wearing detection program stored in the memory 1005, and execute the step of skipping and inputting the face grayscale image to the target convolution layer or the target pooling layer through the skipping connection layer in the preset mask detection model for processing, and before the step of obtaining the target feature map, the method includes:
acquiring a training sample set;
extracting training samples with preset proportion from the training sample set, inputting the training samples into an initial mask detection model, and performing iterative training on the initial mask detection model;
acquiring the recognition accuracy of the mask detection model obtained through training;
and when the identification accuracy is greater than or equal to a preset accuracy threshold, taking the mask detection model obtained by training as a preset mask detection model.
Further, the processor 1001 may call a mask wearing detection program stored in the memory 1005, and execute the step of preprocessing the face image to obtain a face grayscale image, including:
counting pixel values of all pixel points in the face picture, and sequencing all the pixel values from small to large to obtain a pixel sequence;
and acquiring an intermediate pixel value in the pixel sequence, replacing the pixel value larger than the intermediate pixel value with the intermediate pixel value, so as to remove noise in the face picture and convert the face image into a face gray image.
Further, after the step of calling the mask wearing detection program stored in the memory 1005, the processor 1001 may execute the step of inputting the target feature map to the full-link layer in the preset mask detection model to obtain the mask wearing detection result, where the method further includes:
when the mask wearing detection result indicates that the mask is not worn, performing identity recognition on the face image to obtain identity information;
and outputting a mask wearing prompt containing the identity information.
Based on the hardware structure, various embodiments of the mask wearing detection method are provided.
Referring to fig. 2, in a first embodiment of the mask wearing detection method of the present application, the method includes:
and step S10, when receiving the mask wearing detection request, acquiring the face picture to be detected associated with the mask wearing detection request.
The mask wearing detection method in the embodiment is applied to mask wearing detection equipment in public areas such as subways, hospitals, high-speed railway stations and libraries.
The mask wearing detection device receives the mask wearing detection request, and the triggering mode of the mask wearing detection request is not specifically limited, that is, the mask wearing detection request can be actively triggered by a user, for example, the user clicks a 'mask wearing detection' button on a display page of the mask wearing detection device to actively trigger the mask wearing detection request; in addition, the mask wearing detection request may also be automatically triggered, for example, when the mask wearing detection device recognizes the face information, the mask wearing detection request is automatically triggered.
When the mask wearing detection device receives the mask wearing detection request, the mask wearing detection device acquires a face picture to be detected associated with the mask wearing detection request. It should be noted that the mask wearing detection request is associated with a to-be-detected face picture, which refers to a face picture of a user who actively triggers the mask wearing detection request, or a face picture of a user who actively triggers the mask wearing detection request and all face pictures within a preset picture acquisition range of mask wearing detection equipment, or mask wearing detection equipment acquires a video image within the preset range, when the video image includes the face picture, and when the mask wearing detection equipment automatically triggers the mask wearing detection request, the number of faces in the face picture in the embodiment is not specifically limited, and the number of faces is at least one.
In addition, the face picture to be detected associated with the mask wearing detection request is a picture containing people, and the person state in the face picture is not particularly limited, that is, the face picture can be a person front photograph, a person side photograph, a person big photograph, a person whole photograph and the like.
And step S20, preprocessing the face picture to obtain a face gray image.
The mask wearing detection device preprocesses the acquired face picture to acquire a face gray image, and specifically comprises the following steps:
counting pixel values of all pixel points in the face picture, and sequencing all the pixel values from small to large to obtain a pixel sequence;
and acquiring an intermediate pixel value in the pixel sequence, replacing the pixel value larger than the intermediate pixel value with the intermediate pixel value, so as to remove noise in the face picture and convert the face image into a face gray image.
That is, since the face picture is colorful, the color of each pixel in the color picture is determined by R, G, B three components, and 255 median values are desirable for each component, so that a pixel point can have a color variation range of 1600 or more tens of thousands (255 × 255 × 255). The gray image is a special color image with R, G, B components, the variation range of one pixel point is 255, and the description of the gray image still reflects the distribution and characteristics of the whole and local chroma and brightness levels of the whole image like the color image. Therefore, in order to facilitate subsequent calculation and analysis of whether the mask is worn in the face picture of the user, the face picture needs to be preprocessed, namely, the face color image is grayed into a face gray image, so that the face gray image is obtained. Specifically, step S20 in this embodiment includes:
the mask wearing detection equipment preprocesses the acquired face picture through a gray level image generation algorithm to obtain a face gray level image. The gray-scale image generation algorithm is a commonly used method in the image processing process, and an image which needs to be grayed is processed according to the gray-scale image generation algorithm, so that a gray-scale image of the image can be obtained.
And step S30, skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in the preset mask detection model to obtain a target characteristic image.
In this embodiment, a mask detection model is preset in the mask wearing detection device, and the preset mask detection model includes a convolution layer, a pooling layer, a jump connection layer and a full connection layer, where the sum of the number of layers of the convolution layer, the pooling layer, the jump connection layer and the full connection layer in the preset mask detection model is less than that of the ordinary neural network model, for example, the number of layers of the preset mask detection model is 9, and the mask wearing detection device jumps and inputs a face gray level map to a target convolution layer or a target pooling layer through the jump connection layer in the preset mask detection model to process, so as to obtain a target feature map; therefore, processing steps of each hierarchy do not need to be executed in sequence, image processing steps are reduced, and image processing efficiency is further improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a preset mask detection model in the first embodiment of the mask wearing detection method of the present application. The preset mask detection model in this embodiment includes an input module, three branches, and an output module, the left branch and the middle branch are four two-dimensional convolutional layer modules, respectively, and the four two-dimensional convolutional layer modules include two types of convolution kernels, the convolution kernels of the first layer and the fourth layer of the two-dimensional convolutional layer are the same, and the convolution kernels of the second layer and the third layer of the two-dimensional convolutional layer are the same. That is, as shown in fig. 3, the convolution kernels of the first two-dimensional convolution layer module and the fourth two-dimensional convolution layer module of the left branch are 1 × 1; the second two-dimensional convolutional layer module and the third two-dimensional convolutional layer module are convolutional kernels of k × k, where k may be 3 or 5 or other numbers. The convolution kernels of the first two-dimensional convolution layer module and the fourth two-dimensional convolution layer module of the middle branch are k multiplied by k; the second and third two-dimensional convolutional layer modules are convolutional kernels of 1 × 1, and similarly, k may be 3 or 5 or another number. The right branch is the jump connection layer module. The left branch, the middle branch and the right branch simultaneously process the input face gray level image, and the processing results of all the branches are added and summarized to be used as the face gray level image recognition output result.
The mask wearing detection device skips and inputs the face gray level image to a target convolution layer or a target pooling layer for processing through a skip connection layer in a preset mask detection model to obtain a target characteristic image, and referring to fig. 4, fig. 4 is a specific scene schematic diagram for mask detection through a preset mask detection model in the first embodiment of the mask wearing detection method. Specifically, the method comprises the steps of 1 to 9, inputting a face gray scale image from the step 1 to obtain a characteristic image, inputting the characteristic image to a jump connection layer by a preset mask detection model, analyzing the characteristic image by the jump connection layer, and determining a target convolution layer or a target pooling layer of the next processing, for example, inputting the characteristic image to any one of the steps of 2 and 8 by a mask wearing detection device through the jump connection layer in the preset mask detection model, and finally obtaining a target characteristic image.
The structure of the preset mask inspection model shown in fig. 4 includes 9 convolutional layers, where operator denotes the main composition of the current layer, and the 1 st to 8 th convolutional layers are composed of the ordinary convolutional layer NConv or the convolutional layer SConv of the preferred preset mask inspection model shown in fig. 3, for example, the main composition of the convolutional layer corresponding to step 1 is NConv, 3 × 3, i.e., the convolutional layer corresponding to step 1 is composed of the ordinary convolutional layer NConv with a convolutional kernel of 3 × 3, and similarly, the main composition of the convolutional layer corresponding to step 2 is SConv, 3 × 3, i.e., the convolutional layer corresponding to step 2 is the convolutional layer SConv of the preferred preset mask inspection model shown in fig. 3, and k is 3, preferably, the convolutional kernel 3 × 3 calculation amount is moderate, which ensures that the performance of the computer is not reduced, and facilitates the increase of the depth of the model; the 9 th convolutional layer is a full-link layer and is also an output layer, namely, the face gray-scale image recognition results of the 2 nd convolutional layer to the 8 th convolutional layer are output.
Resolution shown in fig. 4 indicates the size of the input face grayscale map of the current layer (convolution layer), that is, the resolution of the input face grayscale map. When the size of the length and the width of a certain volume of lamination layer resolution is half of the previous volume of lamination layer of the layer, the layer is indicated to be subjected to a pooling operation. For example, the resolution of the convolutional layer corresponding to step 1 is 224 × 224, the resolution of the convolutional layer corresponding to stage2 is 112 × 112, and this represents that the convolutional layer corresponding to stage2 is subjected to the pooling operation once. The pooling operation aims to perform down-sampling on the input face gray-scale image under the condition that the features of the face gray-scale image are not lost as much as possible, so that a thumbnail of the input face gray-scale image is generated, and the aims of reducing the dimensions of the features of the face gray-scale image and retaining effective information are fulfilled.
The Channel shown in fig. 4 represents the number of channels or a feature map, that is, the pixel point value of the face gray scale map output by the current layer (convolutional layer). For example, if the convolution kernel of the convolution layer corresponding to step 2 is 3 × 3 and the output pixel point value is 8, the parameters: 3 × 3 × 8 ═ 72.
Layers shown in fig. 4 indicate how many repetitions of the current layer (convolutional layer), i.e., how many repetitions of (the same as) NConv or repetitions of (the same as) SConv constitute the current convolutional layer. For example, the layers of the convolutional layer corresponding to step 3 are 2, which means that the convolutional layer corresponding to step 3 is composed of 2 same SConv, 3 × 3; similarly, the layers of the convolutional layer corresponding to step 7 are 4, which means that the convolutional layer corresponding to step 7 is composed of 4 same SConv, 5 × 5.
And step S40, inputting the target characteristic diagram into a full connection layer in a preset mask detection model to obtain a mask wearing detection result.
Detection equipment is worn to gauze mask in this embodiment inputs the full articulamentum in the predetermined gauze mask detection model with target characteristic map, carries out the weighted classification through full articulamentum, obtains the gauze mask and wears the testing result, specifically, includes:
step a1, inputting the target characteristic diagram into a full-connection layer of a preset mask detection model, acquiring a matrix-vector product of matrix vectors corresponding to the target characteristic diagram through the full-connection layer, and classifying according to the matrix-vector product;
a2, when the matrix vector product is of a first type, outputting a mask wearing detection result as a wearing mask;
step a3, when the matrix vector product is of the second type, outputting the mask wearing detection result as the mask is not worn.
Namely, the mask wearing detection equipment inputs the target characteristic diagram into a full-connection layer of a preset mask detection model, obtains a matrix-vector product of matrix vectors corresponding to the target characteristic diagram through the full-connection layer, wherein the matrix-vector product can be 1 or 0, and classifies according to the matrix-vector product; determining the type of the mask as a first type when the target characteristic diagram is 1, and outputting a mask wearing detection result as a wearing mask by mask wearing detection equipment; and when the second type is determined when the matrix vector product is 0, the mask wearing detection equipment outputs a mask wearing detection result as that the mask is not worn.
For example, the FC/Output shown in fig. 4 represents a fully connected layer or a fully convolutional layer or a mixture of a fully connected layer and a fully convolutional layer. In this embodiment, a combination of 2 full convolution layers and 2 full connection layers may be designed, and the output dimension of the last full connection layer is 2, and then the final output mask wearing detection result may be obtained by connecting a classifier after the last full connection layer.
In the embodiment of the application, the preset mask detection model is composed of the convolution layer module, and the advantages of a common neural network structure are included. Each module is a sub-network that may contain convolutional layers, pooling layers, and active layers. That is, our network architecture is two-tiered, with the upper tier being modules and the lower tier (i.e., within each module) being various layers. Then, there may be jump connection layers between modules and between layers, which means that one module or layer can jump over the following module or layer and then directly send the output result of the module or layer to the following module or layer. Therefore, the structure is simple, the characteristics can be comprehensively and quickly extracted and the recognition result of the face gray-scale image can be output compared with the common neural network structure, and meanwhile, a physical instrument does not need to be purchased, so that the recognition accuracy of the face gray-scale image can be improved, the recognition time can be reduced, and the recognition cost can be saved.
The mask detection model is preset in the embodiment, the face gray level image is input to the target convolution layer or the target pooling layer in a skipping mode through the skipping connection layer in the preset mask detection model, so that the step of each processing layer in the preset mask detection model does not need to be executed in sequence, the processing steps of the face image are reduced through level skipping, the mask detection efficiency is improved, in addition, a physical instrument does not need to be purchased in the implementation, and the hardware cost is reduced.
Further, based on the first embodiment of the mask wearing detection method, the second embodiment of the mask wearing detection method is provided.
This embodiment is a refinement of step S30 in the first embodiment, and specifically includes, in the second embodiment of the mask wear detection method of the present application:
inputting the face gray image into a preset mask detection model, and processing the face gray image through a convolution layer in the preset mask detection model to obtain a convolution image;
inputting the convolution image to a jump connection layer of a preset mask detection model, and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer;
processing the convolved image through the target convolutional layer to obtain a new convolved image, or processing the convolved image through the target pooling layer to obtain a pooled image;
and inputting the new convolution image or the pooled image to the jump connection layer until the new convolution image or the pooled image is input to the last pooled layer through the jump connection layer, and taking the pooled image output by the last pooled layer as a target feature map.
In this embodiment, the mask wearing detection device inputs the face gray scale image into a preset mask detection model, and processes the face gray scale image through a convolution layer in the preset mask detection model to obtain a convolution image. Inputting the convolution image into a jump connecting layer of a preset mask detection model, and inputting the convolution image into a target convolution layer or a target pooling layer through the jump connecting layer, specifically, the method comprises the following steps:
b1, inputting the convolution image to a jump connection layer in the preset mask detection model to obtain a gradient value of the convolution image;
b2, when the gradient value is smaller than or equal to a preset gradient threshold value, determining a target convolution layer corresponding to the gradient value through the jump connection layer, and inputting the convolution image to the target convolution layer;
and b3, when the gradient value is larger than a preset gradient threshold value, determining a target pooling layer corresponding to the gradient value through the jump connection layer, and inputting the convolution image to the target pooling layer.
Namely, the mask wearing detection equipment inputs the convolution image to a jump connection layer in a preset mask detection model to obtain a gradient value of the convolution image; the mask wearing detection device compares the gradient value with a preset gradient threshold value (the preset gradient threshold value can be flexibly set according to specific scenes), when the gradient value is smaller than or equal to the preset gradient threshold value, the mask wearing detection device determines a target convolution layer corresponding to the gradient value through a jump connection layer (for example, when the gradient value is in a first preset range, the jump is performed at intervals of 2 layers), and inputs the convolution image to the target convolution layer; and when the gradient value is larger than a preset gradient threshold value, determining a target pooling layer corresponding to the gradient value through a jump connection layer, and inputting the convolution image to the target pooling layer.
In this embodiment, the mask wearing detection device processes the convolution image through the target convolution layer to obtain a new convolution image, or processes the convolution image through the target pooling layer to obtain a pooled image, inputs the new convolution image or the pooled image to the jump connection layer until the new convolution image or the pooled image is input to the last pooling layer through the jump connection layer, and uses the pooled image output by the last pooling layer as the target feature map.
In this embodiment, jump is performed through the jump connecting layer in the preset mask detection model, so that the execution steps are reduced, and the mask identification efficiency is improved.
Further, based on the above embodiments of the mask wearing detection method of the present application, a third embodiment of the mask wearing detection method of the present application is proposed. In the second embodiment of the mask wearing detection method of the present application, step S30 includes:
acquiring a training sample set;
the mask wearing detection device acquires a training sample set, and the training sample set acquired by the mask wearing detection device comprises a worn mask face picture added with a first identifier and an unworn mask face picture added with a second identifier. Specifically, the training sample set refers to face pictures prepared in advance, and these face pictures are labeled, so that the training sample set can be used. The mask is worn or not, a first identification is added to the worn mask face picture, and a second identification is added to the unworn mask face picture. It should be noted that the number of training sample sets is not specifically limited, but the number of training sample sets must be sufficient to complete model training.
And extracting training samples in a preset proportion from the training sample set, inputting the training samples into an initial mask detection model, and performing iterative training on the initial mask detection model.
The mask wearing detection equipment extracts training samples with preset proportion from the acquired training sample set and inputs the training samples into the initial mask wearing detection neural network model, and the mask wearing detection equipment carries out iterative training on the initial mask wearing detection neural network model. Specifically, in order to gradually train by using data in training sample sets to obtain a preset mask detection model, training samples are extracted according to a preset proportion and sequentially input into an initial mask wearing detection neural network model for iterative training, and the initial mask wearing detection neural network model is continuously adjusted according to an iterative training result, so that the initial mask wearing detection neural network model is closer to the initial preset mask detection model required by people. In addition, due to the consideration of the simplicity and the calculation amount of the model, only training samples in a preset proportion need to be extracted from the training sample set and input to the initial mask wearing detection neural network model, and iterative training is carried out on the initial mask wearing detection neural network model.
And acquiring the recognition accuracy of the mask detection model obtained by training, and taking the mask detection model obtained by training as a preset mask detection model when the recognition accuracy is greater than or equal to a preset accuracy threshold.
The mask wearing detection device obtains the recognition accuracy of the trained mask wearing detection neural network model, and when the recognition accuracy is larger than or equal to a preset accuracy threshold value, the mask wearing detection device takes the trained mask wearing detection neural network model as a preset mask detection model. Specifically, a preset accuracy threshold may be set as a reference for training completion. The mask wearing detection device extracts training samples in a preset proportion from the training sample set and inputs the training samples into an initial mask wearing detection neural network model, iterative training is carried out on the initial mask wearing detection neural network model, training each time correspondingly obtains the trained mask wearing detection neural network model, the recognition accuracy of the trained mask wearing detection neural network model is obtained, and when the recognition accuracy is larger than or equal to a preset accuracy threshold value, the trained mask wearing detection neural network model is used as a preset mask detection model; and when the recognition accuracy is smaller than the preset accuracy threshold, continuously extracting training samples in a preset proportion from the training sample set, inputting the training samples into the initial mask wearing detection neural network model, and performing iterative training on the initial mask wearing detection neural network model until the recognition accuracy of the trained mask wearing detection neural network model is larger than or equal to the preset accuracy threshold.
In the embodiment, the mask wearing detection device obtains a training sample set comprising a worn mask face picture added with a first identifier and an unworn mask face picture added with a second identifier, extracts a training sample with a preset proportion from the training sample set, inputs the training sample into an initial mask wearing detection neural network model, performs iterative training on the initial mask wearing detection neural network model, and uses the trained mask wearing detection neural network model as a preset mask detection model or continues to train the initial mask wearing detection neural network model according to a comparison result of the recognition accuracy of the trained mask wearing detection neural network model and a preset accuracy threshold value, so that the simplicity of the preset mask detection model can be realized on the basis of ensuring the recognition accuracy of the preset mask detection model, and the recognition time of the preset mask detection model is reduced, the recognition efficiency of presetting gauze mask detection model has been improved.
In addition, referring to fig. 5, an embodiment of the present application further provides a mask wearing detection device, including:
the acquisition module 10 is configured to acquire a to-be-detected face picture associated with a mask wearing detection request when the mask wearing detection request is received;
the processing module 20 is configured to pre-process the face image to obtain a face grayscale image;
the calling module 30 is used for skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and the output module 40 is used for inputting the target characteristic diagram into a full connection layer in a preset mask detection model to obtain a mask wearing detection result.
The application still provides a check out test set is worn to gauze mask, check out test set is worn to gauze mask includes: the mask wearing detection method comprises a memory, a processor and a mask wearing detection program which is stored on the memory and can run on the processor, wherein the steps of the mask wearing detection method are realized when the mask wearing detection program is executed by the processor.
The application also provides a computer readable storage medium, wherein the computer readable storage medium stores a mask wearing detection program, and the mask wearing detection program realizes the steps of the mask wearing detection method when being executed by a processor.
In the embodiments of the mask wear detection method, the apparatus, the device and the readable storage medium of the present application, all technical features of the embodiments of the mask wear detection method are included, and the contents of the expansion and explanation of the specification are substantially the same as those of the embodiments of the mask wear detection method, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. A mask wearing detection method is characterized by comprising the following steps:
when a mask wearing detection request is received, acquiring a face picture to be detected associated with the mask wearing detection request;
preprocessing the face picture to obtain a face gray image;
skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and inputting the target characteristic diagram into a full-connection layer in a preset mask detection model to obtain a mask wearing detection result.
2. The mask wearing detection method according to claim 1, wherein the step of skipping the face gray level map to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target feature map comprises:
inputting the face gray image into a preset mask detection model, and processing the face gray image through a convolution layer in the preset mask detection model to obtain a convolution image;
inputting the convolution image to a jump connection layer of a preset mask detection model, and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer;
processing the convolved image through the target convolutional layer to obtain a new convolved image, or processing the convolved image through the target pooling layer to obtain a pooled image;
and inputting the new convolution image or the pooled image to the jump connection layer until the new convolution image or the pooled image is input to the last pooled layer through the jump connection layer, and taking the pooled image output by the last pooled layer as a target feature map.
3. The mask wear detection method according to claim 2, wherein the step of inputting the convolution image to a jump connection layer of a preset mask detection model and inputting the convolution image to a target convolution layer or a target pooling layer through the jump connection layer comprises:
inputting the convolution image to a jump connection layer in the preset mask detection model to obtain a gradient value of the convolution image;
when the gradient value is smaller than or equal to a preset gradient threshold value, determining a target convolutional layer corresponding to the gradient value through the jump connection layer, and inputting the convolutional image to the target convolutional layer;
and when the gradient value is larger than a preset gradient threshold value, determining a target pooling layer corresponding to the gradient value through the jump connection layer, and inputting the convolution image to the target pooling layer.
4. The mask wearing detection method according to claim 1, wherein the step of inputting the target feature map to a full link layer in a preset mask detection model to obtain a mask wearing detection result comprises:
inputting the target characteristic diagram into a full-connection layer of a preset mask detection model, acquiring a matrix vector product of matrix vectors corresponding to the target characteristic diagram through the full-connection layer, and classifying according to the matrix vector product;
when the matrix vector product is of a first type, outputting a mask wearing detection result as a wearing mask;
and when the matrix vector product is of a second type, outputting a mask wearing detection result as an unworn mask.
5. The mask wearing detection method according to claim 1, wherein before the step of skipping the face gray scale map to the target convolution layer or the target pooling layer for processing through a skipping connection layer in the preset mask detection model to obtain the target feature map, the method comprises:
acquiring a training sample set;
extracting training samples with preset proportion from the training sample set, inputting the training samples into an initial mask detection model, and performing iterative training on the initial mask detection model;
and acquiring the recognition accuracy of the mask detection model obtained by training, and taking the mask detection model obtained by training as a preset mask detection model when the recognition accuracy is greater than or equal to a preset accuracy threshold.
6. The mask wearing detection method according to claim 1, wherein the step of preprocessing the face image to obtain a face gray scale image comprises:
counting pixel values of all pixel points in the face picture, and sequencing all the pixel values from small to large to obtain a pixel sequence;
and acquiring an intermediate pixel value in the pixel sequence, replacing the pixel value larger than the intermediate pixel value with the intermediate pixel value, so as to remove noise in the face picture and convert the face image into a face gray image.
7. The mask wear detection method according to any one of claims 1 to 6, wherein after the step of inputting the target feature map to a full connection layer in a preset mask detection model to obtain a mask wear detection result, the method further comprises:
when the mask wearing detection result indicates that the mask is not worn, performing identity recognition on the face image to obtain identity information;
and outputting a mask wearing prompt containing the identity information.
8. The utility model provides a detection device is worn to gauze mask which characterized in that, detection device is worn to gauze mask includes:
the mask wearing detection module is used for detecting whether the mask wearing detection request is received or not;
the processing module is used for preprocessing the face picture to obtain a face gray image;
the calling module is used for skipping and inputting the face gray level image to a target convolution layer or a target pooling layer for processing through a skipping connection layer in a preset mask detection model to obtain a target characteristic image;
and the output module is used for inputting the target characteristic diagram to a full connection layer in a preset mask detection model to obtain a mask wearing detection result.
9. A mask wearing detection device, characterized in that the mask wearing detection device includes: a memory, a processor, and a mask wear detection program stored on the memory and executable on the processor, the mask wear detection program when executed by the processor implementing the steps of the mask wear detection method according to any one of claims 1 to 7.
10. A readable storage medium having stored thereon a mask wear detection program which, when executed by a processor, implements the steps of the mask wear detection method according to any one of claims 1 to 7.
CN202010338359.5A 2020-04-26 2020-04-26 Mask wearing detection method, device, equipment and readable storage medium Pending CN111523490A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010338359.5A CN111523490A (en) 2020-04-26 2020-04-26 Mask wearing detection method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010338359.5A CN111523490A (en) 2020-04-26 2020-04-26 Mask wearing detection method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111523490A true CN111523490A (en) 2020-08-11

Family

ID=71910779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010338359.5A Pending CN111523490A (en) 2020-04-26 2020-04-26 Mask wearing detection method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111523490A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11436881B2 (en) 2021-01-19 2022-09-06 Rockwell Collins, Inc. System and method for automated face mask, temperature, and social distancing detection
CN115620209A (en) * 2022-11-15 2023-01-17 北京梦天门科技股份有限公司 Method for generating public health video supervision result and related equipment
WO2024050760A1 (en) * 2022-09-08 2024-03-14 Intel Corporation Image processing with face mask detection

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11436881B2 (en) 2021-01-19 2022-09-06 Rockwell Collins, Inc. System and method for automated face mask, temperature, and social distancing detection
WO2024050760A1 (en) * 2022-09-08 2024-03-14 Intel Corporation Image processing with face mask detection
CN115620209A (en) * 2022-11-15 2023-01-17 北京梦天门科技股份有限公司 Method for generating public health video supervision result and related equipment

Similar Documents

Publication Publication Date Title
TWI773189B (en) Method of detecting object based on artificial intelligence, device, equipment and computer-readable storage medium
Dudhane et al. Ri-gan: An end-to-end network for single image haze removal
CN111523490A (en) Mask wearing detection method, device, equipment and readable storage medium
Babaee et al. Person identification from partial gait cycle using fully convolutional neural networks
WO2019033572A1 (en) Method for detecting whether face is blocked, device and storage medium
CN109740589B (en) Asynchronous object ROI detection method and system in video mode
CN110826632A (en) Image change detection method, device, equipment and computer readable storage medium
CN110399826B (en) End-to-end face detection and identification method
CN111104841A (en) Violent behavior detection method and system
CN111539338A (en) Pedestrian mask wearing control method, device, equipment and computer storage medium
CN114067431A (en) Image processing method, image processing device, computer equipment and storage medium
CN112348089A (en) Working state identification method, server, storage medium and device
CN112149570B (en) Multi-person living body detection method, device, electronic equipment and storage medium
CN115424171A (en) Flame and smoke detection method, device and storage medium
CN111899470A (en) Human body falling detection method, device, equipment and storage medium
CN115240203A (en) Service data processing method, device, equipment and storage medium
CN111784665A (en) OCT image quality assessment method, system and device based on Fourier transform
CN111209947A (en) Image recognition method, device, storage medium and apparatus
CN111553241A (en) Method, device and equipment for rejecting mismatching points of palm print and storage medium
CN110795980A (en) Network video-based evasion identification method, equipment, storage medium and device
CN109685714B (en) Picture compression method, device, equipment and computer readable storage medium
CN114724258A (en) Living body detection method, living body detection device, storage medium and computer equipment
CN110490022A (en) A kind of bar code method and device in identification picture
CN113792623A (en) Security check CT target object identification method and device
CN110659631A (en) License plate recognition method and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination