Target detection method, device, electronic device and readable storage medium

By expanding the annotation area to include the facial features and neck region, and combining the SSD and MobileNet models, the problem of low accuracy in occluded face recognition was solved, achieving higher recognition accuracy.

CN112052746BActive Publication Date: 2024-11-15BEIJING DA MI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010827062.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-17
Publication Date
2024-11-15
Estimated Expiration
2040-08-17

AI Technical Summary

Technical Problem

In existing technologies, electronic devices have low accuracy in recognizing faces that are occluded.

Method used

By training an object detection model, the labeled area is expanded to include the facial features and neck region. Using the object detection algorithm SSD and the mobile neural network MobileNet, the facial features and neck region in the image are detected. By combining the non-maximum suppression algorithm and category probability screening, the recognition accuracy is improved.

Benefits of technology

Even when a face is partially obscured, the model can accurately distinguish between obscured faces and non-face images, thus improving the accuracy of face recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112052746B_ABST
    Figure CN112052746B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a target detection method, device, electronic device and readable storage medium, which relate to the field of computer technology. The trained target detection model can detect facial features and neck areas in an image. Even if the face in the target image is partially blocked, the trained target detection model can identify the target image as a face image through the neck area, that is, the trained target detection model can more accurately distinguish between blocked face images and non-face images. Thus, the accuracy of face recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a target detection method, device, electronic device and readable storage medium. Background Art

[0002] At present, with the development of artificial intelligence technology, face recognition technology is increasingly being applied to various scenarios.

[0003] In the prior art, an electronic device performs face recognition based on an acquired image, and the recognition result includes: a face is recognized or a face is not recognized.

[0004] If the image acquired by the electronic device includes a face, and the face is obscured (for example, wearing a mask, sunglasses, or a headscarf, etc.), the recognition result of the electronic device is that the face is not recognized. Therefore, the accuracy of face recognition in the prior art is low. Summary of the invention

[0005] In view of this, embodiments of the present invention provide a target detection method, device, electronic device and readable storage medium to improve the accuracy of face recognition.

[0006] In a first aspect, a target detection method is provided, the method being applied to an electronic device, the method comprising:

[0007] Get the target image;

[0008] Based on a pre-trained target detection model, detecting facial features and a neck region in the target image, wherein the pre-trained target detection model is trained based on at least a face sample image, and the annotated region of the face sample image includes at least a facial features and a neck region; and

[0009] Determine a target recognition result output by the pre-trained target detection model, wherein the target recognition result includes an image category and an image with target positioning information, wherein the image category includes a non-occluded face image, an occluded face image, and a non-face image, and the target positioning information is used to identify facial features and a neck area in the non-occluded face image and the occluded face image.

[0010] Optionally, the method further includes:

[0011] Acquire a training set, the training set comprising training sample images and annotations of the training sample images, the training sample images comprising the face sample images and non-face sample images, the annotations comprising non-occluded face annotations, occluded face annotations and non-face annotations, wherein the non-occluded face annotations are used to annotate the face sample images whose facial features are not obstructed, the occluded face annotations are used to annotate the face sample images whose facial features are partially obstructed, and the non-face annotations are used to annotate the non-face sample images; and

[0012] Based on the training set, a target detection model is trained.

[0013] Optionally, the training of the target detection model based on the training set includes:

[0014] The face sample images are used as positive samples, and the non-face sample images are used as negative samples to train the target detection model.

[0015] Optionally, the training of the target detection model includes:

[0016] Inputting the positive sample and the negative sample into the target detection model; and

[0017] The model parameters of the target detection model are updated according to the output of the target detection model and a preset loss function.

[0018] Optionally, the target detection model uses a target detection algorithm SSD as a model architecture and a mobile neural network MobileNet as a backbone network.

[0019] Optionally, the target positioning information includes a positioning frame, the target detection model includes a target positioning layer, and the target positioning layer is configured to perform: positioning the facial features area and the neck area in the feature map of the target scale by using the positioning frame;

[0020] The method further comprises:

[0021] Obtaining face images of target scale, and determining the aspect ratio of the face in each face image;

