WO2022160202A1 - Method and apparatus for inspecting mask wearing, terminal device and readable storage medium - Google Patents

Method and apparatus for inspecting mask wearing, terminal device and readable storage medium Download PDF

Info

Publication number
WO2022160202A1
WO2022160202A1 PCT/CN2021/074221 CN2021074221W WO2022160202A1 WO 2022160202 A1 WO2022160202 A1 WO 2022160202A1 CN 2021074221 W CN2021074221 W CN 2021074221W WO 2022160202 A1 WO2022160202 A1 WO 2022160202A1
Authority
WO
WIPO (PCT)
Prior art keywords
mask
wearing
face
image
probability value
Prior art date
Application number
PCT/CN2021/074221
Other languages
French (fr)
Chinese (zh)
Inventor
韩永刚
郭之先
黄凯明
Original Assignee
深圳市锐明技术股份有限公司
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 深圳市锐明技术股份有限公司 filed Critical 深圳市锐明技术股份有限公司
Priority to CN202180000114.4A priority Critical patent/CN112912893A/en
Priority to PCT/CN2021/074221 priority patent/WO2022160202A1/en
Publication of WO2022160202A1 publication Critical patent/WO2022160202A1/en

Links

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/161Detection; Localisation; Normalisation
    • G06V40/165Detection; Localisation; Normalisation using facial parts and geometric relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • 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
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components

Definitions

  • the present application relates to the technical field of image processing, and in particular to a detection method, device, terminal device and readable storage medium for wearing a mask.
  • the related methods of detecting whether people wear masks in a standardized way require a lot of human resources or computing resources, the detection efficiency is low, and the accuracy of the detection results is not high.
  • One of the purposes of the embodiments of the present application is to provide a detection method, device, terminal device and readable storage medium for wearing a mask, aiming to solve the method for detecting whether people wear masks in a standard manner, which requires a large amount of human resources or computing. resources, low detection efficiency and low accuracy of detection results.
  • a detection method for wearing a mask including:
  • the mask image is processed to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  • the described to-be-recognized image is processed to obtain a mask image containing the outline of a human face, including:
  • the to-be-recognized image is input into the face segmentation network model for processing to obtain a mask image containing the outline of the face.
  • the process of processing the mask image to obtain a detection result of whether the user corresponding to the face profile is wearing a mask according to regulations includes:
  • the mask image is processed by the mask-wearing recognition network model to obtain the output result of the mask-wearing recognition network model;
  • the detection result of whether the user corresponding to the face contour is wearing a mask is determined.
  • the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour.
  • the detection result of determining whether the user corresponding to the profile of the human face is wearing a mask according to the output result including:
  • the second probability value is greater than the first probability value and the third probability value, it is determined that the detection result is that the user does not wear a mask properly;
  • the third probability value is greater than the first probability value and the second probability value, it is determined that the detection result is that the user does not wear a mask.
  • the method further includes:
  • the convolutional neural network model is pre-trained according to the mask image training data to obtain the mask-wearing recognition network model.
  • the method further includes:
  • the training image data is image data comprising a human face
  • the semantic segmentation model is pre-trained through the training image data to obtain the face segmentation network model.
  • the method further includes:
  • a detection device for wearing a mask including:
  • a first acquisition module used for acquiring the image to be recognized
  • the image processing module is used to process the to-be-recognized image to obtain a mask image containing the outline of the face;
  • the detection module is configured to process the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  • a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the first method described above when the processor executes the computer program.
  • the detection method of wearing a mask described in any one of the aspects.
  • a computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the mask-wearing method according to any one of the above-mentioned first aspects is realized. Detection method.
  • a fifth aspect provides a computer program product that, when the computer program product runs on a terminal device, enables the terminal device to execute the method for detecting wearing a mask according to any one of the first aspects above.
  • the beneficial effect of the detection method for wearing a mask is that: by processing the image to be recognized, a mask image containing the outline of a human face is obtained, and the mask image is detected by a mask-wearing detection network model to obtain whether the user is The probability of wearing a mask is standardized, so as to determine whether the user wears a mask in a standardized manner, which reduces the amount of calculation and improves the detection efficiency and the accuracy of the detection results.
  • Fig. 1 is the schematic flow sheet of the detection method of wearing a mask provided by the embodiment of the present application
  • step S103 of the detection method for wearing a mask provided by the embodiment of the present application
  • step S1032 of the detection method for wearing a mask provided by the embodiment of the present application
  • Fig. 4 is another schematic flow chart of the detection method of wearing a mask provided by the embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a detection device for wearing a mask provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • Some embodiments of the present application provide a detection method for wearing a mask, which can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, and notebook computers.
  • terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, and notebook computers.
  • the embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
  • FIG. 1 shows a schematic flow chart of the detection method for wearing a mask provided by the present application.
  • the method can be applied to the above-mentioned notebook computer.
  • the user is photographed by a preset camera, and the to-be-recognized image data including the user's face is obtained.
  • S102 Process the to-be-recognized image to obtain a mask image containing the outline of a human face.
  • a face segmentation network model is used to process a to-be-recognized image containing a human face, and a mask image containing the user's face contour output by the face segmentation network model is obtained.
  • S103 Process the mask image to obtain a detection result corresponding to the face contour of whether the user wears a mask in a standard manner.
  • the mask image containing the user's face contour is processed by the mask-wearing recognition network model, and the detection result of whether the user corresponding to the face contour output by the mask-wearing recognition network model is standard wearing a mask is obtained.
  • the detection results are set to include the probability values of the user wearing a mask, the user wearing a mask, and the user not wearing a mask.
  • the user's standard wearing of a mask refers to the situation where the user wears a mask according to medical regulations
  • the user's non-standard wearing of a mask refers to the user wearing a mask, but not covering important parts such as the mouth and nose in accordance with medical regulations.
  • the step S102 includes:
  • the to-be-recognized image is input into the face segmentation network model for processing to obtain a mask image containing the outline of the face.
  • the to-be-recognized image obtained by shooting is input into a face segmentation network model, and the to-be-recognized image is processed by the face segmentation network model to obtain a mask image containing the user's face contour.
  • the face segmentation network model includes but is not limited to a semantic segmentation (semantic segmentation) network model.
  • the area of the face contour included in the mask image can be set according to actual needs.
  • the above-mentioned face contour may refer to the contour of the entire face area, or only include the contour of a part of the face area that is used to identify whether the user is wearing a mask properly (generally, the area that identifies whether the user is wearing a mask is under the eyes). face area).
  • the step S103 includes:
  • the mask map containing the face contour is processed through the mask-wearing recognition network model to obtain the probability value of whether the user outputted by the mask-wearing recognition network wears a mask and whether the mask is regulated.
  • the detection result of whether the face contour corresponds to the standard wearing of the mask.
  • the wearing mask recognition network model includes but is not limited to the convolutional neural network model (Convolutional Neural Network model). Networks, CNN).
  • the detection result of whether the user corresponding to the face contour is regulated wearing a mask is determined according to the output result, including:
  • the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour.
  • the third probability value that the user corresponding to the face contour does not wear a mask.
  • the output result of the mask-wearing recognition network model includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a face contour corresponding to the user wearing a mask.
  • the step S1032 includes:
  • the third probability value is greater than the first probability value and the second probability value, determine that the detection result is that the user does not wear a mask.
  • the detection result is determined to be the user Standardize wearing of masks; in the detected output results, when the second probability value is greater than the first probability value and the third probability value (that is, the second probability value is about to be detected to be the largest), it is determined that the test result is that the user does not wear masks properly; In the output result, when the third probability value is greater than the first probability value and the second probability value (that is, the third probability value is detected to be the largest), it is determined that the detection result is that the user does not wear a mask.
  • the output result of the mask-wearing recognition network model is [0.1, 0.8, 0.1]
  • it is determined that the detection result is that the user does not wear a mask properly.
  • the method further includes:
  • the face image data includes face image data for wearing a mask, face image data for not wearing a mask, and face image data for not wearing a mask;
  • the convolutional neural network model is pre-trained according to the mask image training data to obtain the mask-wearing recognition network model.
  • a large amount of face image data is obtained, the face image data is processed according to the face segmentation network model, and the corresponding mask image training data containing the face contour is obtained.
  • the neural network model is pre-trained to obtain a mask-wearing recognition network model, so that the mask-wearing recognition network model can process the input image, and obtain the corresponding first probability value of wearing a mask, the second probability value of non-standard wearing a mask, and The third probability value for not wearing a mask.
  • the face image data includes the face image data of standard wearing masks, the face image data of non-standard wearing masks, and the face image data of not wearing masks.
  • the method after processing the face image data according to the face segmentation network model and obtaining the corresponding mask image training data, the method includes: adding a corresponding mask image training data according to the type of each face image data labels to facilitate pre-training of convolutional neural network models based on face segmentation image data.
  • the mask image training data when processing the face image data that is regulated wearing masks according to the face segmentation network model, and obtaining the corresponding mask image training data, the mask image training data should be labeled as "regular wearing masks";
  • the face segmentation network model processes the face image data that does not wear masks in a standardized manner, and when obtaining the corresponding mask image training data, the mask image training data should be labeled as "non-standard wearing masks";
  • the model processes the face image data without a mask, and when the corresponding mask image training data is obtained, the mask image training data should be labeled "without a mask”.
  • pre-training the semantic segmentation network model includes: calculating the loss through a segmentation loss function (such as a segmentation loss function based on cross entropy), and performing gradient backpropagation on the loss through a gradient descent algorithm to update the computational semantics
  • the weight parameters of each layer in the segmentation network model are obtained until the entire semantic segmentation network model converges, and the pre-trained face segmentation network model is obtained.
  • the method further includes:
  • the training image data is image data comprising a human face
  • the semantic segmentation model is pre-trained through the training image data to obtain the face segmentation network model.
  • a large amount of image data containing faces is obtained as training image data, and the semantic segmentation network model is pre-trained through the above training image data to obtain a face segmentation network model, so that the face segmentation network model is used for input
  • the mask image containing the outline of the face is output.
  • the loss function of the set face segmentation network model includes but is not limited to the segmentation loss function and the classification loss function
  • the loss function of the mask-wearing recognition network model includes but is not limited to the classification loss function.
  • the semantic segmentation network model and the convolutional neural network model are pre-integrated into a network model, and then the semantic segmentation network model in the model is pre-trained, and after the face segmentation network model is obtained, then The convolutional neural network model in the model is pre-trained to obtain the convolutional neural network model.
  • step S103 after the step S103, it further includes:
  • the face recognition algorithm is used to perform face recognition on the image to be recognized, and the face recognition result of the user in the image to be recognized is determined to facilitate notification.
  • the user wears a mask according to regulations, and carries out corresponding follow-up treatment.
  • a mask image containing the outline of a human face is obtained by processing the image to be recognized, and the mask image is detected by a mask-wearing detection network model to obtain the probability of whether the user wears a mask properly, so as to determine whether the user wears a mask properly.
  • the detection result is reduced, the calculation amount is reduced, and the detection efficiency and the detection result accuracy are improved.
  • FIG. 5 shows a structural block diagram of the detection device for wearing a mask provided by the embodiment of the present application. part.
  • the detection device for wearing a mask includes: a processor, wherein the processor is used to execute the following program modules stored in the memory: a first acquisition module, used to acquire an image to be recognized; an image processing module, used to treat The identification image is processed to obtain a mask image containing the outline of the face; the detection module is used to process the mask image to obtain a detection result of whether the user corresponding to the face outline is wearing a mask in a standard manner.
  • the detection device 100 wearing a mask includes:
  • the first acquisition module 101 is used to acquire the image to be recognized
  • the image processing module 102 is used for processing the image to be recognized to obtain a mask image containing the outline of the human face;
  • the detection module 103 is configured to process the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  • the image processing module 102 includes:
  • the first processing unit is configured to input the to-be-recognized image into a face segmentation network model for processing, and obtain a mask image including a face contour.
  • the detection module 103 includes:
  • a second processing unit configured to process the mask image through the mask-wearing recognition network model to obtain an output result of the mask-wearing recognition network model
  • a determination unit configured to determine, according to the output result, a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  • the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour.
  • the third probability value that the user corresponding to the face contour does not wear a mask.
  • the determining unit includes:
  • a first detection subunit configured to determine that the detection result is the user's standard wearing when it is detected that the first probability value is greater than the second probability value and the third probability value in the output result Face mask;
  • a second detection subunit configured to determine that the detection result is that the user is not standardized when the second probability value is greater than the first probability value and the third probability value in the output result wear a mask
  • a third detection sub-unit configured to determine that the detection result is that the user is not wearing when the third probability value is greater than the first probability value and the second probability value in the output result Face mask.
  • the detection device 100 for wearing a mask further includes:
  • the second acquisition module is used to acquire a plurality of face image data; wherein, the face image data includes face image data of standard wearing masks, face image data of non-standard wearing masks, and face image data of not wearing masks ;
  • a preprocessing module configured to process the face image data according to the face segmentation network model to obtain corresponding mask image training data
  • the first training module is used to pre-train the convolutional neural network model according to the mask image training data to obtain the mask-wearing recognition network model.
  • the detection device 100 for wearing a mask further includes:
  • the third acquisition module is used for acquiring training image data; wherein, the training image data is image data including human faces;
  • the second training module is used for pre-training the semantic segmentation model through the training image data to obtain the face segmentation network model.
  • the detection device 100 for wearing a mask further includes:
  • the face recognition module is configured to perform face recognition on the to-be-recognized image and determine the user's face recognition result when the detection result is that the user does not wear a mask in a standard manner or the user does not wear a mask.
  • a mask image containing the outline of a human face is obtained by processing the image to be recognized, and the mask image is detected by a mask-wearing detection network model to obtain the probability of whether the user wears a mask properly, so as to determine whether the user wears a mask properly.
  • the detection result is reduced, the calculation amount is reduced, and the detection efficiency and the detection result accuracy are improved.
  • FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device 6 in this embodiment includes: at least one processor 60 (only one is shown in FIG. 6 ), a processor, a memory 61 , and a processor stored in the memory 61 and can be processed in the at least one processor
  • the computer program 62 running on the processor 60 when the processor 60 executes the computer program 62, implements the steps in any of the above-mentioned embodiments of the detection method for wearing a mask.
  • the terminal device 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor 60 and a memory 61 .
  • FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than the one shown, or combine some components, or different components , for example, may also include input and output devices, network access devices, and the like.
  • the so-called processor 60 may be a central processing unit (Central Processing Unit, CPU), and the processor 60 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuits) Integrated Circuit, ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 61 may be an internal storage unit of the terminal device 6 in some embodiments, such as a hard disk or a memory of the terminal device 6 . In other embodiments, the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital Card (Secure Digital, SD), Flash Card (Flash Card), etc.
  • the memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of the computer program.
  • the memory 61 can also be used to temporarily store data that has been output or will be output.
  • Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.
  • the embodiments of the present application provide a computer program product, when the computer program product runs on a mobile terminal, the steps in the foregoing method embodiments can be implemented when the mobile terminal executes the computer program product.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • all or part of the processes in the methods of the above embodiments can be implemented by a computer program to instruct the relevant hardware.
  • the computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the above-mentioned various method embodiments may be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like.
  • the computer-readable medium may include at least: any entity or device capable of carrying computer program codes to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
  • ROM read-only memory
  • RAM random access memory
  • electrical carrier signals telecommunication signals
  • software distribution media For example, U disk, mobile hard disk, disk or CD, etc.
  • computer readable media may not be electrical carrier signals and telecommunications signals.
  • the disclosed apparatus/network device and method may be implemented in other manners.
  • the apparatus/network device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

