Face image detection method, device, electronic device and computer readable medium
By using drone to shoot images in face detection, combined with sliding window, direction gradient histogram features and support vector machine technical means, the problem of insufficient effective pixels in face detection is solved, and the accuracy of detection is improved Sex and efficiency.
Patent Information
- Application Number
- CN202111484956.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-07
AI Technical Summary
In face detection, there are fewer effective pixels in the face area in the image taken by the drone, resulting in smaller effective pixels after scaling, and missed detection or false detection may occur, and the large specifications of the original image will lead to an increase in the calculation amount.
By controlling the drone to take images in a top shot, use sliding windows to traverse the image area, generate direction gradient histogram features, use support vector machine to perform classification processing, and perform non-maximum suppression processing, and finally input the target image. Pre-trained face detection model to obtain position information of face area.
It effectively solves the problem of missed detection or misdetection caused by insufficient effective pixels in face detection, and avoids the increase in calculation volume caused by large original image specifications, improving the accuracy and efficiency of face image detection.
Smart Images

Figure CN114120423B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a face image detection method, device, electronic device, and computer-readable medium. Background Art
[0002] Face detection is a technology that identifies the face area in an image and outputs the location of the face area in the image. When performing face detection, the image is usually preprocessed, scaled to a fixed size, and then input into the network for detection.
[0003] However, when the above method is adopted, the following technical problems often occur:
[0004] First, there are fewer effective pixels in the face area of the image taken by the drone. After the image is scaled, the effective pixels in the face area are even smaller, which may cause missed detection or false detection, resulting in a low detection rate of face images. At the same time, if the image is not scaled, the computer calculation amount will increase due to the large size of the original image.
[0005] Second, since the postures and movements of pedestrians in the captured pedestrian images are random, and the lighting and geometric shapes of different areas in the pedestrian images vary, it is difficult to accurately extract the features within the image area, which makes it difficult to accurately divide the image area. Summary of the invention
[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0007] Some embodiments of the present disclosure propose a facial image detection method, an apparatus, an electronic device, and a computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0008] In a first aspect, some embodiments of the present disclosure provide a face image detection method, the method comprising: controlling a drone to take images in a bird's-eye view manner to obtain a pedestrian image, wherein the pedestrian image includes a face area; using a sliding window to perform region traversal on the pedestrian image to obtain a pedestrian detection image, wherein the pedestrian detection image includes multiple initial candidate frames; determining the directional gradient histogram features of the area selected by each of the multiple initial candidate frames included in the pedestrian detection image to generate a histogram feature to obtain a pedestrian feature image, wherein the pedestrian feature image includes multiple histogram features; using a support vector machine to classify the multiple histogram features included in the pedestrian feature image to obtain a classification result; in response to determining that the classification result meets a preset condition, performing non-maximum suppression processing on the pedestrian feature image to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame; performing image segmentation processing according to the target candidate frame included in the image to be segmented to obtain a target pedestrian image; inputting the target pedestrian image into a pre-trained face detection model to obtain location information of the face area of the target pedestrian image.
[0009] In a second aspect, some embodiments of the present disclosure provide a face image detection device, the device comprising: a control unit, configured to control a drone to take images in a bird's-eye view manner to obtain a pedestrian image, wherein the pedestrian image includes a face area; a region traversal unit, configured to use a sliding window to perform region traversal on the pedestrian image to obtain a pedestrian detection image, wherein the pedestrian detection image includes multiple initial candidate frames; a determination unit, configured to determine the directional gradient histogram features of the area selected by each initial candidate frame in the multiple initial candidate frames included in the pedestrian detection image to generate a histogram feature, and obtain a pedestrian feature image, wherein the pedestrian feature image includes multiple histograms. Features; a classification processing unit, configured to use a support vector machine to perform classification processing on the multiple histogram features included in the above-mentioned pedestrian feature image to obtain a classification result; a non-maximum suppression processing unit, configured to perform non-maximum suppression processing on the above-mentioned pedestrian feature image in response to determining that the above-mentioned classification result meets a preset condition to obtain an image to be segmented, wherein the above-mentioned image to be segmented includes a target candidate frame; an image segmentation processing unit, configured to perform image segmentation processing according to the target candidate frame included in the above-mentioned image to be segmented to obtain a target pedestrian image; an input unit, configured to input the above-mentioned target pedestrian image into a pre-trained face detection model to obtain the position information of the face area of the above-mentioned target pedestrian image.
[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: by detecting the position information of the face area through the face image detection method of some embodiments of the present disclosure, the problem of large amount of calculation caused by detecting the original image is solved, and the situation of missed detection or false detection is avoided due to the small effective pixels of the face area caused by scaling the image. Specifically, the reason for the low detection rate and large amount of calculation of the face image is that the effective pixels of the face area in the image taken by the drone are small, and after scaling the image, the effective pixels of the face area are smaller, so that missed detection or false detection may occur. If the image is not scaled, the size of the original image is large. Based on this, the face image detection method of some embodiments of the present disclosure, first, can control the drone to shoot the image in a bird's-eye view mode to obtain a pedestrian image, wherein the pedestrian image includes the face area. Thus, a pedestrian image including the face area can be obtained, and the effective pixels of the face area in the pedestrian image are small, and the proportion of the pedestrian image is small. The drone shooting can provide a data basis for the detection of the face image. Then, the pedestrian image can be traversed by a sliding window to obtain a pedestrian detection image, wherein the pedestrian detection image includes a plurality of initial candidate frames. Thus, the region in the pedestrian image can be preliminarily divided. Afterwards, the directional gradient histogram features of the region selected by each initial candidate frame in the plurality of initial candidate frames included in the pedestrian detection image can be determined to generate a histogram feature to obtain a pedestrian feature image, wherein the pedestrian feature image includes a plurality of histogram features. Since the number of valid pixels of pedestrians is greater than that of faces, the features of each region divided by the sliding window can be accurately determined. Then, the plurality of histogram features included in the pedestrian feature image can be classified by a support vector machine to obtain a classification result. Thus, it can be accurately determined whether each region belongs to a face region or a background region. Then, in response to determining that the classification result meets a preset condition, the pedestrian feature image can be subjected to non-maximum suppression processing to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame. Thus, invalid initial candidate frames can be eliminated to obtain a target candidate frame including a face region. Afterwards, image segmentation processing can be performed according to the target candidate frame included in the above image to be segmented to obtain the target pedestrian image. In this way, the target pedestrian image can be separated from the pedestrian image, so that the amount of computer calculation can be reduced in subsequent calculations. Finally, the above target pedestrian image is input into a pre-trained face detection model to obtain the position information of the face area of the above target pedestrian image. In this way, by quickly locating the position of the pedestrian in the pedestrian image, the target candidate frame including the pedestrian is segmented from the pedestrian image, and then directly input into the pre-trained face detection model.That is, it solves the problem of large amount of calculation caused by inputting the original image, and at the same time avoids the situation that the effective pixels in the face area are smaller due to scaling the original image, thereby causing missed detection or false detection, resulting in a low detection rate of face images. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0014] Figure 1 is a schematic diagram of an application scenario of a face image detection method according to some embodiments of the present disclosure;
[0015] Figure 2 is a flow chart of some embodiments of the face image detection method according to the present disclosure;
[0016] Figure 3 is a schematic structural diagram of some embodiments of the face image detection device according to the present disclosure;
[0017] Figure 4 It is a structural schematic diagram of an electronic device according to the face image detection method disclosed in the present invention. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0024] Figure 1 It is a schematic diagram of an application scenario of a face image detection method according to some embodiments of the present disclosure.
[0025] exist Figure 1 In the application scenario, first, the computing device 101 can control the drone to take images in a bird's-eye view manner to obtain a pedestrian image 102, wherein the pedestrian image 102 includes a face area. Afterwards, the computing device 101 can use a sliding window to traverse the area of the pedestrian image 102 to obtain a pedestrian detection image 103, wherein the pedestrian detection image 103 includes multiple initial candidate boxes. Next, the computing device 101 can determine the directional gradient histogram features of the area selected by each initial candidate box in the multiple initial candidate boxes included in the pedestrian detection image 103 to generate a histogram feature to obtain a pedestrian feature image 104, wherein the pedestrian feature image 104 includes multiple histogram features. Then, the computing device 101 can use a support vector machine to classify the multiple histogram features included in the pedestrian feature image 104 to obtain a classification result 105. Afterwards, in response to determining that the classification result 105 satisfies the preset conditions, the computing device 101 may perform non-maximum suppression processing on the pedestrian feature image to obtain an image to be segmented 106, wherein the image to be segmented 106 includes a target candidate frame. Then, the computing device 101 may perform image segmentation processing according to the target candidate frame included in the image to be segmented 106 to obtain a target pedestrian image 107. Finally, the computing device 101 may input the target pedestrian image 107 into a pre-trained face detection model 108 to obtain the location information 109 of the face area of the target pedestrian image 107.
[0026] It should be noted that the computing device 101 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made here.
[0027] It should be understood that Figure 1The number of computing devices in the embodiment is only illustrative. Any number of computing devices may be provided according to implementation requirements.
[0028] Continue to refer Figure 2 , shows a process 200 of some embodiments of the face image detection method according to the present disclosure. The face image detection method comprises the following steps:
[0029] Step 201 , controlling the drone to take pictures from a bird's-eye view to obtain pedestrian images.
[0030] In some embodiments, the execution subject of the face image detection method (such as Figure 1 The computing device 101 shown in the figure can control the drone to shoot images in a bird's-eye view through a wired connection or a wireless connection to obtain pedestrian images. The pedestrian images can include face areas. The images shot by the drone can be images of pedestrians on a zebra crossing. In the pedestrian images shot by the drone in a bird's-eye view, the effective pixels in the face area are usually small. The number of pedestrians included in the pedestrian images can be one or more.
[0031] Step 202: Use a sliding window to traverse the pedestrian image to obtain a pedestrian detection image.
[0032] In some embodiments, the execution subject may use a sliding window to perform region traversal on the pedestrian image to obtain a pedestrian detection image, wherein the pedestrian detection image may include multiple initial candidate frames.
[0033] In some optional implementations of some embodiments, the above-mentioned using a sliding window to traverse the area of the above-mentioned pedestrian image to obtain the pedestrian detection image may include the following steps:
[0034] The first step is to set a predetermined number of sliding windows, wherein the predetermined number of sliding windows have different lengths, widths and sliding steps.
[0035] The second step is to control the predetermined number of sliding windows to slide on the pedestrian image at a set sliding step size, wherein the predetermined number of sliding windows can slide horizontally or vertically on the pedestrian image.
[0036] In the third step, the frame of the area selected by each sliding of the predetermined number of sliding windows is determined as an initial candidate frame, and multiple initial candidate frames are obtained. The predetermined number of sliding windows slide in the pedestrian image with a set sliding step length, so that the pedestrian image can be traversed. After the area traversal is completed, the pedestrian image includes multiple overlapping frames of different sizes. These frames can be called initial candidate frames.
[0037] In the fourth step, the pedestrian image including the multiple initial candidate frames is determined as the pedestrian detection image.
[0038] Step 203 , determining the directional gradient histogram features of the area selected by each initial candidate box in the multiple initial candidate boxes included in the pedestrian detection image to generate a histogram feature, and obtaining a pedestrian feature image.
[0039] In some embodiments, the execution subject may determine the directional gradient histogram features of the area selected by each of the multiple initial candidate frames included in the pedestrian detection image to generate a histogram feature to obtain a pedestrian feature image. The pedestrian feature image includes multiple histogram features. The histogram feature may characterize the edge information of the object in the selected area.
[0040] In some optional implementations of some embodiments, the determining of the directional gradient histogram features of the area selected by each of the multiple initial candidate boxes included in the pedestrian detection image to generate the histogram features may include the following steps:
[0041] In the first step, each pixel in the area selected by the initial candidate box is determined as an initial pixel set. The execution subject may also determine the three-dimensional coordinates of each pixel. The horizontal and vertical coordinates of the selected area may be used as the horizontal and vertical coordinates of the pixel, and the pixel value may be used as the vertical coordinate.
[0042] The second step is to determine the gradient magnitude and gradient direction value of each pixel in the initial pixel set. The execution subject may perform derivatives on the horizontal, vertical and vertical coordinates of each pixel, add the obtained results, and obtain the gradient magnitude. The execution subject may determine the cotangent value of the horizontal and vertical coordinates of each pixel, and use the cotangent value as the gradient magnitude.
[0043] The third step is to group the above initial pixel set to obtain a pixel group set.
[0044] As an example, the initial pixel set may be a 60*60 pixel set. The initial pixel set may be grouped into 10 6*6 pixel groups.
[0045] The fourth step is to use a histogram to count the gradient amplitude and gradient direction value corresponding to each pixel group in the above pixel group set to generate an initial directional gradient histogram feature, and obtain an initial directional gradient histogram feature set. Among them, the histogram can be a function between the statistical characteristics of the grayscale value in the image and the image grayscale value. The histogram can count the number of times each grayscale level appears in the image. The horizontal axis of the histogram can have a value of 0 to 255, that is, 256 grayscale levels. The vertical axis is the number of pixels corresponding to the grayscale level.
[0046] The fifth step is to normalize each initial directional gradient histogram feature in the above-mentioned initial directional gradient histogram feature set to obtain a histogram feature. Among them, the above-mentioned execution entity can combine each initial directional gradient histogram feature in the above-mentioned initial directional gradient histogram feature set to obtain a histogram feature. When each initial directional gradient histogram feature is combined, there may be repeated features, so the obtained histogram feature may be a plurality of overlapping features.
[0047] Optionally, before determining each pixel in the area selected by the initial candidate box as the initial pixel set, the following steps may be further included:
[0048] The first step is to grayscale the above pedestrian detection image to obtain a grayscale image.
[0049] The second step is to perform color correction on the grayscale image to obtain a corrected image.
[0050] Optionally, performing color correction processing on the grayscale image to obtain a corrected image may include the following steps:
[0051] In the first step, each pixel value in the grayscale image is numerically converted to generate a converted pixel value and obtain a converted pixel value set.
[0052] As an example, each pixel value in the grayscale image may be converted into a real number between 0 and 1. The pixel value may be numerically converted using the formula (i+0.5) / 256, where i represents the pixel value.
[0053] In the second step, each converted pixel value in the converted pixel value set is used as a base number and the preset correction value is used as an exponent to determine the color compensation value corresponding to the converted pixel value to obtain a color compensation value set. The preset correction value may be 2.2.
[0054] The third step is to perform numerical inverse conversion processing on each color compensation value in the above color compensation value set to generate an inverse conversion pixel value, thereby obtaining an inverse conversion pixel value set.
[0055] As an example, each color compensation value in the above color compensation value set may be numerically inversely converted, that is, each color compensation value may be inversely converted into a real number between 0 and 1. The color compensation value may be numerically inversely converted by the formula f*256-0.5. f represents the color compensation value.
[0056] In the fourth step, the grayscale image including the above-mentioned inversely converted pixel value set is determined as the corrected image.
[0057] As an inventive point of an embodiment of the present disclosure, the above step 203 solves the technical problem 2 mentioned in the background technology, "Secondly, since the postures and movements of pedestrians in the captured pedestrian images are random, the illumination and geometric shapes of different regions in the pedestrian images vary, and therefore, it is difficult to accurately extract the features in the image region, which makes it difficult to accurately divide the image region." The reasons for the difficulty in accurately dividing the image region are often as follows: since the postures and movements of pedestrians in the captured pedestrian images are random, the illumination and geometric shapes of different regions in the pedestrian images vary, and therefore, it is difficult to accurately extract the features in the image region. If the above reasons are solved, the effect of accurately dividing the image region can be achieved. In order to achieve this effect, first, the above pedestrian detection image can be grayed to obtain a gray image. Thus, the gray value of each pixel can be obtained. At the same time, the size of the picture can be reduced. Then, the above gray image can be color corrected to obtain a corrected image. Thus, the contrast of the image can be adjusted to reduce the impact of shadows and illumination changes in the image. At the same time, the interference of noise can be suppressed. Next, each pixel in the area selected by the initial candidate frame can be determined as an initial pixel set, and the gradient amplitude and gradient direction value of each pixel in the initial pixel set can be determined. Thus, the contour information in the area selected by the initial candidate frame can be captured. At the same time, since each pixel is processed, the interference of light can be further weakened. Then, the initial pixel set can be grouped to obtain a pixel group set, and the gradient amplitude and gradient direction value corresponding to each pixel group in the pixel group set can be counted using a histogram to generate an initial directional gradient histogram feature to obtain an initial directional gradient histogram feature set. Thus, the gradient amplitude and gradient direction value can be histogram counted in the dimension of the pixel group. Finally, each initial directional gradient histogram feature in the initial directional gradient histogram feature set is normalized to obtain a histogram feature. Thus, the influence of light and geometric deformation can be effectively avoided, and it is convenient to accurately extract features in the image area, so that the image area can be accurately divided.
[0058] Step 204: Use a support vector machine to classify the multiple histogram features included in the pedestrian feature image to obtain a classification result.
[0059] In some embodiments, the execution subject may classify the multiple histogram features included in the pedestrian feature image using a support vector machine to obtain a classification result, wherein the classification result may be a histogram feature related to facial features and a histogram feature unrelated to facial features.
[0060] Step 205 , in response to determining that the classification result meets the preset condition, non-maximum suppression processing is performed on the pedestrian feature image to obtain an image to be segmented.
[0061] In some embodiments, the execution subject may perform non-maximum suppression processing on the pedestrian feature image in response to determining that the classification result meets a preset condition to obtain an image to be segmented. The image to be segmented may be an image including a face area.
[0062] In some optional implementations of some embodiments, in response to determining that the classification result satisfies a preset condition, non-maximum suppression processing is performed on the pedestrian feature image, and the image to be segmented can be obtained by the following steps:
[0063] In response to determining that the above classification result is a pedestrian histogram feature set, the initial candidate frame corresponding to the above pedestrian histogram feature set in the above pedestrian feature image is subjected to non-maximum suppression processing to obtain an image to be segmented. Among them, the above classification result may include a pedestrian histogram feature set and a background histogram feature set. The above image to be segmented may include a target candidate frame. The above execution subject may obtain the confidence scores of multiple initial candidate frames corresponding to the above pedestrian histogram feature set. Then, the multiple confidence scores are sorted, and the initial candidate frame with the highest confidence is added to the output list. After that, the above execution subject may determine the area of all initial candidate frames, calculate the intersection and union ratio of the initial candidate frame with the highest confidence with other initial candidate frames, and eliminate the initial candidate frames whose intersection and union ratio is greater than a predetermined threshold. Select an initial candidate frame with the highest confidence from the eliminated initial candidate frames and add it to the output list. Repeat the above steps until a unique initial candidate frame is determined as the target candidate frame.
[0064] Step 206 , performing image segmentation processing according to the target candidate frame included in the image to be segmented to obtain a target pedestrian image.
[0065] In some embodiments, the execution subject may divide the image according to the target candidate frame included in the image to be segmented, and perform image segmentation processing on the image to be segmented to obtain a target pedestrian image.
[0066] Step 207: input the target pedestrian image into a pre-trained face detection model to obtain the position information of the face area of the target pedestrian image.
[0067] In some embodiments, the execution subject may input the target pedestrian image into a pre-trained face detection model to obtain the location information of the face area of the target pedestrian image. The pre-trained face detection model may be a model trained using CNN (Convolutional Neural Networks), RNN (Recurrent Neural Network), YOLO V5 or BP (back propagation, multi-layer feedforward neural network). YOLO V5 is a single-stage target detection algorithm based on a convolutional neural network structure. To obtain a pre-trained face detection model, the network structure of the initial neural network may be determined first. For example, it is necessary to determine which layers the initial neural network includes, the connection order between layers, which neurons each layer includes, the weights and bias items corresponding to each neuron, the activation function of each layer of the network, and so on. Then, the network parameters of the initial neural network are initialized, and the model is trained with the sample pedestrian image as input and the location information of the face area of the sample pedestrian image as output. The effect of the model training is judged by setting a loss function. Finally, when the loss value obtained by the loss function meets the preset conditions, the training is terminated to obtain a trained face detection model. The preset condition may be that the loss value converges to a predetermined threshold.
[0068] Optionally, the execution entity may also send the position information of the face area of the target pedestrian image to a display device for display by the display device.
[0069] The above-mentioned embodiments of the present disclosure have the following beneficial effects: by detecting the position information of the face area through the face image detection method of some embodiments of the present disclosure, the problem of large amount of calculation caused by detecting the original image is solved, and the situation of missed detection or false detection is avoided due to the small effective pixels of the face area caused by scaling the image. Specifically, the reason for the low detection rate and large amount of calculation of the face image is that the effective pixels of the face area in the image taken by the drone are small, and after scaling the image, the effective pixels of the face area are smaller, so that missed detection or false detection may occur. If the image is not scaled, the size of the original image is large. Based on this, the face image detection method of some embodiments of the present disclosure, first, can control the drone to shoot the image in a bird's-eye view mode to obtain a pedestrian image, wherein the pedestrian image includes the face area. Thus, a pedestrian image including the face area can be obtained, and the effective pixels of the face area in the pedestrian image are small, and the proportion of the pedestrian image is small. The drone shooting can provide a data basis for the detection of the face image. Then, the pedestrian image can be traversed by a sliding window to obtain a pedestrian detection image, wherein the pedestrian detection image includes a plurality of initial candidate frames. Thus, the region in the pedestrian image can be preliminarily divided. Afterwards, the directional gradient histogram features of the region selected by each initial candidate frame in the plurality of initial candidate frames included in the pedestrian detection image can be determined to generate a histogram feature to obtain a pedestrian feature image, wherein the pedestrian feature image includes a plurality of histogram features. Since the number of valid pixels of pedestrians is greater than that of faces, the features of each region divided by the sliding window can be accurately determined. Then, the plurality of histogram features included in the pedestrian feature image can be classified by a support vector machine to obtain a classification result. Thus, it can be accurately determined whether each region belongs to a face region or a background region. Then, in response to determining that the classification result meets a preset condition, the pedestrian feature image can be subjected to non-maximum suppression processing to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame. Thus, invalid initial candidate frames can be eliminated to obtain a target candidate frame including a face region. Afterwards, image segmentation processing can be performed according to the target candidate frame included in the above image to be segmented to obtain the target pedestrian image. In this way, the target pedestrian image can be separated from the pedestrian image, so that the amount of computer calculation can be reduced in subsequent calculations. Finally, the above target pedestrian image is input into a pre-trained face detection model to obtain the position information of the face area of the above target pedestrian image. In this way, by quickly locating the position of the pedestrian in the pedestrian image, the target candidate frame including the pedestrian is segmented from the pedestrian image, and then directly input into the pre-trained face detection model.That is, it solves the problem of large amount of calculation caused by inputting the original image, and at the same time avoids the situation that the effective pixels in the face area are smaller due to scaling the original image, thereby causing missed detection or false detection, resulting in a low detection rate of face images.
[0070] Further references Figure 3 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a face image detection device. These device embodiments are similar to Figure 2 Corresponding to the above method embodiments, the device can be specifically applied to various electronic devices.
[0071] like Figure 3 As shown, some embodiments of the face image detection device 300 include: a control unit 301, a region traversal unit 302, a determination unit 303, a classification processing unit 304, a non-maximum suppression processing unit 305, an image segmentation processing unit 306 and an input unit 307. The control unit 301 is configured to control the drone to take images in a bird's-eye view manner to obtain a pedestrian image, wherein the pedestrian image includes a face region; the region traversal unit 302 is configured to use a sliding window to perform region traversal on the pedestrian image to obtain a pedestrian detection image, wherein the pedestrian detection image includes a plurality of initial candidate frames; the determination unit 303 is configured to determine the directional gradient histogram features of the region selected by each initial candidate frame in the plurality of initial candidate frames included in the pedestrian detection image to generate a histogram feature to obtain a pedestrian feature image, wherein the pedestrian feature image includes a plurality of histogram features; the classification processing unit 304 is configured to A support vector machine is used to classify the multiple histogram features included in the above-mentioned pedestrian feature image to obtain a classification result; a non-maximum suppression processing unit 305 is configured to perform non-maximum suppression processing on the above-mentioned pedestrian feature image in response to determining that the above-mentioned classification result meets a preset condition to obtain an image to be segmented, wherein the above-mentioned image to be segmented includes a target candidate frame; an image segmentation processing unit 306 is configured to perform image segmentation processing according to the target candidate frame included in the above-mentioned image to be segmented to obtain a target pedestrian image; an input unit 307 is configured to input the above-mentioned target pedestrian image into a pre-trained face detection model to obtain the position information of the face area of the above-mentioned target pedestrian image.
[0072] It is understood that the units described in the device 300 are similar to those described in the reference Figure 2 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 300 and the units contained therein, and will not be described in detail here.
[0073] Reference below Figure 4, which shows an electronic device suitable for implementing some embodiments of the present disclosure (e.g., Figure 1 Schematic diagram of the structure of the computing device 101)400. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0074] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0075] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0076] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0077] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0078] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0079] The above-mentioned computer-readable medium may be included in the above-mentioned device; or it may exist independently and not be assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: controls the drone to take images in a bird's-eye view manner to obtain pedestrian images, wherein the above-mentioned pedestrian images include face areas; uses a sliding window to traverse the area of the above-mentioned pedestrian images to obtain pedestrian detection images, wherein the above-mentioned pedestrian detection images include multiple initial candidate frames; determines the directional gradient histogram features of the area selected by each initial candidate frame in the multiple initial candidate frames included in the above-mentioned pedestrian detection image to generate a histogram feature to obtain a pedestrian feature image, wherein The pedestrian feature image includes a plurality of histogram features; the plurality of histogram features included in the pedestrian feature image are classified by a support vector machine to obtain a classification result; in response to determining that the classification result satisfies a preset condition, the pedestrian feature image is subjected to non-maximum suppression processing to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame; image segmentation processing is performed according to the target candidate frame included in the image to be segmented to obtain a target pedestrian image; the target pedestrian image is input into a pre-trained face detection model to obtain the position information of the face region of the target pedestrian image.
[0080] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0081] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0082] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor including a control unit, an area traversal unit, a determination unit, a classification processing unit, a non-maximum suppression processing unit, an image segmentation processing unit and an input unit. Among them, the names of these units do not constitute a limitation on the units themselves in certain cases. For example, the control unit may also be described as a "unit for controlling the drone to take images in a bird's-eye view manner to obtain images of pedestrians."
[0083] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0084] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A face image detection method, comprising: Controlling the drone to shoot images in a bird's-eye view manner to obtain pedestrian images, wherein the pedestrian images include a face area; Using a sliding window to traverse the pedestrian image in a region to obtain a pedestrian detection image, wherein the pedestrian detection image includes a plurality of initial candidate frames; Determine the directional gradient histogram feature of the area framed by each of the multiple initial candidate frames included in the pedestrian detection image to generate a histogram feature, and obtain a pedestrian feature image, wherein the pedestrian feature image includes multiple histogram features; Using a support vector machine to classify a plurality of histogram features included in the pedestrian feature image to obtain a classification result; In response to determining that the classification result meets a preset condition, performing non-maximum suppression processing on the pedestrian feature image to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame; Performing image segmentation processing according to the target candidate frame included in the image to be segmented to obtain a target pedestrian image; Inputting the target pedestrian image into a pre-trained face detection model to obtain position information of the face area of the target pedestrian image; The step of determining the directional gradient histogram feature of the area selected by each initial candidate box in the plurality of initial candidate boxes included in the pedestrian detection image to generate a histogram feature includes: Determine each pixel in the area selected by the initial candidate frame as an initial pixel set; Determining a gradient magnitude and a gradient direction value of each pixel in the initial pixel set; Grouping the initial pixel set to obtain a pixel group set; Using a histogram to perform statistics on the gradient magnitude and gradient direction value corresponding to each pixel group in the pixel group set to generate an initial directional gradient histogram feature, thereby obtaining an initial directional gradient histogram feature set; Each initial oriented gradient histogram feature in the initial oriented gradient histogram feature set is normalized to obtain a histogram feature.
2. The method according to claim 1, wherein: The method further comprises: The position information of the face area of the target pedestrian image is sent to a display device for display by the display device.
3. The method according to claim 2, wherein: The step of using a sliding window to traverse a region of the pedestrian image to obtain a pedestrian detection image includes: Setting a predetermined number of sliding windows, wherein the predetermined number of sliding windows have different lengths, widths, and sliding steps; Controlling the predetermined number of sliding windows to slide on the pedestrian image at a set sliding step size respectively; Determine the border of the area framed by each sliding of the predetermined number of sliding windows as an initial candidate frame, to obtain a plurality of initial candidate frames; A pedestrian image including a plurality of initial candidate frames is determined as a pedestrian detection image.
4. The method according to claim 3, wherein: Before determining each pixel in the area selected by the initial candidate frame as an initial pixel set, the method further includes: grayscale the pedestrian detection image to obtain a grayscale image; Performing color correction processing on the grayscale image to obtain a corrected image.
5. The method according to claim 4, wherein: The step of performing color correction processing on the grayscale image to obtain a corrected image includes: Performing numerical conversion processing on each pixel value in the grayscale image to generate a converted pixel value, thereby obtaining a converted pixel value set; Taking each converted pixel value in the converted pixel value set as a base and a preset correction value as an exponent, determining a color compensation value corresponding to the converted pixel value to obtain a color compensation value set; Performing numerical inverse conversion processing on each color compensation value in the color compensation value set to generate an inverse conversion pixel value, thereby obtaining an inverse conversion pixel value set; A grayscale image including the set of inverse-converted pixel values is determined as a corrected image.
6. The method according to claim 5, wherein: The classification result includes a pedestrian histogram feature set and a background histogram feature set; as well as In response to determining that the classification result meets the preset condition, performing non-maximum suppression processing on the pedestrian feature image to obtain an image to be segmented, including: In response to determining that the classification result is a pedestrian histogram feature set, non-maximum suppression processing is performed on an initial candidate box corresponding to the pedestrian histogram feature set in the pedestrian feature image to obtain an image to be segmented.
7. A facial image detection device, comprising: A control unit is configured to control the drone to shoot images in a bird's-eye view manner to obtain pedestrian images, wherein the pedestrian images include a face area; A region traversal unit is configured to perform region traversal on the pedestrian image using a sliding window to obtain a pedestrian detection image, wherein the pedestrian detection image includes a plurality of initial candidate frames; A determination unit is configured to determine a directional gradient histogram feature of an area selected by each of a plurality of initial candidate frames included in the pedestrian detection image to generate a histogram feature, and obtain a pedestrian feature image, wherein the pedestrian feature image includes a plurality of histogram features; A classification processing unit is configured to perform classification processing on a plurality of histogram features included in the pedestrian feature image using a support vector machine to obtain a classification result; a non-maximum suppression processing unit, configured to, in response to determining that the classification result satisfies a preset condition, perform non-maximum suppression processing on the pedestrian feature image to obtain an image to be segmented, wherein the image to be segmented includes a target candidate frame; An image segmentation processing unit is configured to perform image segmentation processing according to the target candidate frame included in the image to be segmented to obtain a target pedestrian image; An input unit, configured to input the target pedestrian image into a pre-trained face detection model to obtain position information of a face region of the target pedestrian image; Wherein, the determining unit is further configured to: Determine each pixel in the area selected by the initial candidate frame as an initial pixel set; Determining a gradient magnitude and a gradient direction value of each pixel in the initial pixel set; Grouping the initial pixel set to obtain a pixel group set; Using a histogram to perform statistics on the gradient magnitude and gradient direction value corresponding to each pixel group in the pixel group set to generate an initial directional gradient histogram feature, thereby obtaining an initial directional gradient histogram feature set; Each initial oriented gradient histogram feature in the initial oriented gradient histogram feature set is normalized to obtain a histogram feature.
8. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Pedestrian position detection and tracking method and system
CN110688987A
Face detection method, device and equipment and storage medium
CN112287769A