[0022] Performing a clustering operation on the aspect ratios of the faces in each face image to determine a clustering result of the aspect ratios of the faces; and

[0023] The clustering result is used as the aspect ratio of the positioning frame of the target positioning layer.

[0024] Optionally, determining the target recognition result output by the pre-trained target detection model includes:

[0025] Determine a first image output by the pre-trained object detection model, wherein the first image includes a plurality of positioning boxes;

[0026] Based on a preset non-maximum suppression algorithm, multiple positioning frames in the first image are screened to determine a second image, wherein the second image includes the screened positioning frames; and

[0027] The second image is used as the target recognition result.

[0028] Optionally, the method further includes:

[0029] Determining a plurality of category probabilities output by the pre-trained object detection model, each category probability corresponding to a preset category;

[0030] Based on the category probability of each preset category, the preset category with the largest category probability is used as the image category of the second image.

[0031] Optionally, the method further includes:

[0032] In response to the image category of the second image being a non-occluded face image or an occluded face image, displaying the filtered positioning frame in the second image; and

[0033] In response to the image category of the second image being a non-face image, hiding the filtered positioning frame.

[0034] In a second aspect, a target detection device is provided, the device is applied to an electronic device, and the device includes:

[0035] An acquisition module, used for acquiring a target image;

[0036] a detection module, configured to detect facial features and a neck region in the target image based on a pre-trained target detection model, wherein the pre-trained target detection model is trained based on at least a face sample image, and the annotated region of the face sample image includes at least a facial features and a neck region; and

[0037] A determination module is used to determine the target recognition result output by the pre-trained target detection model, the target recognition result includes an image category and an image with target positioning information, the image category includes a non-occluded face image, an occluded face image and a non-face image, and the target positioning information is used to identify the facial features area and the neck area in the non-occluded face image and the occluded face image.

[0038] Optionally, the device further comprises: a training module;

[0039] The acquisition module is further used to acquire a training set, wherein the training set includes training sample images and annotations of the training sample images, wherein the training sample images include the face sample images and non-face sample images, and the annotations include non-occluded face annotations, occluded face annotations and non-face annotations, wherein the non-occluded face annotations are used to annotate the face sample images whose facial features are not obstructed, the occluded face annotations are used to annotate the face sample images whose facial features are partially obstructed, and the non-face annotations are used to annotate the non-face sample images; and

[0040] The training module is used to train the target detection model based on the training set.

[0041] Optionally, the training module is specifically used for:

[0042] The face sample images are used as positive samples, and the non-face sample images are used as negative samples to train the target detection model.

[0043] Optionally, the training module is further used to:

[0044] Inputting the positive sample and the negative sample into the target detection model; and

[0045] The model parameters of the target detection model are updated according to the output of the target detection model and a preset loss function.

[0046] Optionally, the target detection model uses a target detection algorithm SSD as a model architecture and a mobile neural network MobileNet as a backbone network.

[0047] Optionally, the target positioning information includes a positioning frame, the target detection model includes a target positioning layer, and the target positioning layer is configured to perform: positioning the facial features area and the neck area in the feature map of the target scale by using the positioning frame;

[0048] The device also includes: a clustering module;

[0049] The acquisition module is further used to acquire face images of target scale and determine the aspect ratio of the face in each face image;

[0050] The clustering module is used to perform a clustering operation on the aspect ratios of the faces in each face image to determine a clustering result of the aspect ratios of the faces; and

[0051] The clustering module is further used to use the clustering result as the aspect ratio of the positioning frame of the target positioning layer.

[0052] Optionally, the determining module is specifically used to:

[0053] Determine a first image output by the pre-trained object detection model, wherein the first image includes a plurality of positioning boxes;

[0054] Based on a preset non-maximum suppression algorithm, multiple positioning frames in the first image are screened to determine a second image, wherein the second image includes the screened positioning frames; and

[0055] The second image is used as the target recognition result.

[0056] Optional,

[0057] The determination module is further used to determine multiple category probabilities output by the pre-trained object detection model, each category probability corresponding to a preset category; and

[0058] The determination module is further configured to use, based on the category probability of each preset category, a preset category with the largest category probability as the image category of the second image.