Abstract

The present application discloses a method and apparatus for inspecting mask wearing, a terminal device and a readable storage medium. Said method comprises: acquiring an image to be recognized; processing said image to obtain a mask image comprising a face contour; and processing the mask image to obtain an inspection result in respect of whether a user corresponding to the face contour is wearing a mask in a standard way. According to the present invention, an image to be recognized is processed to obtain a mask image comprising a face contour, and the mask image is inspected by means of a mask wearing inspection network model to obtain the probability of whether a user wears a mask in a standard way, thereby determining an inspection result in respect of whether the user wears the mask in the standard way, reducing the amount of calculation, and improving the inspection efficiency and the precision of the inspection result.

Description

佩戴口罩的检测方法、装置、终端设备及可读存储介质Detection method, device, terminal device and readable storage medium for wearing a mask 技术领域technical field
本申请涉及图像处理技术领域,具体涉及一种佩戴口罩的检测方法、装置、终端设备及可读存储介质。The present application relates to the technical field of image processing, and in particular to a detection method, device, terminal device and readable storage medium for wearing a mask.
背景技术Background technique
在呼吸道传染疾病传播的过程中,佩戴口罩是一项非常显著的预防呼吸道传染疾病的措施。因此,检测人们是否佩戴口罩及是否规范佩戴口罩成为了一项重要的工作。In the process of the spread of respiratory infectious diseases, wearing a mask is a very significant measure to prevent respiratory infectious diseases. Therefore, it has become an important task to detect whether people wear masks and whether to wear masks in a standardized way.
在实际生活中,相关的检测人们是否规范佩戴口罩的方法需要消耗大量的人力资源或计算资源,检测效率低且检测结果的精度不高。In real life, the related methods of detecting whether people wear masks in a standardized way require a lot of human resources or computing resources, the detection efficiency is low, and the accuracy of the detection results is not high.
技术问题technical problem
本申请实施例的目的之一在于:提供一种佩戴口罩的检测方法、装置、终端设备及可读存储介质,旨在解决相关检测人们是否规范佩戴口罩的方法,需要消耗大量的人力资源或计算资源,检测效率低且检测结果的精度不高的问题。One of the purposes of the embodiments of the present application is to provide a detection method, device, terminal device and readable storage medium for wearing a mask, aiming to solve the method for detecting whether people wear masks in a standard manner, which requires a large amount of human resources or computing. resources, low detection efficiency and low accuracy of detection results.
技术解决方案technical solutions
为解决上述技术问题,本申请实施例采用的技术方案是:In order to solve the above-mentioned technical problems, the technical solutions adopted in the embodiments of the present application are:
第一方面,提供了一种佩戴口罩的检测方法,包括:In a first aspect, a detection method for wearing a mask is provided, including:
获取待识别图像;Get the image to be recognized;
对待识别图像进行处理,获得包含人脸轮廓的掩码图像;Process the image to be recognized to obtain a mask image containing the outline of the face;
对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。The mask image is processed to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
在一个实施例中,所述对待识别图像进行处理,获得包含人脸轮廓的掩码图像,包括:In one embodiment, the described to-be-recognized image is processed to obtain a mask image containing the outline of a human face, including:
将所述待识别图像输入人脸分割网络模型进行处理,获得包含人脸轮廓的掩码图像。The to-be-recognized image is input into the face segmentation network model for processing to obtain a mask image containing the outline of the face.
在一个实施例中,所述对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果,包括:In one embodiment, the process of processing the mask image to obtain a detection result of whether the user corresponding to the face profile is wearing a mask according to regulations includes:
通过佩戴口罩识别网络模型对所述掩码图像进行处理,获得所述佩戴口罩识别网络模型的输出结果;The mask image is processed by the mask-wearing recognition network model to obtain the output result of the mask-wearing recognition network model;
根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。According to the output result, the detection result of whether the user corresponding to the face contour is wearing a mask is determined.
在一个实施例中,所述输出结果包括与所述人脸轮廓对应的用户规范佩戴口罩的第一概率值、与所述人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与所述人脸轮廓对应的用户未佩戴口罩的第三概率值;In one embodiment, the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour. the third probability value that the user corresponding to the face profile does not wear a mask;
所述根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果,包括:The detection result of determining whether the user corresponding to the profile of the human face is wearing a mask according to the output result, including:
在检测到所述输出结果中,所述第一概率值大于所述第二概率值及所述第三概率值时,判定所述检测结果为所述用户规范佩戴口罩;When it is detected that in the output result, the first probability value is greater than the second probability value and the third probability value, it is determined that the detection result is that the user is wearing a mask according to specification;
在检测到所述输出结果中,所述第二概率值大于所述第一概率值及所述第三概率值时,判定所述检测结果为所述用户未规范佩戴口罩;When it is detected that in the output result, the second probability value is greater than the first probability value and the third probability value, it is determined that the detection result is that the user does not wear a mask properly;
在检测到所述输出结果中,所述第三概率值大于所述第一概率值及所述第二概率值时,判定所述检测结果为所述用户未佩戴口罩。When it is detected that in the output result, the third probability value is greater than the first probability value and the second probability value, it is determined that the detection result is that the user does not wear a mask.
在一个实施例中,所述方法,还包括:In one embodiment, the method further includes:
获取多个人脸图像数据;其中,所述人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据;Acquiring a plurality of face image data; wherein, the face image data includes face image data for wearing a mask, face image data for not wearing a mask, and face image data for not wearing a mask;
根据所述人脸分割网络模型对所述人脸图像数据进行处理,获得对应的掩码图像训练数据;Process the face image data according to the face segmentation network model to obtain corresponding mask image training data;
根据所述掩码图像训练数据对卷积神经网络模型进行预训练,获得所述佩戴口罩识别网络模型。The convolutional neural network model is pre-trained according to the mask image training data to obtain the mask-wearing recognition network model.
在一个实施例中,所述方法,还包括:In one embodiment, the method further includes:
获取训练图像数据;其中,所述训练图像数据为包含人脸的图像数据;Acquiring training image data; wherein, the training image data is image data comprising a human face;
通过所述训练图像数据对语义分割模型进行预训练,获得所述人脸分割网络模型。The semantic segmentation model is pre-trained through the training image data to obtain the face segmentation network model.
在一个实施例中,所述对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果之后,还包括:In one embodiment, after the processing of the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner, the method further includes:
在检测到检测结果为所述用户未规范佩戴口罩或所述用户未佩戴口罩时,对所述待识别图像进行人脸识别,确定所述用户的人脸识别结果。When it is detected that the detection result is that the user does not wear a mask in a standard manner or that the user does not wear a mask, face recognition is performed on the to-be-recognized image, and a face recognition result of the user is determined.
第二方面,提供了一种佩戴口罩的检测装置,包括:In a second aspect, a detection device for wearing a mask is provided, including:
第一获取模块,用于获取待识别图像;a first acquisition module, used for acquiring the image to be recognized;
图像处理模块,用于对待识别图像进行处理,获得包含人脸轮廓的掩码图像;The image processing module is used to process the to-be-recognized image to obtain a mask image containing the outline of the face;
检测模块,用于对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。The detection module is configured to process the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
第三方面,提供一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面中任一项所述的佩戴口罩的检测方法。In a third aspect, a terminal device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the first method described above when the processor executes the computer program. The detection method of wearing a mask described in any one of the aspects.
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述第一方面中任一项所述的佩戴口罩的检测方法。In a fourth aspect, a computer-readable storage medium is provided, the computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the mask-wearing method according to any one of the above-mentioned first aspects is realized. Detection method.
第五方面,提供一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述的佩戴口罩的检测方法。A fifth aspect provides a computer program product that, when the computer program product runs on a terminal device, enables the terminal device to execute the method for detecting wearing a mask according to any one of the first aspects above.
有益效果beneficial effect
本申请实施例提供的佩戴口罩的检测方法的有益效果在于:通过对待识别图像进行处理,获得包含人脸轮廓的掩码图像,并通过佩戴口罩检测网络模型对掩码图像进行检测,获得用户是否规范佩戴口罩的概率,从而判定用户是否规范佩戴口罩的检测结果,减小了计算量,提高了检测效率及检测结果的精度。The beneficial effect of the detection method for wearing a mask provided by the embodiment of the present application is that: by processing the image to be recognized, a mask image containing the outline of a human face is obtained, and the mask image is detected by a mask-wearing detection network model to obtain whether the user is The probability of wearing a mask is standardized, so as to determine whether the user wears a mask in a standardized manner, which reduces the amount of calculation and improves the detection efficiency and the accuracy of the detection results.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或示范性技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that are used in the description of the embodiments or exemplary technologies. Obviously, the drawings in the following description are only for the present application. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1是本申请实施例提供的佩戴口罩的检测方法的流程示意图;Fig. 1 is the schematic flow sheet of the detection method of wearing a mask provided by the embodiment of the present application;
图2是本申请实施例提供的佩戴口罩的检测方法步骤S103的流程示意图;2 is a schematic flowchart of step S103 of the detection method for wearing a mask provided by the embodiment of the present application;
图3是本申请实施例提供的佩戴口罩的检测方法步骤S1032的流程示意图;3 is a schematic flowchart of step S1032 of the detection method for wearing a mask provided by the embodiment of the present application;
图4是本申请实施例提供的佩戴口罩的检测方法的另一流程示意图;Fig. 4 is another schematic flow chart of the detection method of wearing a mask provided by the embodiment of the present application;
图5是本申请实施例提供的佩戴口罩的检测装置的结构示意图;5 is a schematic structural diagram of a detection device for wearing a mask provided by an embodiment of the present application;
图6是本申请实施例提供的终端设备的结构示意图。FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
本发明的实施方式Embodiments of the present invention
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本申请。In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present application.
术语“第一”、“第二”仅用于便于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明技术特征的数量。“多个”的含义是两个或两个以上,除非另有明确具体的限定。The terms "first" and "second" are only used for the purpose of description, and should not be understood as indicating or implying relative importance or implying indicating the number of technical features. "Plurality" means two or more, unless expressly specifically limited otherwise.
为了说明本申请所提供的技术方案,以下结合具体附图及实施例进行详细说明。In order to illustrate the technical solutions provided in the present application, the following detailed description is given in conjunction with the specific drawings and embodiments.
本申请的一些实施例提供佩戴口罩的检测方法可以应用于手机、平板电脑、可穿戴设备、车载设备、笔记本电脑等终端设备上,本申请实施例对终端设备的具体类型不作任何限制。Some embodiments of the present application provide a detection method for wearing a mask, which can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, and notebook computers. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
图1示出了本申请提供的佩戴口罩的检测方法的示意性流程图,作为示例而非限定,该方法可以应用于上述笔记本电脑中。FIG. 1 shows a schematic flow chart of the detection method for wearing a mask provided by the present application. As an example and not a limitation, the method can be applied to the above-mentioned notebook computer.
S101、获取待识别图像。S101. Acquire an image to be recognized.
在具体应用中,通过预先设置的摄像头对用户进行拍摄,获得包含用户人脸的待识别图像数据。In a specific application, the user is photographed by a preset camera, and the to-be-recognized image data including the user's face is obtained.
S102、对待识别图像进行处理,获得包含人脸轮廓的掩码图像。S102. Process the to-be-recognized image to obtain a mask image containing the outline of a human face.
在具体应用中,通过人脸分割网络模型对包含人脸的待识别图像进行处理,获得人脸分割网络模型输出的包含用户的人脸轮廓的掩码图像。In a specific application, a face segmentation network model is used to process a to-be-recognized image containing a human face, and a mask image containing the user's face contour output by the face segmentation network model is obtained.
S103、对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。S103: Process the mask image to obtain a detection result corresponding to the face contour of whether the user wears a mask in a standard manner.
在具体应用中,通过佩戴口罩识别网络模型对包含用户的人脸轮廓的掩码图像进行处理,获得佩戴口罩识别网络模型输出的与人脸轮廓对应的用户是否规范佩戴口罩的检测结果。为提高检测精度,设定检测结果包含用户规范佩戴口罩、用户为佩戴口罩及用户未规范佩戴口罩三种情况的概率值。其中,用户规范佩戴口罩是指用户根据医学规定规范佩戴口罩的情况,用户未规范佩戴口罩是指用户已佩戴口罩,但未按照医学规定遮住口、鼻等重要部位的情况。In a specific application, the mask image containing the user's face contour is processed by the mask-wearing recognition network model, and the detection result of whether the user corresponding to the face contour output by the mask-wearing recognition network model is standard wearing a mask is obtained. In order to improve the detection accuracy, the detection results are set to include the probability values of the user wearing a mask, the user wearing a mask, and the user not wearing a mask. Among them, the user's standard wearing of a mask refers to the situation where the user wears a mask according to medical regulations, and the user's non-standard wearing of a mask refers to the user wearing a mask, but not covering important parts such as the mouth and nose in accordance with medical regulations.
在一个实施例中,所述步骤S102,包括:In one embodiment, the step S102 includes:
将所述待识别图像输入人脸分割网络模型进行处理,获得包含人脸轮廓的掩码图像。The to-be-recognized image is input into the face segmentation network model for processing to obtain a mask image containing the outline of the face.
在具体应用中,将拍摄获得的待识别图像输入人脸分割网络模型,通过人脸分割网络模型对待识别图像进行处理,获得包含用户的人脸轮廓的掩码图像。其中,人脸分割网络模型包括但不限于语义分割(semantic segmentation)网络模型。In a specific application, the to-be-recognized image obtained by shooting is input into a face segmentation network model, and the to-be-recognized image is processed by the face segmentation network model to obtain a mask image containing the user's face contour. The face segmentation network model includes but is not limited to a semantic segmentation (semantic segmentation) network model.
在具体应用中,掩码图像中包含的人脸轮廓的区域可以根据实际需求进行设定。例如,上述人脸轮廓可以指整个人脸区域的轮廓,或者仅包含用于识别用户是否规范佩戴口罩的部分人脸区域的轮廓(一般情况下,识别用户是否规范佩戴口罩的区域为双眼以下的人脸区域)。In a specific application, the area of the face contour included in the mask image can be set according to actual needs. For example, the above-mentioned face contour may refer to the contour of the entire face area, or only include the contour of a part of the face area that is used to identify whether the user is wearing a mask properly (generally, the area that identifies whether the user is wearing a mask is under the eyes). face area).
如图2所示,在一个实施例中,所述步骤S103,包括:As shown in FIG. 2, in one embodiment, the step S103 includes:
S1031、通过佩戴口罩识别网络模型对所述掩码图像进行处理,获得所述佩戴口罩识别网络模型的输出结果;S1031, processing the mask image by wearing a mask recognition network model to obtain an output result of the mask wearing recognition network model;
S1032、根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。S1032. Determine, according to the output result, a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
在具体应用中,通过佩戴口罩识别网络模型对包含人脸轮廓的掩码图进行处理,获得佩戴口罩识别网络输出的用户是否佩戴口罩及是否规范佩戴口罩的概率值,根据上述输出结果确定与人脸轮廓对应的是否规范佩戴口罩的检测结果。其中,佩戴口罩识别网络模型包括但不限于卷积神经网络模型(Convolutional Neural Networks,CNN)。In the specific application, the mask map containing the face contour is processed through the mask-wearing recognition network model to obtain the probability value of whether the user outputted by the mask-wearing recognition network wears a mask and whether the mask is regulated. The detection result of whether the face contour corresponds to the standard wearing of the mask. Among them, the wearing mask recognition network model includes but is not limited to the convolutional neural network model (Convolutional Neural Network model). Networks, CNN).
在本实施例中,根据输出结果确定与人脸轮廓对应的用户是否规范佩戴口罩的检测结果,包括:In the present embodiment, the detection result of whether the user corresponding to the face contour is regulated wearing a mask is determined according to the output result, including:
确定佩戴口罩识别网络模型的输出结果中的最大概率值,根据最大概率值确定与人脸轮廓对应的用户是否规范佩戴口罩的检测结果。Determine the maximum probability value in the output result of the mask-wearing recognition network model, and determine whether the user corresponding to the face contour is wearing a mask according to the maximum probability value.
在一个实施例中,所述输出结果包括与所述人脸轮廓对应的用户规范佩戴口罩的第一概率值、与所述人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与所述人脸轮廓对应的用户未佩戴口罩的第三概率值。In one embodiment, the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour. The third probability value that the user corresponding to the face contour does not wear a mask.
在具体应用中,佩戴口罩识别网络模型的输出结果包括与人脸轮廓对应的用户规范佩戴口罩的第一概率值、与人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与人脸轮廓对应的用户未佩戴口罩的第三概率值。其中,第一概率值、第二概率值及第三概率值的总和为1。In a specific application, the output result of the mask-wearing recognition network model includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a face contour corresponding to the user wearing a mask. The third probability value of the user not wearing a mask corresponding to the contour. The sum of the first probability value, the second probability value and the third probability value is 1.
如图3所示,在一个实施例中,所述步骤S1032,包括:As shown in FIG. 3, in one embodiment, the step S1032 includes:
S10321、在检测到所述输出结果中,所述第一概率值大于所述第二概率值及所述第三概率值时,判定所述检测结果为所述用户规范佩戴口罩;S10321. When it is detected that in the output result, the first probability value is greater than the second probability value and the third probability value, determine that the detection result is that the user is wearing a mask according to specification;
S10322、在检测到所述输出结果中,所述第二概率值大于所述第一概率值及所述第三概率值时,判定所述检测结果为所述用户未规范佩戴口罩;S10322. When detecting that the second probability value is greater than the first probability value and the third probability value in the output result, determine that the detection result is that the user does not wear a mask in a standard manner;
S10323、在检测到所述输出结果中,所述第三概率值大于所述第一概率值及所述第二概率值时,判定所述检测结果为所述用户未佩戴口罩。S10323. When it is detected that in the output result, the third probability value is greater than the first probability value and the second probability value, determine that the detection result is that the user does not wear a mask.
在具体应用中,在检测到佩戴口罩识别网络模型的输出结果中,第一概率值大于第二概率值及第三概率值(也即检测到第一概率值最大)时,判定检测结果为用户规范佩戴口罩;在检测到输出结果中,第二概率值大于第一概率值及第三概率值(也即将检测到第二概率值最大)时,判定检测结果为用户未规范佩戴口罩;在检测到输出结果中,第三概率值大于第一概率值及第二概率值(也即检测到第三概率值最大)时,判定检测结果为用户未佩戴口罩。In a specific application, when it is detected that the output of the mask-wearing recognition network model, the first probability value is greater than the second probability value and the third probability value (that is, the first probability value is detected to be the largest), the detection result is determined to be the user Standardize wearing of masks; in the detected output results, when the second probability value is greater than the first probability value and the third probability value (that is, the second probability value is about to be detected to be the largest), it is determined that the test result is that the user does not wear masks properly; In the output result, when the third probability value is greater than the first probability value and the second probability value (that is, the third probability value is detected to be the largest), it is determined that the detection result is that the user does not wear a mask.
例如,检测到佩戴口罩识别网络模型的输出结果为[0.1,0.8,0.1]时,判定检测结果为用户未规范佩戴口罩。For example, when it is detected that the output result of the mask-wearing recognition network model is [0.1, 0.8, 0.1], it is determined that the detection result is that the user does not wear a mask properly.
在一个实施例中,所述方法,还包括:In one embodiment, the method further includes:
获取多个人脸图像数据;其中,所述人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据;Acquiring a plurality of face image data; wherein, the face image data includes face image data for wearing a mask, face image data for not wearing a mask, and face image data for not wearing a mask;
根据所述人脸分割网络模型对所述人脸图像数据进行处理,获得对应的掩码图像训练数据;Process the face image data according to the face segmentation network model to obtain corresponding mask image training data;
根据所述掩码图像训练数据对卷积神经网络模型进行预训练,获得所述佩戴口罩识别网络模型。The convolutional neural network model is pre-trained according to the mask image training data to obtain the mask-wearing recognition network model.
在具体应用中,获取大量的人脸图像数据,根据人脸分割网络模型对人脸图像数据进行处理,获得对应的包含人脸轮廓的掩码图像训练数据,通过掩码图像训练数据对卷积神经网络模型进行预训练,获得佩戴口罩识别网络模型,使佩戴口罩识别网络模型能够对输入的图像进行处理,获得对应的规范佩戴口罩的第一概率值、未规范佩戴口罩的第二概率值以及未佩戴口罩的第三概率值。其中,人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据。In a specific application, a large amount of face image data is obtained, the face image data is processed according to the face segmentation network model, and the corresponding mask image training data containing the face contour is obtained. The neural network model is pre-trained to obtain a mask-wearing recognition network model, so that the mask-wearing recognition network model can process the input image, and obtain the corresponding first probability value of wearing a mask, the second probability value of non-standard wearing a mask, and The third probability value for not wearing a mask. Among them, the face image data includes the face image data of standard wearing masks, the face image data of non-standard wearing masks, and the face image data of not wearing masks.
在本实施例中,根据人脸分割网络模型对人脸图像数据进行处理,获得对应的掩码图像训练数据之后,包括:根据每个人脸图像数据的类型对对应的掩码图像训练数据添加对应的标签,以便于根据人脸分割图像数据对卷积神经网络模型进行预训练。例如,在根据人脸分割网络模型对规范佩戴口罩的人脸图像数据进行处理,获得对应的掩码图像训练数据时,应对该掩码图像训练数据添加“规范佩戴口罩”的标签;在根据人脸分割网络模型对未规范佩戴口罩的人脸图像数据进行处理,获得对应的掩码图像训练数据时,应对该掩码图像训练数据添加“未规范佩戴口罩”的标签;在根据人脸分割网络模型对未佩戴口罩的人脸图像数据进行处理,获得对应的掩码图像训练数据时,应对该掩码图像训练数据添加“未佩戴口罩”的标签。In this embodiment, after processing the face image data according to the face segmentation network model and obtaining the corresponding mask image training data, the method includes: adding a corresponding mask image training data according to the type of each face image data labels to facilitate pre-training of convolutional neural network models based on face segmentation image data. For example, when processing the face image data that is regulated wearing masks according to the face segmentation network model, and obtaining the corresponding mask image training data, the mask image training data should be labeled as "regular wearing masks"; The face segmentation network model processes the face image data that does not wear masks in a standardized manner, and when obtaining the corresponding mask image training data, the mask image training data should be labeled as "non-standard wearing masks"; The model processes the face image data without a mask, and when the corresponding mask image training data is obtained, the mask image training data should be labeled "without a mask".
在一个实施例中,对语义分割网络模型进行预训练,包括:通过分割损失函数(如基于交叉熵的分割损失函数)计算损失,通过梯度下降算法将损失进行梯度反向传播,以更新计算语义分割网络模型中每一层的权重参数,直至整个语义分割网络模型收敛,获得预训练后的人脸分割网络模型。In one embodiment, pre-training the semantic segmentation network model includes: calculating the loss through a segmentation loss function (such as a segmentation loss function based on cross entropy), and performing gradient backpropagation on the loss through a gradient descent algorithm to update the computational semantics The weight parameters of each layer in the segmentation network model are obtained until the entire semantic segmentation network model converges, and the pre-trained face segmentation network model is obtained.
在一个实施例中,所述方法,还包括:In one embodiment, the method further includes:
获取训练图像数据;其中,所述训练图像数据为包含人脸的图像数据;Acquiring training image data; wherein, the training image data is image data comprising a human face;
通过所述训练图像数据对语义分割模型进行预训练,获得所述人脸分割网络模型。The semantic segmentation model is pre-trained through the training image data to obtain the face segmentation network model.
在具体应用中,获取大量的包含人脸的图像数据,作为训练图像数据,通过上述训练图像数据对语义分割网络模型进行预训练,获得人脸分割网络模型,使人脸分割网络模型在对输入的图像数据进行处理后,输出包含人脸轮廓的掩码图像。In a specific application, a large amount of image data containing faces is obtained as training image data, and the semantic segmentation network model is pre-trained through the above training image data to obtain a face segmentation network model, so that the face segmentation network model is used for input After processing the image data of , the mask image containing the outline of the face is output.
在一个实施例中,设定在分别对语义分割网络模型进行预训练,获得的人脸分割网络模型,及对卷积神经网络进行预训练,获得佩戴口罩识别网络模型和人脸分割网络模型后,将佩戴口罩识别网络模型嫁接至人脸分割网络模型上,合并成一个网络模型,需要说明的是,人脸分割网络模型的输出结果的大小应与佩戴口罩识别网络模型的输入数据的大小相同。其中,在预训练过程中,设定人脸分割网络模型的损失函数包括但不限于分割损失函数和分类损失函数,佩戴口罩的识别网络模型的损失函数包括但不限于分类损失函数。In one embodiment, it is set after pre-training the semantic segmentation network model, obtaining the face segmentation network model, and pre-training the convolutional neural network, and obtaining the mask-wearing recognition network model and the face segmentation network model. , graft the mask-wearing recognition network model to the face segmentation network model, and merge into one network model. It should be noted that the size of the output of the face-segmentation network model should be the same as the size of the input data of the mask-wearing recognition network model. . Among them, in the pre-training process, the loss function of the set face segmentation network model includes but is not limited to the segmentation loss function and the classification loss function, and the loss function of the mask-wearing recognition network model includes but is not limited to the classification loss function.
在一个实施例中,设定预先将语义分割网络模型与卷积神经网络模型融合成为一个网络模型,然后首先对该模型中的语义分割网络模型进行预训练,获得人脸分割网络模型后,再对该模型中的卷积神经网络模型进行预训练,获得卷积神经网络模型。In one embodiment, it is set that the semantic segmentation network model and the convolutional neural network model are pre-integrated into a network model, and then the semantic segmentation network model in the model is pre-trained, and after the face segmentation network model is obtained, then The convolutional neural network model in the model is pre-trained to obtain the convolutional neural network model.
如图4所示,在一个实施例中,所述步骤S103之后,还包括:As shown in FIG. 4, in one embodiment, after the step S103, it further includes:
S104、在检测到检测结果为所述用户未规范佩戴口罩或所述用户未佩戴口罩时,对所述待识别图像进行人脸识别,确定所述用户的人脸识别结果。S104, when the detection result is that the user does not wear a mask according to regulations or the user does not wear a mask, perform face recognition on the to-be-recognized image, and determine a face recognition result of the user.
在具体应用中,在检测到检测结果为用户未规范佩戴口罩或用户未佩戴口罩时,通过人脸识别算法对待识别图像进行人脸识别,确定待识别图像中用户的人脸识别结果,便于通知该用户规范佩戴口罩,并进行相应的后续处理。In specific applications, when it is detected that the user does not wear a mask in a standard manner or the user does not wear a mask, the face recognition algorithm is used to perform face recognition on the image to be recognized, and the face recognition result of the user in the image to be recognized is determined to facilitate notification. The user wears a mask according to regulations, and carries out corresponding follow-up treatment.
本实施例通过对待识别图像进行处理,获得包含人脸轮廓的掩码图像,并通过佩戴口罩检测网络模型对掩码图像进行检测,获得用户是否规范佩戴口罩的概率,从而判定用户是否规范佩戴口罩的检测结果,减小了计算量,提高了检测效率及检测结果的精度。In this embodiment, a mask image containing the outline of a human face is obtained by processing the image to be recognized, and the mask image is detected by a mask-wearing detection network model to obtain the probability of whether the user wears a mask properly, so as to determine whether the user wears a mask properly The detection result is reduced, the calculation amount is reduced, and the detection efficiency and the detection result accuracy are improved.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
对应于上文实施例所述的佩戴口罩的检测方法,图5示出了本申请实施例提供的佩戴口罩的检测装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the detection method for wearing a mask described in the above embodiment, FIG. 5 shows a structural block diagram of the detection device for wearing a mask provided by the embodiment of the present application. part.
在本实施例中,佩戴口罩的检测装置包括:处理器,其中,所述处理器用于执行存在存储器的以下程序模块:第一获取模块,用于获取待识别图像;图像处理模块,用于对待识别图像进行处理,获得包含人脸轮廓的掩码图像;检测模块,用于对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。In this embodiment, the detection device for wearing a mask includes: a processor, wherein the processor is used to execute the following program modules stored in the memory: a first acquisition module, used to acquire an image to be recognized; an image processing module, used to treat The identification image is processed to obtain a mask image containing the outline of the face; the detection module is used to process the mask image to obtain a detection result of whether the user corresponding to the face outline is wearing a mask in a standard manner.
参照图5,该佩戴口罩的检测装置100包括:5, the detection device 100 wearing a mask includes:
第一获取模块101,用于获取待识别图像;The first acquisition module 101 is used to acquire the image to be recognized;
图像处理模块102,用于对待识别图像进行处理,获得包含人脸轮廓的掩码图像;The image processing module 102 is used for processing the image to be recognized to obtain a mask image containing the outline of the human face;
检测模块103,用于对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。The detection module 103 is configured to process the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
在一个实施例中,所述图像处理模块102,包括:In one embodiment, the image processing module 102 includes:
第一处理单元,用于将所述待识别图像输入人脸分割网络模型进行处理,获得包含人脸轮廓的掩码图像。The first processing unit is configured to input the to-be-recognized image into a face segmentation network model for processing, and obtain a mask image including a face contour.
在一个实施例中,所述检测模块103,包括:In one embodiment, the detection module 103 includes:
第二处理单元,用于通过佩戴口罩识别网络模型对所述掩码图像进行处理,获得所述佩戴口罩识别网络模型的输出结果;a second processing unit, configured to process the mask image through the mask-wearing recognition network model to obtain an output result of the mask-wearing recognition network model;
确定单元,用于根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。A determination unit, configured to determine, according to the output result, a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
在一个实施例中,所述输出结果包括与所述人脸轮廓对应的用户规范佩戴口罩的第一概率值、与所述人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与所述人脸轮廓对应的用户未佩戴口罩的第三概率值。In one embodiment, the output result includes a first probability value corresponding to the face contour that the user wears a mask according to regulations, a second probability value corresponding to the face contour that the user does not wear a mask according to regulations, and a second probability value corresponding to the face contour. The third probability value that the user corresponding to the face contour does not wear a mask.
在一个实施例中,所述确定单元,包括:In one embodiment, the determining unit includes:
第一检测子单元,用于在检测到所述输出结果中,所述第一概率值大于所述第二概率值及所述第三概率值时,判定所述检测结果为所述用户规范佩戴口罩;a first detection subunit, configured to determine that the detection result is the user's standard wearing when it is detected that the first probability value is greater than the second probability value and the third probability value in the output result Face mask;
第二检测子单元,用于在检测到所述输出结果中,所述第二概率值大于所述第一概率值及所述第三概率值时,判定所述检测结果为所述用户未规范佩戴口罩;A second detection subunit, configured to determine that the detection result is that the user is not standardized when the second probability value is greater than the first probability value and the third probability value in the output result wear a mask;
第三检测子单元,用于在检测到所述输出结果中,所述第三概率值大于所述第一概率值及所述第二概率值时,判定所述检测结果为所述用户未佩戴口罩。A third detection sub-unit, configured to determine that the detection result is that the user is not wearing when the third probability value is greater than the first probability value and the second probability value in the output result Face mask.
在一个实施例中,所述佩戴口罩的检测装置100,还包括:In one embodiment, the detection device 100 for wearing a mask further includes:
第二获取模块,用于获取多个人脸图像数据;其中,所述人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据;The second acquisition module is used to acquire a plurality of face image data; wherein, the face image data includes face image data of standard wearing masks, face image data of non-standard wearing masks, and face image data of not wearing masks ;
预处理模块,用于根据所述人脸分割网络模型对所述人脸图像数据进行处理,获得对应的掩码图像训练数据;a preprocessing module, configured to process the face image data according to the face segmentation network model to obtain corresponding mask image training data;
第一训练模块,用于根据所述掩码图像训练数据对卷积神经网络模型进行预训练,获得所述佩戴口罩识别网络模型。The first training module is used to pre-train the convolutional neural network model according to the mask image training data to obtain the mask-wearing recognition network model.
在一个实施例中,所述佩戴口罩的检测装置100,还包括:In one embodiment, the detection device 100 for wearing a mask further includes:
第三获取模块,用于获取训练图像数据;其中,所述训练图像数据为包含人脸的图像数据;The third acquisition module is used for acquiring training image data; wherein, the training image data is image data including human faces;
第二训练模块,用于通过所述训练图像数据对语义分割模型进行预训练,获得所述人脸分割网络模型。The second training module is used for pre-training the semantic segmentation model through the training image data to obtain the face segmentation network model.
在一个实施例中,所述佩戴口罩的检测装置100,还包括:In one embodiment, the detection device 100 for wearing a mask further includes:
人脸识别模块,用于在检测到检测结果为所述用户未规范佩戴口罩或所述用户未佩戴口罩时,对所述待识别图像进行人脸识别,确定所述用户的人脸识别结果。The face recognition module is configured to perform face recognition on the to-be-recognized image and determine the user's face recognition result when the detection result is that the user does not wear a mask in a standard manner or the user does not wear a mask.
本实施例通过对待识别图像进行处理,获得包含人脸轮廓的掩码图像,并通过佩戴口罩检测网络模型对掩码图像进行检测,获得用户是否规范佩戴口罩的概率,从而判定用户是否规范佩戴口罩的检测结果,减小了计算量,提高了检测效率及检测结果的精度。In this embodiment, a mask image containing the outline of a human face is obtained by processing the image to be recognized, and the mask image is detected by a mask-wearing detection network model to obtain the probability of whether the user wears a mask properly, so as to determine whether the user wears a mask properly The detection result is reduced, the calculation amount is reduced, and the detection efficiency and the detection result accuracy are improved.
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information exchange, execution process and other contents between the above-mentioned devices/units are based on the same concept as the method embodiments of the present application. For specific functions and technical effects, please refer to the method embodiments section. It is not repeated here.
图6为本申请一实施例提供的终端设备的结构示意图。如图6所示,该实施例的终端设备6包括:至少一个处理器60(图6中仅示出一个)处理器、存储器61以及存储在所述存储器61中并可在所述至少一个处理器60上运行的计算机程序62,所述处理器60执行所述计算机程序62时实现上述任意各个佩戴口罩的检测方法实施例中的步骤。FIG. 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 6 , the terminal device 6 in this embodiment includes: at least one processor 60 (only one is shown in FIG. 6 ), a processor, a memory 61 , and a processor stored in the memory 61 and can be processed in the at least one processor The computer program 62 running on the processor 60, when the processor 60 executes the computer program 62, implements the steps in any of the above-mentioned embodiments of the detection method for wearing a mask.
所述终端设备6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的举例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。The terminal device 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, a processor 60 and a memory 61 . Those skilled in the art can understand that FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than the one shown, or combine some components, or different components , for example, may also include input and output devices, network access devices, and the like.
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),该处理器60还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 60 may be a central processing unit (Central Processing Unit, CPU), and the processor 60 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (Application Specific Integrated Circuits) Integrated Circuit, ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
所述存储器61在一些实施例中可以是所述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。所述存储器61在另一些实施例中也可以是所述终端设备6的外部存储设备,例如所述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字卡(Secure Digital, SD),闪存卡(Flash Card)等。所述存储器61还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器61用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器61还可以用于暂时地存储已经输出或者将要输出的数据。The memory 61 may be an internal storage unit of the terminal device 6 in some embodiments, such as a hard disk or a memory of the terminal device 6 . In other embodiments, the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital Card (Secure Digital, SD), Flash Card (Flash Card), etc. The memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 61 can also be used to temporarily store data that has been output or will be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated to different functional units, Module completion, that is, dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated in one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware. It can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working processes of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product, when the computer program product runs on a mobile terminal, the steps in the foregoing method embodiments can be implemented when the mobile terminal executes the computer program product.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may 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 can be implemented by a computer program to instruct the relevant hardware. The computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the above-mentioned various method embodiments may be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like. The computer-readable medium may include at least: any entity or device capable of carrying computer program codes to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media. For example, U disk, mobile hard disk, disk or CD, etc. In some jurisdictions, under legislation and patent practice, computer readable media may not be electrical carrier signals and telecommunications signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus/network device and method may be implemented in other manners. For example, the apparatus/network device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
以上仅为本申请的可选实施例而已,并不用于限制本申请。对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above are only optional embodiments of the present application, and are not intended to limit the present application. Various modifications and variations of this application are possible for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the scope of the claims of this application.

