Image processing method, device and storage medium
By using detection object recognition model screening and rotation technology in image processing, the shortcomings of traditional face detection algorithms in horizontal screen situations are solved, and the accuracy of image processing and beautification effects are improved.
Patent Information
- Application Number
- CN202011281283.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-16
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-11-16
AI Technical Summary
Traditional face detection algorithms cannot effectively detect faces in horizontal screen conditions, resulting in reduced accuracy in image processing. Especially during live broadcasts, the host's body direction is inconsistent with the display direction, affecting the beautification effect.
By inputting the original image into the detection object recognition model, multiple detection frames, score information and key point location information are obtained, the target detection frames are filtered out, the rotation angle is determined, and the image is rotated according to the angle to improve the accuracy of image processing.
It achieves accurate detection of faces and corrects the image direction in horizontal screen conditions, improves the accuracy and beautification effect of image processing, and ensures that the anchor's body direction is consistent with the display direction.
Smart Images

Figure CN112434587B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method and device, and a storage medium. Background Art
[0002] In recent years, live video streaming has developed rapidly, and live streaming has gradually become an important direction for the development of major e-commerce companies. The beauty technology of live streaming software makes the anchor more beautiful, which is of great significance in attracting consumers to consume. Therefore, live streaming beauty technology has become a rigid demand for live streaming software. During live streaming, the anchor may rotate the phone and use horizontal screen to broadcast live. This situation makes the phone have higher requirements for processing the original image including the anchor.
[0003] In the technical process of beautification, it is necessary to first detect the position of the face, and then perform technical processes such as key point detection. The traditional face detection algorithm can only detect the face in the front direction, also known as the front face image. During the live broadcast, the screen may be horizontal. At this time, the direction of the face is horizontal, and the traditional detection algorithm cannot detect the face in this case.
[0004] In the prior art, when a mobile phone determines a detection frame for the anchor's head portrait information, the mobile phone directly displays the original image including the anchor according to the position of the detection frame. In this way, when the mobile phone captures the original image in landscape mode, the mobile phone will display the original image in portrait mode, so that the displayed body direction of the anchor is inconsistent with the actual body direction of the anchor, thereby reducing the accuracy of image processing. Summary of the invention
[0005] In order to solve the above technical problems, embodiments of the present invention are intended to provide an image processing method and device, and a storage medium, which can improve the accuracy of image processing by the image processing device.
[0006] The technical solution of the present invention is achieved in this way:
[0007] The present application provides an image processing method, including:
[0008] When an original image is obtained, the original image is input into a detection object recognition model to obtain a plurality of detection frames corresponding to the target detection object in the original image, a plurality of score information of the plurality of detection frames, and a plurality of key point position information of the target detection object in the plurality of detection frames;
[0009] Filtering a target detection frame from the multiple detection frames according to the multiple score information;
[0010] Determine the rotation angle of the original image according to the target key point position information corresponding to the target detection frame, wherein the target key point position information is the key point position information corresponding to the target detection frame among the multiple key point position information;
[0011] The original image is rotated according to the rotation angle and the rotated original image is displayed.
[0012] The present application provides an image processing device, the device comprising:
[0013] An input unit is used to input the original image into the detection object recognition model when the original image is acquired, so as to obtain multiple detection frames corresponding to the target detection objects in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection objects in the multiple detection frames;
[0014] A screening unit, configured to screen out a target detection frame from the multiple detection frames according to the multiple score information;
[0015] A determination unit, configured to determine a rotation angle of the original image according to target key point position information corresponding to the target detection frame, wherein the target key point position information is key point position information corresponding to the target detection frame among the plurality of key point position information;
[0016] A rotation unit, configured to rotate the original image according to the rotation angle;
[0017] The display unit is used to display the rotated original image.
[0018] The present application provides an image processing device, the device comprising:
[0019] A memory, a processor and a communication bus, wherein the memory communicates with the processor via the communication bus, and the memory stores an image processing program executable by the processor. When the image processing program is executed, the image processing method described above is executed by the processor.
[0020] An embodiment of the present application provides a storage medium having a computer program stored thereon, which is applied to an image processing device, and is characterized in that the computer program implements the above-mentioned image processing method when executed by a processor.
[0021] The embodiment of the present invention provides an image processing method and device, and a storage medium. The image processing method includes: when an original image is acquired, the original image is input into a detection object recognition model to obtain multiple detection frames corresponding to the target detection object in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection object in the multiple detection frames; based on the multiple score information, a target detection frame is screened out from the multiple detection frames; based on the target key point position information corresponding to the target detection frame, a rotation angle of the original image is determined, and the target key point position information is the key point position information corresponding to the target detection frame in the multiple key point position information; the original image is rotated according to the rotation angle and the rotated original image is displayed. By adopting the above-mentioned method implementation scheme, when the image processing device obtains the original image, the image processing device can input the original image into the detection object recognition model, and use the detection object recognition model to obtain multiple detection frames, multiple score information and multiple key point position information. According to the multiple key point position information, the target detection frame can be determined, and the rotation angle of the original image can be determined using the target key point position information corresponding to the target detection frame. The image processing device can directly rotate the original image according to the rotation angle and display the rotated original image, thereby improving the accuracy of the image processing device during image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flow chart of an image processing method provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of the composition structure of an exemplary image processing device provided in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application Figure 1 ;
[0025] Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0027] There are many face detection algorithms available in current technology, which are basically divided into anchor-based and non-anchor-based. The non-anchor-based model has a large amount of calculation, which is not conducive to the integration of mobile terminals. Anchor-based detection models are divided into single-stage and multi-stage. In the single-stage detection algorithm, a single model outputs the position of the detection box, while the multi-stage requires multiple models to process and finally output the detection position. On the mobile phone side, the single-stage model is faster and more suitable for mobile deployment. The SSD (SingleShot MultiBox Detector) algorithm is a commonly used single-stage algorithm with the characteristics of fast speed and easy deployment. However, the traditional SSD algorithm cannot detect faces at all angles, and thus cannot identify the angle of the face in the image, thus reducing the accuracy of image processing.
[0028] Embodiment 1
[0029] The present application embodiment provides an image processing method, Figure 1 An image processing method provided in the embodiment of the present application Figure 1 ,like Figure 1 As shown, the image processing method may include:
[0030] S101. When an original image is acquired, the original image is input into a detection object recognition model to obtain multiple detection frames corresponding to the target detection objects in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection objects in the multiple detection frames.
[0031] An image processing method provided in an embodiment of the present application is suitable for a scenario in which an image processing device processes a received original image.
[0032] In the embodiments of the present application, the image processing device can be implemented in various forms. For example, the image processing device described in the present application may include devices such as mobile phones, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, and devices such as digital TVs and desktop computers.
[0033] In the embodiment of the present application, the original image may be image information collected by the image processing device using a camera, or may be an image obtained by the image processing device from other devices. The specific image may be determined based on actual conditions, and the embodiment of the present application does not limit this.
[0034] In the embodiment of the present application, the original image may be an image of an animal, an image of a plant, an image of a person, or other images. The specific image may be determined based on actual conditions, and the embodiment of the present application does not limit this.
[0035] It should be noted that the original image includes a target detection object, which can be an animal, a plant, or a person. The specific one can be determined according to actual conditions, and the embodiments of the present application do not limit this.
[0036] In an embodiment of the present application, the detection object recognition model may specifically be a model for recognizing a target detection object in an original image, and the detection object recognition model is a model trained using sample images at different rotation angles. For example, if the target detection object is a person, the detection object recognition model is a model for recognizing a person in an original image.
[0037] In an embodiment of the present application, the detection object recognition model may specifically be a model obtained according to a Single Shot MultiBox Detector (SSD).
[0038] In the embodiment of the present application, the number of target detection objects can be one, two, or more, which can be determined according to actual conditions and is not limited in the embodiment of the present application.
[0039] In the embodiment of the present application, the detection frame is used to frame the face of the target detection object, and one target object corresponds to multiple detection frames.
[0040] In the embodiment of the present application, the multiple score information is score information obtained according to the area of the target detection object in the multiple detection frames occupying the area of the multiple detection frames. The multiple detection frames correspond to the multiple score information one by one, specifically, one detection frame corresponds to one score information.
[0041] It should be noted that the score information is the score information determined by the image processing device based on the area of the target detection object framed in the detection frame as a percentage of the area of the detection frame. For example, if the image in a certain detection frame is a facial image of the target detection object, then the score information corresponding to the certain detection frame can be the score value of the facial image area as a percentage of the area of a certain detection frame. The score value can be 1 point, 0 points, or a score between 0-1. The specific score can be determined based on actual conditions, and the embodiments of the present application are not limited to this.
[0042] It should be noted that one score information may include two score values, namely, a face frame score value and a non-face frame score value; one score information may also include one score value, namely, a face frame score value; the specific score value can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0043] In the embodiment of the present application, if an image in a detection frame is a facial image of a target detection object, the score of the facial frame corresponding to the detection frame may be 1 point, 0.9 points, or other scores, which may be determined based on actual conditions and are not limited in the embodiment of the present application.
[0044] In the embodiment of the present application, when the image processing device obtains the original image, the image processing device inputs the original image into the detection object recognition model. After the original image passes through the convolution layer in the detection object recognition model, the detection object recognition model can obtain all the pixels in the original image. The detection object recognition model can obtain multiple anchor points corresponding to the original image based on the correspondence between the pixels and the anchor points. The detection object recognition model can determine multiple detection frames based on the correspondence between the anchor points and the detection frames, wherein one anchor point corresponds to one detection frame. The image processing device uses the two points at the upper left corner and the lower right corner of the detection frame to determine the position of the detection frame, that is, the two points at the upper left corner and the lower right corner are used to identify the detection frame. The detection object recognition model scores each detection frame according to the image in each detection frame, obtains multiple score information of multiple detection frames, and uses the SSD algorithm to determine multiple key point position information corresponding to the multiple detection frames. After that, the detection object recognition model outputs multiple detection frames corresponding to the target detection object in the original image, multiple score information of the multiple detection frames, and multiple key point position information corresponding to the multiple detection frames.
[0045] In an embodiment of the present application, multiple key point position information includes multiple left eye corner position information, multiple right eye corner position information, multiple nose tip position information, multiple left mouth corner position information and multiple right mouth corner position information of the target detection object.
[0046] In an embodiment of the present application, one detection frame corresponds to one left eye corner position information, one right eye corner position information, one nose tip position information, one left mouth corner position information and one right mouth corner position information; multiple detection frames correspond to multiple left eye corner position information, multiple right eye corner position information, multiple nose tip position information, multiple left mouth corner position information and multiple right mouth corner position information, that is, multiple detection frames correspond to multiple key point information.
[0047] In the embodiment of the present application, the position information of multiple key points may specifically be 2D coordinate point information or other coordinate point information, which may be specifically determined according to actual conditions, and the embodiment of the present application does not limit this.
[0048] In an embodiment of the present application, the image processing device includes an original detection object recognition model. The image processing device inputs the original image into the detection object recognition model. Before obtaining multiple detection frames, multiple score information of the multiple detection frames and multiple key point position information corresponding to the detection frames, the image processing device needs to train the original detection object recognition model to obtain the trained original detection object recognition model, that is, to obtain the detection object recognition model. Specifically, the process of training the original detection object recognition model by the image processing device includes: the image processing device obtains sample images at different rotation angles, sample detection frames corresponding to the sample images, sample score information of the sample detection frames, and sample key point position information corresponding to the sample detection frames; after the image processing device obtains sample images at different rotation angles, sample detection frames corresponding to the sample images, sample score information of the sample detection frames, and sample key point position information corresponding to the sample detection frames, the image processing device can input the sample images into the original detection object recognition model to obtain the sample detection frames to be trained, the sample score information to be trained, and the sample key point position information to be trained corresponding to the sample images; after the image processing device inputs the sample images into the original detection object recognition model to obtain the sample detection frames to be trained, the sample score information to be trained, and the sample key point position information to be trained corresponding to the sample images, the image processing device can use the sample detection frames to be trained, the sample score information to be trained, the sample key point position information to be trained, the sample score information, the sample key point position information, and the sample detection frames to train the original detection object recognition model to obtain the detection object recognition model.
[0049] In the embodiment of the present application, the sample images at different rotation angles are image information obtained by rotating the sample detection object at different angles.
[0050] Exemplarily, when the image processing device obtains the original sample image I, the image processing device can use the affine function Rotate in formula (1) to rotate the original sample image I according to different rotation angles angle, thereby obtaining the rotated original sample image I R, that is, sample images with different rotation angles are obtained, and then the image processing device inputs the sample images with different rotation angles into the original detection object recognition model. When the original detection object recognition model is used to obtain the sample detection frame to be trained, the sample score information to be trained and the key point position information of the sample to be trained corresponding to the sample image, the original detection object recognition model is trained using the sample detection frame to be trained, the sample score information to be trained, the key point position information of the sample to be trained, the sample score information, the sample key point position information and the sample detection frame until the detection object recognition model is obtained.
[0051] I R =Rotate(I, angle) (1)
[0052] It can be understood that the image processing device uses sample images with different rotation angles to train the original detection object recognition model, so that when the original detection object recognition model obtains the original image, it can identify the target detection objects with different rotation angles in the original image, so as to rotate the original image according to different rotation angles, thereby improving the accuracy of the image processing device during image processing.
[0053] S102: Filter out a target detection frame from multiple detection frames according to multiple score information.
[0054] In an embodiment of the present application, the image processing device inputs the original image into the detection object recognition model, and after obtaining multiple detection frames corresponding to the target detection objects in the original image, multiple score information of the multiple detection frames, and multiple key point position information corresponding to the multiple detection frames, the image processing device can filter out the target detection frame from the multiple detection frames based on the multiple score information.
[0055] In an embodiment of the present application, the target detection frame can be a detection frame used to frame the face of the target detection object in the original image. The number of target detection frames can be one or more, and the specific number can be determined according to actual conditions. The embodiment of the present application does not limit this.
[0056] In the embodiment of the present application, the number of target detection objects corresponds to the number of target detection frames one by one, that is, one target detection object corresponds to one target detection frame.
[0057] In an embodiment of the present application, when the image processing device obtains multiple detection frames, the image processing device can use non-maximum suppression (NMS) to filter out the target detection frame from the multiple detection frames. Specifically: the process of the image processing device filtering out the target detection frame from the multiple detection frames according to multiple score information includes: the image processing device extracts the first detection frame with the largest score from the multiple detection frames according to the multiple score information; after the image processing device extracts the first detection frame with the largest score from the multiple detection frames according to the multiple score information, the image processing device removes the detection frame whose overlapping area with the first detection frame is greater than a preset area threshold from the multiple detection frames, and obtains multiple first candidate detection frames; when the image processing device determines that the number of multiple first candidate detection frames is less than or equal to the preset number threshold, the image processing device uses the first detection frame as the target detection frame. When the image processing device determines that the number of multiple first candidate detection frames is greater than a preset number threshold, the image processing device continues to extract the second detection frame with the largest score from the multiple first candidate detection frames; after the image processing device extracts the second detection frame with the largest score from the multiple first candidate detection frames, the image processing device eliminates the detection frames whose overlapping areas with the second detection frames are greater than the preset area threshold from the multiple first candidate detection frames, and obtains multiple second candidate detection frames. The image processing device compares the number of the multiple second candidate detection frames with the preset number threshold; until the image processing device determines that the number of the multiple second candidate detection frames is less than or equal to the preset number threshold, the image processing device uses the first detection frame and the second detection frame as the target detection frames.
[0058] It should be noted that the first detection frame is a detection frame corresponding to the first score information, and the first score information is the score information with the highest score among the multiple score information.
[0059] In an embodiment of the present application, the image processing device can sort multiple score information in order from large to small to obtain sorted score information. Thereafter, the image processing device can obtain the score information ranked first in the sorted score information, thereby obtaining the first score information, that is, obtaining the score information with the highest score among the multiple score information.
[0060] In the embodiment of the present application, the number of the first detection frames may be one or more, which may be determined according to actual conditions and is not limited in the embodiment of the present application.
[0061] In the embodiment of the present application, the number of first score information may be one or more, which may be determined according to actual conditions and is not limited in the embodiment of the present application.
[0062] It should be noted that multiple score information corresponds to multiple detection frames. Specifically, one score information corresponds to one detection frame.
[0063] In the embodiment of the present application, the preset area threshold may be an area threshold configured in the image processing device, or an area threshold obtained by the image processing device according to the user's operating instructions, or an area threshold determined by the image processing device according to other methods. The specific area threshold may be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0064] In an embodiment of the present application, the preset quantity threshold may be a quantity threshold configured in the image processing device, or a quantity threshold obtained by the image processing device according to an operation instruction of a user, or a quantity threshold determined by the image processing device according to other methods. The specific quantity threshold may be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0065] It should be noted that the preset quantity threshold can be 0 or 1; it can also be other numbers, which can be determined according to actual conditions, and the embodiments of the present application do not limit this.
[0066] In the embodiment of the present application, when the image processing device obtains multiple detection frames, the image processing device may store the multiple detection frames in a set B, and store the multiple score information corresponding to the multiple detection frames in a set S. When the image processing device finds the first detection frame M corresponding to the first score information with the largest score from the set S, the image processing device deletes the first detection frame M from the set B, and deletes the first score information in the set S, and adds the first detection frame M to the set D. Then, the image processing device removes the detection frames in the set B whose overlapping area with the first detection frame is greater than the preset area threshold, and obtains multiple first candidate detection frames, that is, only multiple first candidate detection frames remain in the set B, and the image processing device deletes the score information corresponding to the multiple first candidate detection frames in the set S. When the image processing device determines that the number of multiple first candidate detection frames is less than or equal to the preset number threshold, the image processing device uses the first detection frame as the target detection frame. When the image processing device determines that the number of multiple first candidate detection frames is greater than the preset number threshold, the image processing device continues to extract the second detection frame with the largest score from the multiple first candidate detection frames in set S, deletes the score information corresponding to the second detection frame in set S, and adds the extracted second detection frame to set D. Thereafter, the image processing device removes the detection frames whose overlapping area with the second detection frame is greater than the preset area threshold from the multiple first candidate detection frames in set D to obtain multiple second candidate detection frames (eliminating the score information corresponding to the multiple second candidate detection frames from set S). The image processing device compares the number of the multiple second candidate detection frames with the preset number threshold until the image processing device determines that the number of the multiple second candidate detection frames in set B is less than or equal to the preset number threshold (that is, until there are no multiple second candidate detection frames in set B). Thereafter, the image processing device can use the first detection frames and the second detection frames in set D as target detection frames.
[0067] S103, determining the rotation angle of the original image according to the target key point position information corresponding to the target detection frame, where the target key point position information is the key point position information corresponding to the target detection frame among the multiple key point position information.
[0068] In an embodiment of the present application, after the image processing device selects a target detection frame from multiple detection frames based on multiple score information, the image processing device can determine the rotation angle of the original image based on the target key point position information corresponding to the target detection frame.
[0069] It should be noted that after the image processing device determines the target detection frame, the image processing device can determine the key point position information corresponding to the target detection frame from multiple key point position information, thereby obtaining the target key point position information.
[0070] In an embodiment of the present application, the process of an image processing device determining the rotation angle of an original image based on target key point position information corresponding to a target detection frame includes: the image processing device inputs the target key point position information into a multi-dimensional posture model to obtain multi-dimensional position information corresponding to the target key point position information; after the image processing device inputs the target key point position information into the multi-dimensional posture model to obtain multi-dimensional position information corresponding to the target key point position information, the image processing device can determine the rotation angle based on the multi-dimensional position information.
[0071] In an embodiment of the present application, the multi-dimensional posture model can be a model that determines the multi-dimensional position information corresponding to the target key point position information based on the target key point position information. The multi-dimensional posture model can specifically be a 3D coordinate point model or other models. The specific model can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0072] In the embodiment of the present application, the multi-dimensional posture model may specifically be a model obtained according to a pespective-n-point (PNP) algorithm.
[0073] In an embodiment of the present application, the multi-dimensional position information can specifically be a pair of points corresponding to the 2-dimensional point and the 3-dimensional point of the target key point position information. When the image processing device obtains the pair of points corresponding to the 2-dimensional point and the 3-dimensional point of the target key point position information, the image processing device can determine the rotation angle of the original image based on the pair of points corresponding to the 2-dimensional point and the 3-dimensional point of the target key point position information.
[0074] S104: Rotate the original image according to the rotation angle and display the rotated original image.
[0075] In an embodiment of the present application, after the image processing device determines the rotation angle of the original image based on the target key point position information corresponding to the target detection frame, the image processing device can rotate the original image according to the rotation angle to obtain the rotated original image, and then the image processing device can display the rotated original image.
[0076] For example, Figure 2As shown, when the image processing device obtains the original image, the image processing device inputs the original image into the detection object recognition model. After the original image passes through the convolution layer in the detection object recognition model, the detection object recognition model can obtain all the pixels in the original image. According to the correspondence between the pixels and the anchor points, the detection object recognition model can obtain multiple anchor points corresponding to the original image. According to the correspondence between the anchor points and the detection frames, the detection object recognition model can determine multiple detection frames according to the multiple anchor points (multiple anchor points correspond to multiple detection frames one by one). The detection object recognition model uses two points at the upper left corner and the lower right corner of the detection frame to identify the detection frame. The detection object recognition model scores each detection frame according to the image in each detection frame, obtains multiple score information of multiple detection frames, and uses the SSD algorithm to determine multiple key point position information corresponding to the multiple detection frames.
[0077] It should be noted that the number of convolutional layers in the detection object recognition model can be 5 convolutional layers, 8 convolutional layers, or any other number of convolutional layers. The specific number can be determined based on actual conditions, and the embodiments of the present application do not limit this.
[0078] It can be understood that when the image processing device obtains the original image, the image processing device can input the original image into the detection object recognition model, and use the detection object recognition model to obtain multiple detection frames, multiple score information and multiple key point position information. According to the multiple key point position information, the target detection frame can be determined, and the rotation angle of the original image can be determined using the target key point position information corresponding to the target detection frame. The image processing device can directly rotate the original image according to the rotation angle and display the rotated original image, thereby improving the accuracy of the image processing device during image processing.
[0079] Embodiment 2
[0080] Based on the same inventive concept of the first embodiment, the embodiment of the present application provides an image processing device 1, corresponding to an image processing method; Figure 3 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application Figure 1 , the image processing device 1 may include:
[0081] The input unit 11 is used to input the original image into the detection object recognition model when the original image is acquired, so as to obtain multiple detection frames corresponding to the target detection objects in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection objects in the multiple detection frames;
[0082] A screening unit 12, configured to screen a target detection frame from the plurality of detection frames according to the plurality of score information;
[0083] A determination unit 13 is used to determine the rotation angle of the original image according to the target key point position information corresponding to the target detection frame, wherein the target key point position information is the key point position information corresponding to the target detection frame among the multiple key point position information;
[0084] A rotation unit 14, configured to rotate the original image according to the rotation angle;
[0085] The display unit 15 is used to display the rotated original image.
[0086] In some embodiments of the present application, the apparatus further comprises an acquisition unit and a training unit;
[0087] The acquisition unit is used to acquire the sample image, the sample detection frame corresponding to the sample image, the sample score information of the sample detection frame, and the sample key point position information corresponding to the sample detection frame;
[0088] The input unit 11 is used to input the sample image into the original detection object recognition model to obtain the to-be-trained sample detection frame, to-be-trained sample score information and to-be-trained sample key point position information corresponding to the sample image;
[0089] The training unit is used to train the original detection object recognition model using the sample detection frame to be trained, the sample score information to be trained, the key point position information of the sample to be trained, the sample score information, the sample key point position information and the sample detection frame to obtain the detection object recognition model.
[0090] In some embodiments of the present application, the multiple key point position information includes multiple left eye corner position information, multiple right eye corner position information, multiple nose tip position information, multiple left mouth corner position information and multiple right mouth corner position information of the target detection object.
[0091] In some embodiments of the present application, the input unit 11 is used to input the target key point position information into the multi-dimensional pose model to obtain the multi-dimensional position information corresponding to the target key point position information;
[0092] The determining unit 13 is used to determine the rotation angle according to the multi-dimensional position information.
[0093] In some embodiments of the present application, the device further comprises an extraction unit and a rejection unit;
[0094] The extraction unit is configured to extract a first detection frame having a maximum score from the multiple detection frames according to the multiple score information;
[0095] The elimination unit is used to eliminate the detection frames whose overlapping area with the first detection frame is greater than a preset area threshold from the multiple detection frames, so as to obtain multiple first candidate detection frames; when the number of the multiple first candidate detection frames is less than or equal to the preset number threshold, the first detection frame is used as the target detection frame.
[0096] In some embodiments of the present application, the extracting unit is configured to, when the number of the plurality of first candidate detection frames is greater than the preset number threshold, continue to extract the second detection frame with the largest score from the plurality of first candidate detection frames;
[0097] The elimination unit is used to eliminate the detection frames whose overlapping area with the second detection frame is greater than a preset area threshold from the multiple first candidate detection frames, so as to obtain multiple second candidate detection frames; and compare the number of the multiple second candidate detection frames with the preset number threshold; until the number of the multiple second candidate detection frames is less than or equal to the preset number threshold, the first detection frame and the second detection frame are used as the target detection frames.
[0098] It should be noted that, in actual applications, the above-mentioned input unit 11, screening unit 12, determination unit 13, rotation unit 14 and display unit 15 can be implemented by a processor 16 on the image processing device 1, specifically a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing) or a Field Programmable Gate Array (FPGA); the above-mentioned data storage can be implemented by a memory 17 on the image processing device 1.
[0099] The embodiment of the present invention further provides an image processing device 1, such as Figure 4 As shown, the image processing device 1 includes: a processor 16, a memory 17 and a communication bus 18. The memory 17 communicates with the processor 16 via the communication bus 18. The memory 17 stores a program executable by the processor 16. When the program is executed, the image processing method described above is executed by the processor 16.
[0100] In practical applications, the memory 17 may be a volatile memory, such as a random access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 16.
[0101] An embodiment of the present invention provides a computer-readable storage medium having a computer program thereon, and when the program is executed by the processor 16 , the image processing method as described above is implemented.
[0102] It can be understood that when the image processing device obtains the original image, the image processing device can input the original image into the detection object recognition model, and use the detection object recognition model to obtain multiple detection frames, multiple score information and multiple key point position information. According to the multiple key point position information, the target detection frame can be determined, and the rotation angle of the original image can be determined using the target key point position information corresponding to the target detection frame. The image processing device can directly rotate the original image according to the rotation angle and display the rotated original image, thereby improving the accuracy of the image processing device during image processing.
[0103] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0104] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can 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 generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.
[0105] These computer program instructions may also 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 comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. An image processing method, characterized in that: The method comprises: When an original image is acquired, the original image is input into a detection object recognition model to obtain a plurality of detection frames corresponding to the target detection object in the original image, a plurality of score information of the plurality of detection frames, and a plurality of key point position information of the target detection object in the plurality of detection frames; wherein the detection object recognition model is obtained by training sample images with different rotation angles; Filtering a target detection frame from the multiple detection frames according to the multiple score information; Determining a rotation angle of the original image according to target key point position information corresponding to the target detection frame, wherein the target key point position information is key point position information corresponding to the target detection frame among the multiple key point position information; the rotation angle of the original image is determined according to multi-dimensional position information determined by the target key point position information; The original image is rotated according to the rotation angle and the rotated original image is displayed.
2. The method according to claim 1, characterized in that Before inputting the original image into the detection object recognition model to obtain multiple detection frames corresponding to the target detection object in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection object in the multiple detection frames, the method further includes: Acquire the sample image, a sample detection frame corresponding to the sample image, sample score information of the sample detection frame, and sample key point position information corresponding to the sample detection frame; Input the sample image into the original detection object recognition model to obtain a to-be-trained sample detection frame, to-be-trained sample score information, and to-be-trained sample key point position information corresponding to the sample image; The original detection object recognition model is trained using the sample detection frame to be trained, the sample score information to be trained, the key point position information of the sample to be trained, the sample score information, the sample key point position information and the sample detection frame to obtain the detection object recognition model.
3. The method according to claim 1, characterized in that The multiple key point position information includes multiple left eye corner position information, multiple right eye corner position information, multiple nose tip position information, multiple left mouth corner position information and multiple right mouth corner position information of the target detection object.
4. The method according to claim 1, characterized in that: The step of determining the rotation angle of the original image according to the target key point position information corresponding to the target detection frame includes: Inputting the target key point position information into a multi-dimensional pose model to obtain multi-dimensional position information corresponding to the target key point position information; The rotation angle is determined according to the multi-dimensional position information.
5. The method according to claim 1, characterized in that The step of selecting a target detection frame from the plurality of detection frames according to the plurality of score information includes: Extracting a first detection frame with the largest score from the multiple detection frames according to the multiple score information; Eliminate, from the multiple detection frames, detection frames whose overlapping areas with the first detection frame are greater than a preset area threshold, to obtain multiple first candidate detection frames; When the number of the plurality of first candidate detection frames is less than or equal to a preset number threshold, the first detection frames are used as the target detection frames.
6. The method according to claim 5, characterized in that After removing detection frames whose overlapping areas with the first detection frame are greater than a preset area threshold from the multiple detection frames to obtain multiple first candidate detection frames, the method further includes: When the number of the plurality of first candidate detection frames is greater than the preset number threshold, continue to extract the second detection frame with the largest score from the plurality of first candidate detection frames; Eliminate, from the multiple first candidate detection frames, detection frames whose overlapping area with the second detection frame is greater than a preset area threshold, to obtain multiple second candidate detection frames; and compare the number of the multiple second candidate detection frames with the preset number threshold; Until the number of the plurality of second candidate detection frames is less than or equal to the preset number threshold, the first detection frame and the second detection frame are used as the target detection frame.
7. An image processing device, characterized in that: The device comprises: An input unit is used to input the original image into a detection object recognition model when an original image is acquired, to obtain multiple detection frames corresponding to the target detection object in the original image, multiple score information of the multiple detection frames, and multiple key point position information of the target detection object in the multiple detection frames; wherein the detection object recognition model is obtained by training sample images with different rotation angles; A screening unit, configured to screen out a target detection frame from the multiple detection frames according to the multiple score information; A determination unit, configured to determine a rotation angle of the original image according to target key point position information corresponding to the target detection frame, wherein the target key point position information is key point position information corresponding to the target detection frame among the plurality of key point position information; the rotation angle of the original image is determined according to multi-dimensional position information determined by the target key point position information; A rotation unit, configured to rotate the original image according to the rotation angle; The display unit is used to display the rotated original image.
8. The device according to claim 7, characterized in that The device also includes an acquisition unit and a training unit; The acquisition unit is used to acquire the sample image, the sample detection frame corresponding to the sample image, the sample score information of the sample detection frame, and the sample key point position information corresponding to the sample detection frame; The input unit is used to input the sample image into the original detection object recognition model to obtain the to-be-trained sample detection frame, to-be-trained sample score information and to-be-trained sample key point position information corresponding to the sample image; The training unit is used to train the original detection object recognition model using the sample detection frame to be trained, the sample score information to be trained, the key point position information of the sample to be trained, the sample score information, the sample key point position information and the sample detection frame to obtain the detection object recognition model.
9. An image processing device, characterized in that: The device comprises: A memory, a processor and a communication bus, wherein the memory communicates with the processor via the communication bus, the memory stores an image processing program executable by the processor, and when the image processing program is executed, the method according to any one of claims 1 to 6 is performed by the processor.
10. A storage medium having a computer program stored thereon, applied to an image processing device, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