[0059] Optionally, the device further comprises: a display module and a hiding module;

[0060] The display module is configured to display the filtered positioning frame in the second image in response to the image category of the second image being a non-occluded face image or an occluded face image; and

[0061] The hiding module is used to hide the filtered positioning frame in response to the image category of the second image being a non-face image.

[0062] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.

[0063] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer program instructions, wherein the computer program instructions implement the method described in the first aspect when executed by a processor.

[0064] Through the embodiments of the present invention, since the training sample annotation area of ​​the target detection model includes at least the facial features area and the neck area, the trained target detection model can detect the facial features area and the neck area in the image. Even if the face in the target image is partially occluded, the trained target detection model can also identify the target image as a face image through the neck area, that is, the trained target detection model can more accurately distinguish between occluded face images and non-face images, thereby improving the accuracy of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The above and other objects, features and advantages of the embodiments of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0066] Figure 1 A flow chart of a target detection method provided by an embodiment of the present invention;

[0067] Figure 2 A schematic diagram of a marked area comparison provided by an embodiment of the present invention;

[0068] Figure 3 A flowchart of another target detection method provided by an embodiment of the present invention;

[0069] Figure 4 A schematic diagram of a target detection model provided by an embodiment of the present invention;

[0070] Figure 5 A schematic diagram of an image output by an output layer provided by an embodiment of the present invention;

[0071] Figure 6 A schematic diagram of the effect after non-maximum suppression provided by an embodiment of the present invention;

[0072] Figure 7 A schematic diagram of the structure of a target detection device provided by an embodiment of the present invention;

[0073] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0074] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the detailed description of the present invention below, some specific details are described in detail. It is possible for a person skilled in the art to fully understand the present invention without the description of these details. In order to avoid confusing the essence of the present invention, known methods, processes, flows, components and circuits are not described in detail.

[0075] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0076] Unless the context clearly requires otherwise, words such as “include”, “including” and the like in the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as meaning “including but not limited to”.

[0077] In the description of the present invention, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0078] An embodiment of the present invention provides a target detection method, which is applied to an electronic device, which may be a terminal or a server, wherein the terminal may be a smart phone, a tablet computer, or a personal computer (PC), etc., and the server may be a single server or a server cluster configured in a distributed manner.

[0079] The following will describe in detail a target detection method provided by an embodiment of the present invention in conjunction with a specific implementation manner. Figure 1 As shown, the specific steps are as follows:

[0080] In step 100, a target image is acquired.

[0081] In step 200, facial features and neck areas in the target image are detected based on a pre-trained target detection model.

[0082] The pre-trained target detection model is at least trained based on a face sample image, and the annotated area of ​​the face sample image includes at least a facial feature area and a neck area.

[0083] In step 300, the target recognition result output by the pre-trained target detection model is determined.

[0084] Among them, the target recognition results include image categories and images with target positioning information. The image categories include non-occluded face images, occluded face images and non-face images. The target positioning information is used to identify the facial features and neck areas in non-occluded face images and occluded face images.

[0085] Through the embodiments of the present invention, since the training sample annotation area of ​​the target detection model includes at least the facial features area and the neck area, the trained target detection model can detect the facial features area and the neck area in the image. Even if the face in the target image is partially occluded, the trained target detection model can also identify the target image as a face image through the neck area, that is, the trained target detection model can more accurately distinguish between occluded face images and non-face images, thereby improving the accuracy of face recognition.

[0086] Furthermore, if Figure 2 As shown, Figure 2 A schematic diagram of a comparison of marked areas provided by an embodiment of the present invention, Figure 2 It includes two virtual face schematic diagrams, a marked area a and a marked area b.

[0087] The marked area a is the marked area in the prior art, and the marked area b is the marked area in the embodiment of the present invention.

[0088] In the prior art, since the prior art only uses the facial features of a person as the annotation area (i.e., annotation area a), when the facial features of a person are partially blocked, the electronic device in the prior art will recognize the blocked face as a non-face.