Claims (15)

  1. 一种佩戴口罩的检测方法,其特征在于,包括: A detection method for wearing a mask, comprising:
    获取待识别图像;Get the image to be recognized;
    对待识别图像进行处理,获得包含人脸轮廓的掩码图像;Process the image to be recognized to obtain a mask image containing the outline of the face;
    对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。The mask image is processed to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  2. 如权利要求1所述的佩戴口罩的检测方法,其特征在于,所述对待识别图像进行处理,获得包含人脸轮廓的掩码图像,包括: The detection method of wearing a mask as claimed in claim 1, wherein the described image to be recognized is processed to obtain a mask image comprising the outline of a human face, comprising:
    将所述待识别图像输入人脸分割网络模型进行处理,获得包含人脸轮廓的掩码图像。The to-be-recognized image is input into the face segmentation network model for processing to obtain a mask image containing the outline of the face.
  3. 如权利要求1所述的佩戴口罩的检测方法,其特征在于,所述对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果,包括: The detection method of wearing a mask as claimed in claim 1, wherein the processing of the mask image to obtain a detection result of whether the user corresponding to the face profile is standard wearing a mask, comprising:
    通过佩戴口罩识别网络模型对所述掩码图像进行处理,获得所述佩戴口罩识别网络模型的输出结果;The mask image is processed by the mask-wearing recognition network model to obtain the output result of the mask-wearing recognition network model;
    根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。According to the output result, the detection result of whether the user corresponding to the face contour is wearing a mask is determined.
  4. 如权利要求3所述的佩戴口罩的检测方法,其特征在于,所述输出结果包括与所述人脸轮廓对应的用户规范佩戴口罩的第一概率值、与所述人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与所述人脸轮廓对应的用户未佩戴口罩的第三概率值; The method for detecting wearing a mask according to claim 3, wherein the output result includes a first probability value of a user's standard wearing a mask corresponding to the face contour, and a user's unidentified mask corresponding to the face contour. Standardize the second probability value of wearing a mask and the third probability value of the user not wearing a mask corresponding to the face profile;
    所述根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果,包括:The detection result of determining whether the user corresponding to the profile of the human face is wearing a mask according to the output result, including:
    在检测到所述输出结果中,所述第一概率值大于所述第二概率值及所述第三概率值时,判定所述检测结果为所述用户规范佩戴口罩;When it is detected that in the output result, the first probability value is greater than the second probability value and the third probability value, it is determined that the detection result is that the user is wearing a mask according to specification;
    在检测到所述输出结果中,所述第二概率值大于所述第一概率值及所述第三概率值时,判定所述检测结果为所述用户未规范佩戴口罩;When it is detected that in the output result, the second probability value is greater than the first probability value and the third probability value, it is determined that the detection result is that the user does not wear a mask properly;
    在检测到所述输出结果中,所述第三概率值大于所述第一概率值及所述第二概率值时,判定所述检测结果为所述用户未佩戴口罩。When it is detected that in the output result, the third probability value is greater than the first probability value and the second probability value, it is determined that the detection result is that the user does not wear a mask.
  5. 如权利要求1至4任一项所述的佩戴口罩的检测方法,其特征在于,所述方法,还包括: The detection method of wearing a mask as claimed in any one of claims 1 to 4, wherein the method further comprises:
    获取多个人脸图像数据;其中,所述人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据;Acquiring a plurality of face image data; wherein, the face image data includes face image data for wearing a mask, face image data for not wearing a mask, and face image data for not wearing a mask;
    根据所述人脸分割网络模型对所述人脸图像数据进行处理,获得对应的掩码图像训练数据;Process the face image data according to the face segmentation network model to obtain corresponding mask image training data;
    根据所述掩码图像训练数据对卷积神经网络模型进行预训练,获得所述佩戴口罩识别网络模型。The convolutional neural network model is pre-trained according to the mask image training data to obtain the mask-wearing recognition network model.
  6. 如权利要求1至4任一项所述的佩戴口罩的检测方法,其特征在于,所述方法,还包括: The detection method of wearing a mask as claimed in any one of claims 1 to 4, wherein the method further comprises:
    获取训练图像数据;其中,所述训练图像数据为包含人脸的图像数据;Acquiring training image data; wherein, the training image data is image data comprising a human face;
    通过所述训练图像数据对语义分割模型进行预训练,获得所述人脸分割网络模型。The semantic segmentation model is pre-trained through the training image data to obtain the face segmentation network model.
  7. 如权利要求1至4任一项所述的佩戴口罩的检测方法,其特征在于,所述对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果之后,还包括: The detection method for wearing a mask according to any one of claims 1 to 4, wherein the mask image is processed to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard way After that, also include:
    在检测到检测结果为所述用户未规范佩戴口罩或所述用户未佩戴口罩时,对所述待识别图像进行人脸识别,确定所述用户的人脸识别结果。When it is detected that the detection result is that the user does not wear a mask in a standard manner or that the user does not wear a mask, face recognition is performed on the to-be-recognized image, and a face recognition result of the user is determined.
  8. 一种佩戴口罩的检测装置,其特征在于,包括: A detection device for wearing a mask, comprising:
    第一获取模块,用于获取待识别图像;a first acquisition module, used for acquiring the image to be recognized;
    图像处理模块,用于对待识别图像进行处理,获得包含人脸轮廓的掩码图像;The image processing module is used to process the to-be-recognized image to obtain a mask image containing the outline of the face;
    检测模块,用于对所述掩码图像进行处理,获得与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。The detection module is configured to process the mask image to obtain a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner.
  9. 如权利要求8所述的佩戴口罩的检测装置,其特征在于,所述图像处理模块,包括: The detection device for wearing a mask as claimed in claim 8, wherein the image processing module comprises:
    第一处理单元,用于将所述待识别图像输入人脸分割网络模型进行处理,获得包含人脸轮廓的掩码图像。The first processing unit is configured to input the to-be-recognized image into a face segmentation network model for processing, and obtain a mask image containing the outline of the face.
  10. 如权利要求8所述的佩戴口罩的检测装置,其特征在于,所述检测模块,包括: The detection device for wearing a mask as claimed in claim 8, wherein the detection module comprises:
    第二处理单元,用于通过佩戴口罩识别网络模型对所述掩码图像进行处理,获得所述佩戴口罩识别网络模型的输出结果;a second processing unit, configured to process the mask image by using a mask-wearing recognition network model to obtain an output result of the mask-wearing recognition network model;
    确定单元,用于根据所述输出结果确定与所述人脸轮廓对应的用户是否规范佩戴口罩的检测结果。A determination unit, configured to determine a detection result of whether the user corresponding to the face contour is wearing a mask in a standard manner according to the output result.
  11. 如权利要求10所述的佩戴口罩的检测装置,其特征在于,所述输出结果包括与所述人脸轮廓对应的用户规范佩戴口罩的第一概率值、与所述人脸轮廓对应的用户未规范佩戴口罩的第二概率值以及与所述人脸轮廓对应的用户未佩戴口罩的第三概率值; The detection device for wearing a mask according to claim 10, wherein the output result includes a first probability value of the user's standard wearing a mask corresponding to the face contour, and a user's unidentified mask corresponding to the face contour. Standardize the second probability value of wearing a mask and the third probability value of the user not wearing a mask corresponding to the face profile;
    所述确定单元,包括:The determining unit includes:
    第一检测子单元,用于在检测到所述输出结果中,所述第一概率值大于所述第二概率值及所述第三概率值时,判定所述检测结果为所述用户规范佩戴口罩;a first detection subunit, configured to determine that the detection result is the user's standard wearing when it is detected that the first probability value is greater than the second probability value and the third probability value in the output result Face mask;
    第二检测子单元,用于在检测到所述输出结果中,所述第二概率值大于所述第一概率值及所述第三概率值时,判定所述检测结果为所述用户未规范佩戴口罩;A second detection subunit, configured to determine that the detection result is that the user is not standardized when the second probability value is greater than the first probability value and the third probability value in the output result wear a mask;
    第三检测子单元,用于在检测到所述输出结果中,所述第三概率值大于所述第一概率值及所述第二概率值时,判定所述检测结果为所述用户未佩戴口罩。A third detection sub-unit, configured to determine that the detection result is that the user is not wearing when the third probability value is greater than the first probability value and the second probability value in the output result Face mask.
  12. 如权利要求8所述的佩戴口罩的检测装置,其特征在于,所述装置,还包括: The detection device for wearing a mask as claimed in claim 8, wherein the device further comprises:
    第二获取模块,用于获取多个人脸图像数据;其中,所述人脸图像数据包括规范佩戴口罩的人脸图像数据、未规范佩戴口罩的人脸图像数据及未佩戴口罩的人脸图像数据;The second acquisition module is used to acquire a plurality of face image data; wherein, the face image data includes face image data of standard wearing masks, face image data of non-standard wearing masks, and face image data of not wearing masks ;
    预处理模块,用于根据所述人脸分割网络模型对所述人脸图像数据进行处理,获得对应的掩码图像训练数据;a preprocessing module, configured to process the face image data according to the face segmentation network model to obtain corresponding mask image training data;
    第一训练模块,用于根据所述掩码图像训练数据对卷积神经网络模型进行预训练,获得所述佩戴口罩识别网络模型。The first training module is used to pre-train the convolutional neural network model according to the mask image training data to obtain the mask-wearing recognition network model.
  13. 如权利要求8所述的佩戴口罩的检测装置,其特征在于,所述装置,还包括: The detection device for wearing a mask as claimed in claim 8, wherein the device further comprises:
    第三获取模块,用于获取训练图像数据;其中,所述训练图像数据为包含人脸的图像数据;The third acquisition module is used to acquire training image data; wherein, the training image data is image data including human faces;
    第二训练模块,用于通过所述训练图像数据对语义分割模型进行预训练,获得所述人脸分割网络模型。The second training module is used for pre-training the semantic segmentation model through the training image data to obtain the face segmentation network model.
  14. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述的方法。 A terminal device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, when the processor executes the computer program, the process according to claim 1 to 7. The method of any one.
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的方法。A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
PCT/CN2021/074221 2021-01-28 2021-01-28 Method and apparatus for inspecting mask wearing, terminal device and readable storage medium WO2022160202A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202180000114.4A CN112912893A (en) 2021-01-28 2021-01-28 Detection method and device for wearing mask, terminal equipment and readable storage medium
PCT/CN2021/074221 WO2022160202A1 (en) 2021-01-28 2021-01-28 Method and apparatus for inspecting mask wearing, terminal device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/074221 WO2022160202A1 (en) 2021-01-28 2021-01-28 Method and apparatus for inspecting mask wearing, terminal device and readable storage medium