[0089] In the embodiment of the present invention, compared with the marked area a, the lower boundary of the marked area b extends to the neck area, and the upper boundary extends to the forehead area. Since the scope of the marked area is expanded, even if the facial features of the face are partially blocked, the electronic device in the embodiment of the present invention can distinguish between the blocked face and non-face based on the features of the forehead, facial features and neck.

[0090] In an identity authentication scenario, face recognition is performed on face images based on a target detection model to perform identity authentication.

[0091] For example, in an online education scenario, the online education platform needs to perform facial recognition on teachers to verify their identities. During this process, teachers need to use terminal devices to take pictures of their own faces, and then the terminal devices will upload the captured teacher facial images to the education platform's server. After the education platform's server receives the teacher facial images sent by the terminal device, it will perform facial recognition on the teacher facial images and verify the teacher's identity based on the facial recognition results.

[0092] In the prior art, if the face in the teacher's face image is partially blocked, the server of the education platform will identify the teacher's face image as a non-face image (a non-face image is an image that does not contain a face), thereby causing the teacher's identity verification to fail.

[0093] Through the embodiments of the present invention, since the trained target detection model can more accurately distinguish between occluded face images and non-face images, even if the face in the teacher's face image is partially occluded, the server of the education platform can also identify the teacher's face image as an occluded face image (an occluded face image is an image in which the face is partially occluded), thereby allowing the identity review of the teacher to proceed smoothly.

[0094] Optional, such as Figure 3 As shown, the electronic device can also train the target detection model, and the specific process may include the following steps:

[0095] In step 400, a training set is obtained.

[0096] In step 500, an object detection model is trained based on a training set.

[0097] The training set includes training sample images and annotations of the training sample images. The training sample images include face sample images and non-face sample images. The annotations include non-occluded face annotations, occluded face annotations, and non-face annotations.

[0098] Unoccluded face annotation is used to annotate sample face images whose facial features are not obstructed, occluded face annotation is used to annotate sample face images whose facial features are partially obstructed, and non-face annotation is used to annotate sample non-face images.

[0099] Specifically, the process of training the target detection model by the electronic device can be performed as follows: taking the face sample images as positive samples and the non-face sample images as negative samples to train the target detection model.

[0100] Furthermore, the electronic device may input positive samples and negative samples into the target detection model; and update the model parameters of the target detection model according to the output of the target detection model and a preset loss function.

[0101] Among them, the loss function can map the output of the target detection model into a non-negative real number to represent the loss of the output.

[0102] The target detection model may include multiple mathematical models, such as convolution operation. The formula of convolution operation can be expressed as Conv(I, W)=O, where I represents the input matrix, O represents the output matrix, and W represents the weight.

[0103] The variables in the mathematical model can be the image data of the target image, and the invariants in the mathematical model (such as weight parameters) can be used as model parameters. When the electronic device trains the target detection model, the model parameters can be updated based on a preset loss function to make the target detection model converge.

[0104] It should be noted that since both non-occluded faces and occluded faces are faces, a standard is needed to label non-occluded faces and occluded faces in practical applications.

[0105] Furthermore, the embodiment of the present invention provides a standard for non-occluded faces and occluded faces, which can be used to label non-occluded face image samples and occluded face image samples. The specific standard is shown in Table 1 below:

[0106] Table 1

[0107] Facial information in face images Classification of face images Human face with beard Unoccluded face image Face of a person wearing glasses (glasses are not sunglasses) Unoccluded face image Hair covers less than or equal to 10% of the face Unoccluded face image Hair covers more than 10% of the face Blocking face images Face with bangs Unoccluded face image Human face with facial decoration Blocking face images Face obscured by facial decorations Blocking face images The face of a person is covered by a doll Blocking face images Human face obscured by animals Blocking face images Face covered by hands Blocking face images Face obscured by headphones Blocking face images Face obscured by a water cup Blocking face images Face obscured by hat Blocking face images Face with sunglasses Blocking face images Human face wearing mask Blocking face images

[0108] It should be noted that the content shown in the above Table 1 is an exemplary description made for an embodiment of the present invention. The facial information in Table 1 includes more than the items listed in Table 1. The embodiment of the present invention does not limit the items of the facial information in Table 1.