Publications (1)

Publication Number Publication Date
WO2022160202A1 true WO2022160202A1 (en) 2022-08-04

Family

ID=76109083

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/074221 WO2022160202A1 (en) 2021-01-28 2021-01-28 Method and apparatus for inspecting mask wearing, terminal device and readable storage medium

Country Status (2)

Country Link
CN (1) CN112912893A (en)
WO (1) WO2022160202A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115116122A (en) * 2022-08-30 2022-09-27 杭州魔点科技有限公司 Mask identification method and system based on double-branch cooperative supervision
CN116051467A (en) * 2022-12-14 2023-05-02 东莞市人民医院 Bladder cancer myolayer invasion prediction method based on multitask learning and related device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115619410B (en) * 2022-10-19 2024-01-26 闫雪 Self-adaptive financial payment platform

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010157073A (en) * 2008-12-26 2010-07-15 Fujitsu Ltd Device, method and program for recognizing face
CN111444869A (en) * 2020-03-31 2020-07-24 高新兴科技集团股份有限公司 Method and device for identifying wearing state of mask and computer equipment
CN111523476A (en) * 2020-04-23 2020-08-11 北京百度网讯科技有限公司 Mask wearing identification method, device, equipment and readable storage medium
CN111523380A (en) * 2020-03-11 2020-08-11 浙江工业大学 Mask wearing condition monitoring method based on face and posture recognition
CN112183471A (en) * 2020-10-28 2021-01-05 西安交通大学 Automatic detection method and system for standard wearing of epidemic prevention mask of field personnel

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111783601B (en) * 2020-06-24 2024-04-26 北京百度网讯科技有限公司 Training method and device of face recognition model, electronic equipment and storage medium
CN111931707A (en) * 2020-09-16 2020-11-13 平安国际智慧城市科技股份有限公司 Face image prediction method, device, equipment and medium based on countercheck patch
CN112052839B (en) * 2020-10-10 2021-06-15 腾讯科技(深圳)有限公司 Image data processing method, apparatus, device and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010157073A (en) * 2008-12-26 2010-07-15 Fujitsu Ltd Device, method and program for recognizing face
CN111523380A (en) * 2020-03-11 2020-08-11 浙江工业大学 Mask wearing condition monitoring method based on face and posture recognition
CN111444869A (en) * 2020-03-31 2020-07-24 高新兴科技集团股份有限公司 Method and device for identifying wearing state of mask and computer equipment
CN111523476A (en) * 2020-04-23 2020-08-11 北京百度网讯科技有限公司 Mask wearing identification method, device, equipment and readable storage medium
CN112183471A (en) * 2020-10-28 2021-01-05 西安交通大学 Automatic detection method and system for standard wearing of epidemic prevention mask of field personnel

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115116122A (en) * 2022-08-30 2022-09-27 杭州魔点科技有限公司 Mask identification method and system based on double-branch cooperative supervision
CN115116122B (en) * 2022-08-30 2022-12-16 杭州魔点科技有限公司 Mask identification method and system based on double-branch cooperative supervision
CN116051467A (en) * 2022-12-14 2023-05-02 东莞市人民医院 Bladder cancer myolayer invasion prediction method based on multitask learning and related device
CN116051467B (en) * 2022-12-14 2023-11-03 东莞市人民医院 Bladder cancer myolayer invasion prediction method based on multitask learning and related device

Also Published As

Publication number Publication date
CN112912893A (en) 2021-06-04

Similar Documents

Publication Publication Date Title
WO2022160202A1 (en) Method and apparatus for inspecting mask wearing, terminal device and readable storage medium
WO2021184727A1 (en) Data abnormality detection method and apparatus, electronic device and storage medium
WO2020143330A1 (en) Facial image capturing method, computer-readable storage medium and terminal device
WO2022037541A1 (en) Image processing model training method and apparatus, device, and storage medium
WO2020062493A1 (en) Image processing method and apparatus
WO2020186887A1 (en) Target detection method, device and apparatus for continuous small sample images
CN113705462B (en) Face recognition method, device, electronic equipment and computer readable storage medium
WO2022027913A1 (en) Target detection model generating method and apparatus, device and storage medium
WO2019119396A1 (en) Facial expression recognition method and device
WO2022127111A1 (en) Cross-modal face recognition method, apparatus and device, and storage medium
CN111860522B (en) Identity card picture processing method, device, terminal and storage medium
WO2021135603A1 (en) Intention recognition method, server and storage medium
CN111783626A (en) Image recognition method and device, electronic equipment and storage medium
WO2017079166A1 (en) High speed reference point independent database filtering for fingerprint identification
CN111062440A (en) Sample selection method, device, equipment and storage medium
CN112328822B (en) Picture pre-marking method and device and terminal equipment
CN113886443A (en) Log processing method and device, computer equipment and storage medium
CN116524206B (en) Target image identification method and device
WO2020244076A1 (en) Face recognition method and apparatus, and electronic device and storage medium
CN116130088A (en) Multi-mode face diagnosis method, device and related equipment
CN114913567A (en) Mask wearing detection method and device, terminal equipment and readable storage medium
CN115359575A (en) Identity recognition method and device and computer equipment
CN114864043A (en) Cognitive training method, device and medium based on VR equipment
CN111859985B (en) AI customer service model test method and device, electronic equipment and storage medium
CN110287943B (en) Image object recognition method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21921813

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21921813

Country of ref document: EP

Kind code of ref document: A1