[0109] Through the embodiments of the present invention, since the training set obtained by the electronic device includes non-occluded face image samples and occluded face image samples, the classification granularity of the training samples is finer, so that the trained target detection model can accurately identify occluded faces. At the same time, since the annotation area of ​​the face image samples is changed from the traditional facial features area to the facial features plus neck area, the trained target detection model can more accurately distinguish between occluded face images and non-face images.

[0110] In combination with the above-mentioned electronic device for target detection and model training process, in an embodiment of the present invention, the target detection model uses a target detection algorithm (Single Shot MultiBox Detector, SSD) as the model architecture and a mobile neural network (MobileNet) as the backbone network.

[0111] Among them, SSD is an algorithm for object detection based on deep learning, which can accurately detect targets in images through multi-scale feature maps.

[0112] MobileNet is a lightweight network model. Compared with other network models, MobileNet has fewer model parameters, which can shorten the calculation time of electronic devices and thus make the speed of face recognition of electronic devices faster.

[0113] In an optional embodiment, the target positioning information includes a positioning frame (anchor), the target detection model includes a target positioning layer, and the target positioning layer is configured to locate the facial features area and the neck area in the feature map of the target scale through the positioning frame.

[0114] like Figure 4 As shown, Figure 4 A schematic diagram of a target detection model provided for an embodiment of the present invention, wherein the target detection model includes: an input layer, an output layer and n convolutional layers (convolutional layer 1 to convolutional layer n).

[0115] Specifically, in convolutional layers 1 to n, convolutional layers a, b, c, d, e and n are positioning layers, where Figure 3 As shown, convolution layer a, convolution layer b, convolution layer c, convolution layer d, convolution layer e and convolution layer n are not multiple continuous positioning layers. The positioning layer can locate the face to be detected in the feature map of the positioning layer according to a positioning frame preset for the positioning layer.

[0116] In practical applications, the electronic device can obtain face images of the target scale, determine the aspect ratio of the face (face area plus neck area) in each face image; perform clustering operations on the aspect ratios of the faces in each face image to determine the clustering results of the aspect ratios of the faces; and use the clustering results as the aspect ratio of the positioning frame of the target positioning layer.

[0117] Among them, since the width-to-height ratio of each face in reality is different, the embodiment of the present invention can set a more reasonable positioning frame aspect ratio by clustering. Since the aspect-to-height ratio of the positioning frame has a great influence on the model accuracy of the target detection model, the model accuracy of the target detection model can be improved through the embodiment of the present invention.

[0118] Furthermore, the electronic device can input the target image (such as a non-occluded face image, a face image or a non-face image) into the input layer of the target detection model, and then the target detection model can determine the feature map of the target image through a convolution operation, and then each positioning layer can determine a positioning frame according to the feature map in the positioning layer to locate the face to be detected, and then the output layer can display the positioning frames determined by each positioning layer in the target image and output it.

[0119] For example, Figure 5 As shown, Figure 5 A schematic diagram of an image output by an output layer provided in an embodiment of the present invention, the schematic diagram includes: positioning frame 1, positioning frame 2, positioning frame 3 and positioning frame 4.

[0120] exist Figure 5 In the figure, each positioning box is used to represent the positioning of the face by different positioning layers in the target detection model.

[0121] It should be noted that the number of positioning boxes is related to the number of positioning layers in the target detection model, for example, Figure 4 The target detection model shown in Figure 2 includes six localization layers. Figure 4 The image output by the target detection model shown in FIG. 1 may include six positioning boxes, and in order to explain the embodiment of the present invention clearly, Figure 5 Only four positioning boxes are shown in the figure, and the embodiment of the present invention does not limit the number of positioning layers in the target detection model.

[0122] Optionally, the electronic device can also determine the most preferred positioning frame from multiple positioning frames based on a non-maximum suppression (NMS) algorithm. The process can specifically be: determining a first image output by a pre-trained target detection model, wherein the first image includes multiple positioning frames; based on a preset non-maximum suppression algorithm, screening multiple positioning frames in the first image to determine a second image; and using the second image as a target recognition result.

[0123] The second image includes the filtered positioning frame.

[0124] In practical applications, each positioning frame may correspond to a confidence score. The electronic device may suppress the positioning frames with low confidence scores and select the positioning frames with high confidence scores based on the NMS algorithm to select the positioning frame with the highest probability of locating a face.

[0125] For example, Figure 6 As shown, Figure 6 A schematic diagram of the effect after non-maximum suppression provided by an embodiment of the present invention, wherein: Figure 6 The schematic diagram shown is an electronic device for Figure 5 A schematic diagram of the effect after NMS is performed, the schematic diagram includes a positioning frame 3.

[0126] exist Figure 5 If the score of positioning frame 1 is 0.7, the score of positioning frame 2 is 0.8, the score of positioning frame 3 is 0.95, and the score of positioning frame 4 is 0.7, the electronic device can determine that positioning frame 3 is the most preferred positioning frame among positioning frame 1, positioning frame 2, positioning frame 3 and positioning frame 4 based on NMS.

[0127] The final effect is as follows Figure 6 As shown, since the electronic device can suppress positioning frame 1, positioning frame 2 and positioning frame 4 based on NMS, the face image after NMS only includes positioning frame 3.

[0128] Optionally, the electronic device can also determine the image category of the second image. Specifically, the electronic device can determine multiple category probabilities output by a pre-trained target detection model; and based on the category probability of each preset category, take the preset category with the largest category probability as the image category of the second image.

[0129] Among them, each category probability corresponds to a preset category.

[0130] For example, the preset categories may include: non-occluded face images, occluded face images, and non-face images. When the target detection model detects the target image, the target detection model can output a category probability for each preset category, where the sum of the category probabilities is 1.

[0131] If the category probability of the non-occluded face image is 0.9, the category probability of the occluded face image is 0.06, and the category probability of the non-face image is 0.04, the electronic device may use the non-occluded face image as the image category of the target image.

[0132] In summary, after the electronic device determines the second image and the image category of the second image, it can display the filtered positioning box in the second image in response to the image category of the second image being a non-occluded face image or an occluded face image; and hide the filtered positioning box in response to the image category of the second image being a non-face image.

[0133] In actual applications, the target image may be an image containing a face or an image not containing a face. Therefore, when the image category of the target image is a non-face image, the electronic device can hide the filtered positioning box in the second image to make the classification effect more obvious.

[0134] Based on the same technical concept, the embodiment of the present invention also provides a target detection device, such as Figure 7 As shown, the device includes: an acquisition module 71, a detection module 72 and a determination module 73;

[0135] An acquisition module 71, used for acquiring a target image;

[0136] A detection module 72, configured to detect facial features and a neck region in a target image based on a pre-trained target detection model, wherein the pre-trained target detection model is at least trained based on a face sample image, and the annotated region of the face sample image at least includes the facial features and the neck region; and

[0137] Determination module 73 is used to determine the target recognition result output by the pre-trained target detection model, the target recognition result includes image categories and images with target positioning information, the image categories include non-occluded face images, occluded face images and non-face images, and the target positioning information is used to identify the facial features and neck areas in the non-occluded face images and occluded face images.

[0138] Optionally, the device further comprises: a training module;

[0139] The acquisition module 71 is further used to acquire a training set, the training set includes training sample images and annotations of the training sample images, the training sample images include face sample images and non-face sample images, the annotations include non-occluded face annotations, occluded face annotations, and non-face annotations, wherein the non-occluded face annotations are used to annotate face sample images whose facial features are not obstructed, the occluded face annotations are used to annotate face sample images whose facial features are partially obstructed, and the non-face annotations are used to annotate non-face sample images; and

[0140] The training module is used to train the target detection model based on the training set.

[0141] Optionally, the training module is specifically used for:

[0142] The face sample images are used as positive samples and the non-face sample images are used as negative samples to train the object detection model.

[0143] Optionally, the training module is further used for:

[0144] Input positive and negative samples into the object detection model; and

[0145] According to the output of the target detection model and the preset loss function, the model parameters of the target detection model are updated.

[0146] Optionally, the target detection model uses the target detection algorithm SSD as the model architecture and the mobile neural network MobileNet as the backbone network.

[0147] Optionally, the target positioning information includes a positioning frame, the target detection model includes a target positioning layer, and the target positioning layer is configured to perform: positioning the facial features region and the neck region in the feature map of the target scale by using the positioning frame;

[0148] The device also includes: a clustering module;

[0149] The acquisition module 71 is also used to acquire a face image of a target scale and determine the aspect ratio of the face in each face image;

[0150] A clustering module, used for performing a clustering operation on the aspect ratios of the faces in each face image, and determining a clustering result of the aspect ratios of the faces; and

[0151] The clustering module is also used to use the clustering results as the aspect ratio of the positioning box of the target positioning layer.

[0152] Optionally, the determination module 73 is specifically configured to:

[0153] Determine a first image output by a pre-trained object detection model, wherein the first image includes a plurality of positioning boxes;

[0154] Based on a preset non-maximum suppression algorithm, multiple positioning frames in the first image are screened to determine a second image, where the second image includes the screened positioning frames; and

[0155] The second image is used as the target recognition result.

[0156] Optional,

[0157] The determination module 73 is further used to determine multiple category probabilities output by the pre-trained object detection model, each category probability corresponding to a preset category; and

[0158] The determination module 73 is further configured to use, based on the category probability of each preset category, the preset category with the largest category probability as the image category of the second image.

[0159] Optionally, the device further comprises: a display module and a hiding module;

[0160] A display module, configured to display the filtered positioning frame in the second image in response to the image category of the second image being a non-occluded face image or an occluded face image; and

[0161] The hiding module is used to hide the filtered positioning frame in response to the image category of the second image being a non-face image.

[0162] Through the embodiments of the present invention, since the training sample annotation area of ​​the target detection model includes at least the facial features area and the neck area, the trained target detection model can detect the facial features area and the neck area in the image. Even if the face in the target image is partially occluded, the trained target detection model can also identify the target image as a face image through the neck area, that is, the trained target detection model can more accurately distinguish between occluded face images and non-face images, thereby improving the accuracy of face recognition.

[0163] Figure 8 Schematic diagram of an electronic device according to an embodiment of the present invention. Figure 8 As shown, Figure 8 The electronic device shown is a general address query device, which includes a general computer hardware structure, which at least includes a processor 81 and a memory 82. The processor 81 and the memory 82 are connected via a bus 83. The memory 82 is suitable for storing instructions or programs executable by the processor 81. The processor 81 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 81 executes the instructions stored in the memory 82, thereby executing the method flow of the embodiment of the present invention as described above to realize the processing of data and the control of other devices. The bus 83 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 84 and the display device and the input / output (I / O) device 85. The input / output (I / O) device 85 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 85 is connected to the system via an input / output (I / O) controller 86.

[0164] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, devices (equipment) or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0165] The present invention is described with reference to flowcharts of methods, apparatuses (devices) and computer program products according to embodiments of the present invention. It should be understood that each process in the flowchart can be implemented by computer program instructions.

[0166] These computer program instructions may be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device that implements the process Figure 1 A function specified in a process or multiple processes.

[0167] These computer program instructions may also be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the instructions for implementing the process Figure 1 A device that specifies functions in a process or multiple processes.

[0168] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.

[0169] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several designated devices (which can be single-chip microcomputers, chips, etc.) or processors (processors) to perform all or part of the steps of the methods described in the embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0170] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A target detection method, characterized in that: The method comprises: Get the target image; Based on a pre-trained target detection model, detecting facial features and a neck region in the target image, wherein the pre-trained target detection model is trained based on at least a face sample image, and the annotated region of the face sample image includes at least a facial features and a neck region, so that when the face portion of the target image is blocked, the pre-trained target detection model identifies the target image as a face image through the neck region; and Determine a target recognition result output by the pre-trained target detection model, wherein the target recognition result includes an image category and an image with target positioning information, wherein the image category includes a non-occluded face image, an occluded face image, and a non-face image, and the target positioning information is used to identify facial features and a neck area in the non-occluded face image and the occluded face image; The target positioning information includes a positioning frame, the target detection model includes a target positioning layer, and the target positioning layer is configured to perform: positioning the facial features area and the neck area in the feature map of the target scale by using the positioning frame; The method further comprises: Obtaining face images of target scale, and determining the aspect ratio of the face in each face image; Performing a clustering operation on the aspect ratios of the faces in each face image to determine a clustering result of the aspect ratios of the faces; and Using the clustering result as the aspect ratio of the positioning frame of the target positioning layer; The determining of the target recognition result output by the pre-trained target detection model includes: Determine a first image output by the pre-trained object detection model, wherein the first image includes a plurality of positioning boxes; Based on a preset non-maximum suppression algorithm, multiple positioning frames in the first image are screened to determine a second image, wherein the second image includes the screened positioning frames; and Using the second image as the target recognition result; Determining a plurality of category probabilities output by the pre-trained object detection model, each category probability corresponding to a preset category; Based on the category probability of each preset category, taking the preset category with the largest category probability as the image category of the second image; In response to the image category of the second image being a non-occluded face image or an occluded face image, displaying the filtered positioning frame in the second image; In response to the image category of the second image being a non-face image, hiding the filtered positioning frame.

2. The method according to claim 1, characterized in that The method further comprises: Acquire a training set, the training set comprising training sample images and annotations of the training sample images, the training sample images comprising the face sample images and non-face sample images, the annotations comprising non-occluded face annotations, occluded face annotations and non-face annotations, wherein the non-occluded face annotations are used to annotate the face sample images whose facial features are not obstructed, the occluded face annotations are used to annotate the face sample images whose facial features are partially obstructed, and the non-face annotations are used to annotate the non-face sample images; and Based on the training set, a target detection model is trained.

3. The method according to claim 2, characterized in that The step of training the target detection model based on the training set includes: The face sample images are used as positive samples, and the non-face sample images are used as negative samples to train the target detection model.

4. The method according to claim 3, characterized in that The training of the target detection model comprises: Inputting the positive sample and the negative sample into the target detection model; and The model parameters of the target detection model are updated according to the output of the target detection model and a preset loss function.

5. The method according to any one of claims 1 to 4, characterized in that: The target detection model uses the target detection algorithm SSD as the model architecture and the mobile neural network MobileNet as the backbone network.

6. A target detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a target image; a detection module, configured to detect facial features and a neck region in the target image based on a pre-trained target detection model, wherein the pre-trained target detection model is trained based on at least a sample face image, wherein the labeled region of the sample face image includes at least the facial features and the neck region, so that when the face in the target image is partially blocked, the pre-trained target detection model identifies the target image as a face image through the neck region; and A determination module is used to determine the target recognition result output by the pre-trained target detection model, wherein the target recognition result includes an image category and an image with target positioning information, wherein the image category includes a non-occluded face image, an occluded face image, and a non-face image, and the target positioning information is used to identify the facial features and the neck region in the non-occluded face image and the occluded face image; the target positioning information includes a positioning frame, and the target detection model includes a target positioning layer, and the target positioning layer is configured to perform: positioning the facial features and the neck region in the feature map of the target scale by using the positioning frame; The determining module is also used for: Obtaining face images of target scale, and determining the aspect ratio of the face in each face image; Performing a clustering operation on the aspect ratios of the faces in each face image to determine a clustering result of the aspect ratios of the faces; and Using the clustering result as the aspect ratio of the positioning frame of the target positioning layer; The determining module is also used for: Determine a first image output by the pre-trained object detection model, wherein the first image includes a plurality of positioning boxes; Based on a preset non-maximum suppression algorithm, multiple positioning frames in the first image are screened to determine a second image, wherein the second image includes the screened positioning frames; and Using the second image as the target recognition result; Determining a plurality of category probabilities output by the pre-trained object detection model, each category probability corresponding to a preset category; Based on the category probability of each preset category, taking the preset category with the largest category probability as the image category of the second image; In response to the image category of the second image being a non-occluded face image or an occluded face image, displaying the filtered positioning frame in the second image; In response to the image category of the second image being a non-face image, hiding the filtered positioning frame.

7. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.