WO2021072883A1 - 基于面部特征点检测的图片纠正方法、装置和计算机设备 - Google Patents

基于面部特征点检测的图片纠正方法、装置和计算机设备 Download PDF

Info

Publication number
WO2021072883A1
WO2021072883A1 PCT/CN2019/118807 CN2019118807W WO2021072883A1 WO 2021072883 A1 WO2021072883 A1 WO 2021072883A1 CN 2019118807 W CN2019118807 W CN 2019118807W WO 2021072883 A1 WO2021072883 A1 WO 2021072883A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
feature point
credential
image
preset
Prior art date
Application number
PCT/CN2019/118807
Other languages
English (en)
French (fr)
Inventor
黄锦伦
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021072883A1 publication Critical patent/WO2021072883A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/242Aligning, centring, orientation detection or correction of the image by image rotation, e.g. by 90 degrees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation

Definitions

  • This application relates to the field of computers, and in particular to a method, device, computer equipment and storage medium for image correction based on facial feature point detection.
  • the angle correction of the document is a very important function, which has a great impact on the accuracy of the text recognition of the document, and also affects the accurate analysis of other aspects of the document. If the ID can be corrected to a standard angle for any angle of the ID card, then the text or image will be very close to the human visual experience, and it will be beneficial to the subsequent image processing technology such as text extraction.
  • Traditional document angle correction requires finding the coordinates of the four vertices of the document.
  • the document can only be corrected to 0 degrees (the standard posture, which is the most suitable posture for viewing or processing), 90 degrees, 180 degrees, and 270 degrees. However, it is impossible to determine which of the four the corrected angle is, so it is not conducive to subsequent image processing. Therefore, the prior art lacks a technical solution for accurately correcting the credential image.
  • the main purpose of this application is to provide an image correction method, device, computer equipment, and storage medium based on facial feature point detection, aiming to accurately correct the document image.
  • this application proposes a method for image correction based on facial feature point detection, which includes the following steps:
  • the four sides of the credential image are detected, and the designated credential image is placed in the first posture to obtain the intermediate credential image, wherein the first posture refers to the four sides A posture parallel to the preset reference line;
  • the intermediate certificate picture is rotated clockwise by a designated angle to obtain a rotated certificate picture, wherein the designated angle is 90 degrees, 180 degrees, and 270 degrees.
  • the rotated certificate picture is recorded as a corrected picture, thereby completing the correction of the designated certificate picture.
  • This application provides a picture correction device based on facial feature point detection, including:
  • a credential picture acquiring unit configured to acquire a designated credential picture including a human face, wherein the credential image in the designated credential picture is rectangular;
  • the credential image edge detection unit is used to detect the four sides of the credential image according to a preset rectangular side detection method, and place the designated credential image in the first posture to obtain an intermediate credential image, wherein the first A posture refers to a posture in which one of the four sides is parallel to a preset reference line;
  • the first feature point quantity acquiring unit is configured to input the intermediate certificate picture into a preset facial feature point detection model for processing to obtain the first feature point quantity output by the facial feature point detection model, wherein the facial feature
  • the point detection model is based on a neural network model and is trained using training data.
  • the training data is only composed of a credential image placed in a standard posture and facial feature points marked in the credential image placed in a standard posture;
  • the first feature point quantity judging unit is configured to judge whether the first feature point quantity is greater than a preset quantity threshold
  • the rotating certificate picture acquiring unit is configured to, if the number of the first feature points is not greater than the preset number threshold, rotate the intermediate certificate picture clockwise by a specified angle to obtain a rotated certificate picture, wherein the specified angle is 90 One of degrees, 180 degrees and 270 degrees;
  • the second feature point quantity acquiring unit is configured to input the rotated ID picture into the facial feature point detection model for processing, obtain the second feature point quantity output by the facial feature point detection model, and determine the second feature point Whether the quantity is greater than the quantity threshold;
  • a picture correction unit is configured to, if the number of second feature points is greater than the number threshold, record the rotated certificate picture as a corrected picture, so as to complete the correction of the designated certificate picture.
  • the present application provides a computer device including a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of any one of the above-mentioned methods when the computer-readable instructions are executed by the processor.
  • the present application provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of any one of the above-mentioned methods are implemented.
  • the image correction method, device, computer equipment, and storage medium based on facial feature point detection of the present application acquire a designated certificate picture including a human face; detect the four sides of the certificate image, and place the designated certificate picture as the first Posture placement to obtain an intermediate credential picture; input the intermediate credential picture into a preset facial feature point detection model for processing to obtain the first feature point number output by the facial feature point detection model; if the first feature If the number of points is not greater than the preset number threshold, the intermediate certificate picture is rotated clockwise by a specified angle to obtain a rotated certificate picture; the rotated certificate picture is input into the facial feature point detection model for processing to obtain the facial features The number of second feature points output by the point detection model, and determine whether the number of second feature points is greater than the number threshold; if the number of second feature points is greater than the number threshold, then the rotated document picture is recorded as The corrected picture. Thereby realizing accurate correction of the credential picture.
  • FIG. 1 is a schematic flowchart of a picture correction method based on facial feature point detection according to an embodiment of the application
  • FIG. 2 is a schematic block diagram of the structure of a picture correction device based on facial feature point detection according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • an embodiment of the present application provides a method for image correction based on facial feature point detection, including the following steps:
  • the preset rectangular edge detection method detect the four sides of the credential image, and place the designated credential image in the first posture to obtain the intermediate credential image, wherein the first posture refers to the four The posture of one of the edges parallel to the preset reference line;
  • a designated certificate picture including a human face is acquired, wherein the certificate image in the designated certificate picture is rectangular.
  • Credential pictures generally include human faces, so the image correction method based on facial feature point detection in this application can be used for most of the credential pictures and has universal applicability.
  • the four sides of the document image are detected, and the designated document image is placed in the first posture to obtain the intermediate document image, wherein the first The posture refers to a posture in which one of the four sides is parallel to a preset reference line. Since the first posture refers to a posture in which one of the four sides is parallel to the preset reference line, the designated ID picture placed in the first posture is at 0 degrees (that is, the standard posture, that is, the most suitable for viewing Or processing posture), one of 90 degrees, 180 degrees, and 270 degrees is displayed.
  • the preset rectangular edge detection method is, for example, obtaining the color values of all pixels in the designated document picture; dividing the designated document picture into multiple blocks, among which the pixels in the same block The difference between the maximum value and the minimum value of the color value is less than the preset color value difference threshold; the longest two line segments are selected from the boundary lines of the multiple blocks, and it is determined whether the two line segments can be regarded as one Two parallel sides of a rectangle; if the two line segments can be regarded as two parallel sides of a rectangle, then the two line segments are recorded as the two parallel sides of the document image, and are represented according to the adjacent sides of the rectangle.
  • the principle of a 90-degree angle is to obtain the other two sides of the document image.
  • the intermediate ID picture is input into a preset facial feature point detection model for processing, and the first feature point quantity output by the facial feature point detection model is obtained, wherein the facial feature point detection model It is based on a neural network model and is trained using training data.
  • the training data is only composed of a credential image placed in a standard posture and facial feature points marked in the credential image placed in a standard posture.
  • the facial feature point detection model used in this application is trained through special training data (that is, only composed of a credential image placed in a standard posture and facial feature points marked in the credential image placed in a standard posture), so the facial feature points
  • the detection model can only detect facial feature points in the ID picture placed in a standard posture.
  • the facial feature point detection model cannot recognize facial feature points, or only a few facial feature points can be recognized. Based on this, it can be used as a basis for judging the placement angle of the credential picture.
  • the standard posture is a pre-set or agreed posture to facilitate unified viewing or unified processing, thereby improving image processing efficiency.
  • the credential picture is displayed on the screen, the face in the credential picture is in a state of facing the viewer in front of each other. From the perspective of the aforementioned first posture and the reference line, one side of the picture placed in the standard state is parallel to the reference line, so the picture placed in the standard state is parallel to the first posture.
  • the placed pictures may have one of four relationships: they are in the same posture, rotated 90 degrees clockwise, rotated 180 degrees clockwise, and rotated 270 degrees clockwise.
  • the facial feature points refer to feature points that can be identified by the facial feature point detection model, such as pupil feature points, nostril feature points, and so on. These feature points can only be recognized in the standard posture (for example, the pupil feature points are symmetrical in the standard posture, and are located in the upper position in the entire face area, while in other postures, such as 90 degrees, the pupil feature points These characteristics will not be detected, that is, the facial feature point detection model will not count it as the first feature point), based on this, the facial feature point detection model can be used as the posture of the intermediate credential image Judgment basis.
  • step S4 it is determined whether the number of the first feature points is greater than a preset number threshold. Since only the credential image placed in the standard posture can be detected with a large number of feature points, this application measures whether the intermediate credential image complies with the standard by judging whether the number of the first feature points is greater than the preset number threshold. Posture placement.
  • the number threshold is preferably 38.
  • the intermediate certificate picture is rotated clockwise by a designated angle to obtain a rotated certificate picture, wherein the designated angle is 90 degrees , 180 degrees and 270 degrees.
  • Rotating the designated angle clockwise is to rotate the ID picture to a standard posture, so as to facilitate subsequent picture processing. Since there are only four angles suitable for viewing or processing a rectangular picture, the intermediate certificate picture is rotated clockwise by a designated angle to obtain a rotated certificate picture, where the designated angle is 90 degrees, 180 degrees, and 270 degrees. You can convert the intermediate certificate picture to one of the remaining three types.
  • step S6 input the rotated ID picture into the facial feature point detection model for processing to obtain the second feature point number output by the facial feature point detection model, and determine whether the second feature point number is greater than The number threshold. If the number of second feature points is greater than the number threshold, it indicates that the rotating ID picture is placed in a standard posture.
  • the facial feature point detection model for detecting the rotated ID picture is the same as the facial feature point detection model for detecting the intermediate ID picture.
  • step S7 if the number of the second feature points is greater than the number threshold, the rotated ID picture is recorded as a corrected picture, thereby completing the correction of the designated ID picture. If the number of second feature points is greater than the number threshold, it can be confirmed that the rotating ID picture is placed in a standard posture. Accordingly, the rotated document picture is recorded as a corrected picture, which is convenient for subsequent picture processing.
  • the step S2 of detecting the four sides of the credential image according to the preset rectangular side detection method includes:
  • the two line segments can be regarded as two parallel sides of a rectangle, record the two line segments as two parallel sides of the document image, and according to the principle that the adjacent sides of the rectangle are at a 90-degree angle To obtain the other two sides of the document image.
  • the four sides of the document image are detected according to the preset rectangular side detection method.
  • This application obtains the color values of all pixels in the designated certificate picture; divides the designated certificate picture into multiple blocks, wherein the maximum and minimum color values of the pixels in the same block are The way the difference is less than the preset color value difference threshold is to block the designated ID picture. Since the collection of the ID picture generally fills most of the image collection interface with the ID picture, the boundary line of multiple blocks is the longest The two line segments of should be the two longer parallel sides of the rectangular document image in the designated document picture.
  • the two line segments are recorded as the two parallel sides of the document image. According to the principle that the adjacent sides of the rectangle are at a 90-degree angle, the other two sides of the document image are obtained, so as to detect the four sides of the document image.
  • the designated credential image includes a name column
  • the intermediate credential image is input into a preset facial feature point detection model for processing to obtain the first feature output by the facial feature point detection model
  • the number of points, where the facial feature point detection model is based on a neural network model and is trained using training data, and the training data is only marked by the credential image placed in the standard posture and the credential image placed in the standard posture it includes:
  • S211 Recognize the name column by using a preset text recognition technology to obtain a name
  • S214 Determine whether the first similarity value, the second similarity value, the third similarity value, and the fourth similarity value are greater than a preset similarity threshold
  • first similarity value, the second similarity value, the third similarity value, and the fourth similarity value are not greater than a preset similarity threshold, generate a first feature point quantity acquisition instruction, and The first feature point quantity acquisition instruction is used to instruct to input the intermediate credential image into a preset facial feature point detection model for processing.
  • the first feature point quantity acquisition instruction is generated, and the first feature point quantity acquisition instruction is used to instruct to input the intermediate credential image into a preset facial feature point detection model for processing. If there is a standard credential picture that is the same as the intermediate credential picture, the posture of the intermediate credential picture can be directly learned, and if it is placed in a standard posture, it can be directly used as the basis for subsequent image processing. Among them, this application recognizes the name column through a preset text recognition technology to obtain the name, so as to find whether there is a standard ID picture with the same name.
  • the first similarity value, the second similarity value, the third similarity value, and the fourth similarity value are not greater than the preset similarity threshold, it indicates that the intermediate credential image is not similar to the standard credential image , So it is necessary to perform facial feature point detection processing. If one of the first similarity value, the second similarity value, the third similarity value, and the fourth similarity value is greater than the preset similarity threshold, the standard ID picture is recorded as a corrected picture, and As the basis for subsequent image processing.
  • the step S213 of calculating the first similarity value between the intermediate credential picture and the standard credential picture according to a preset picture similarity calculation method includes:
  • difference matrix [
  • the intermediate ID picture is input into a preset facial feature point detection model for processing to obtain the first feature point quantity output by the facial feature point detection model, wherein the facial feature point detection
  • the model is based on a neural network model and is trained using training data.
  • the training data consists of only the credential image placed in the standard posture and the facial feature points marked in the credential image placed in the standard posture.
  • sample data consists of only the credential image placed in the standard posture and the facial features marked in the credential image placed in the standard posture Point composition
  • the detection model for facial feature points is obtained.
  • the training data is only composed of the ID picture placed in the standard posture and the facial feature points marked in the ID picture placed in the standard posture
  • the final facial feature point detection model can only recognize the facial features placed in the standard posture. It cannot recognize or fully recognize the facial feature points placed in other postures, which can be used as the basis for detecting the posture of the intermediate ID picture.
  • the neural network model is, for example, a VGG-F model, a ResNet152 model, a DPN131 model, or a DenseNet model.
  • the stochastic gradient descent method is to randomly sample some training data and replace all the training data to improve the training speed. Then use the test data to verify the intermediate detection model, and determine whether the verification passes; if the verification passes, the intermediate detection model is recorded as the facial feature point detection model.
  • the facial feature point detection model is obtained.
  • the method includes:
  • the final certificate picture placed in the first posture is marked as a standard picture.
  • the number of the first feature points is greater than the preset number threshold, it indicates that the first posture is the standard posture, so no rotation processing is required.
  • this application adopts the cutting process of the intermediate certificate image to obtain The final credential image, wherein the cutting process is used to remove useless areas in the intermediate credential image except for the credential image, so as to improve the efficiency of subsequent image processing.
  • the step S5 of rotating the intermediate credential image clockwise by a specified angle to obtain a rotated credential image, wherein the specified angle is one of 90 degrees, 180 degrees, and 270 degrees includes:
  • S502 Determine whether the number of the symmetric feature point pairs is greater than 0;
  • the intermediate certificate picture is rotated clockwise by a specified angle, thereby obtaining a rotated certificate picture. Since the human face is symmetrical, most of the feature points are also symmetrical.
  • the facial feature point detection model can still detect some facial feature points (such as the feature points in the middle of the image, which are easily misidentified; the symmetric feature points in the middle area, such as the nostril feature points. It is also easy to be misunderstood); among these facial feature points, if the first posture is rotated 90 degrees or 270 degrees relative to the standard posture, there should be no symmetrical facial feature points (because after 90 degrees rotation or 270 degrees, it breaks The characteristic of symmetry with the original symmetry axis).
  • the present application obtains the number of symmetric feature point pairs in the first number of feature points, where the symmetric feature point pair takes the vertical line of the designated edge of the document image as the axis of symmetry, and the designated edge Parallel to the reference line; a way of judging whether the number of symmetric feature point pairs is greater than 0, and determining whether it should be rotated 180 degrees clockwise, or 90 degrees or 270 degrees clockwise. If the number of the symmetric feature point pairs is greater than 0, it indicates that there is no symmetric feature point pair. Therefore, rotating the intermediate document picture clockwise by 180 degrees is beneficial to increase the possibility of rotating to a standard posture. The 270 degree method is more efficient.
  • an embodiment of the present application provides a picture correction device based on facial feature point detection, including:
  • the credential picture acquiring unit 10 is configured to acquire a designated credential picture including a human face, wherein the credential image in the designated credential picture is rectangular;
  • the credential image edge detection unit 20 is used to detect the four sides of the credential image according to a preset rectangular edge detection method, and place the designated credential image in the first posture to obtain an intermediate credential image, wherein
  • the first posture refers to a posture in which one of the four sides is parallel to a preset reference line;
  • the first feature point quantity acquiring unit 30 is configured to input the intermediate certificate picture into a preset facial feature point detection model for processing to obtain the first feature point quantity output by the facial feature point detection model, wherein the face
  • the feature point detection model is based on a neural network model and is trained using training data, where the training data is only composed of a credential image placed in a standard posture and facial feature points marked in the credential image placed in a standard posture;
  • the first feature point quantity judging unit 40 is configured to judge whether the first feature point quantity is greater than a preset quantity threshold
  • the rotating certificate picture acquiring unit 50 is configured to, if the number of the first feature points is not greater than a preset number threshold, rotate the intermediate certificate picture clockwise by a specified angle to obtain a rotated certificate picture, where the specified angle is One of 90 degrees, 180 degrees and 270 degrees;
  • the second feature point quantity acquiring unit 60 is configured to input the rotated ID picture into the facial feature point detection model for processing, obtain the second feature point quantity output by the facial feature point detection model, and determine the second feature Whether the number of points is greater than the number threshold;
  • the picture correction unit 70 is configured to, if the number of the second feature points is greater than the number threshold, record the rotated certificate picture as a corrected picture, so as to complete the correction of the designated certificate picture.
  • the document image edge detection unit 20 includes:
  • the color value obtaining subunit is used to obtain the color values of all pixels in the designated certificate picture
  • the two line segment acquisition subunits are used to select the longest two line segments from the boundary lines of the multiple blocks, and determine whether the two line segments can be regarded as two parallel sides of a rectangle;
  • the credential image side acquiring subunit is used to record the two line segments as two parallel sides of the credential image if the two line segments can be regarded as two parallel sides of a rectangle, and according to the adjacent sides of the rectangle Based on the principle that the sides are at a 90-degree angle, the other two sides of the document image are obtained.
  • the designated certificate picture includes a name column
  • the device includes:
  • the name recognition unit is used to recognize the name column through a preset text recognition technology to obtain the name;
  • the standard certificate picture judging unit is used to determine whether a standard certificate picture with the same name is pre-stored, wherein the standard certificate picture is placed in the standard posture;
  • a plurality of similarity value acquisition units are used to calculate the first similarity value between the intermediate certificate picture and the standard certificate picture according to a preset picture similarity calculation method if there are pre-stored standard credential pictures with the same name , And calculating the second similarity value between the intermediate credential picture and the standard credential picture rotated 90 degrees clockwise, and calculating the intermediate credential picture and the standard credential picture rotated 180 degrees clockwise.
  • Multiple similarity value judgment units configured to judge whether the first similarity value, the second similarity value, the third similarity value, and the fourth similarity value are greater than a preset similarity threshold
  • the first feature point quantity acquisition instruction generating unit is configured to generate if the first similarity value, the second similarity value, the third similarity value, and the fourth similarity value are not greater than a preset similarity threshold value A first feature point quantity acquisition instruction, where the first feature point quantity acquisition instruction is used to instruct to input the intermediate certificate picture into a preset facial feature point detection model for processing.
  • the multiple similarity value acquisition units include:
  • the pixel matrix generating subunit is used to obtain the color values of the pixels of the intermediate credential picture and the color values of the pixels of the standard credential picture, and generate the pixel matrix A of the intermediate credential picture and the standard The pixel matrix B of the credential picture, wherein the pixel matrix A and the pixel matrix B are both m ⁇ n matrices;
  • the device includes:
  • the sample data acquisition unit is used to acquire pre-collected sample data, and divide the sample data into training data and test data; wherein, the sample data consists of only the credential image placed in the standard posture and the credential image placed in the standard posture The composition of facial feature points marked in;
  • the intermediate detection model acquisition unit is configured to use the training data to train a preset neural network model, where the stochastic gradient descent method is used for training to obtain the intermediate detection model;
  • the intermediate detection model verification unit is used to verify the intermediate detection model by using the test data and determine whether the verification is passed;
  • the facial feature point detection model marking unit is configured to record the intermediate detection model as the facial feature point detection model if the verification is passed.
  • the device includes:
  • a cutting unit configured to perform cutting processing on the intermediate credential image if the number of the first feature points is greater than a preset number threshold, so as to obtain a final credential image, wherein the cutting processing is used to use the intermediate credential image Remove the area other than the document image;
  • the standard picture marking unit is used to mark the final certificate picture placed in the first posture as a standard picture.
  • the rotating certificate picture obtaining unit 50 includes:
  • the quantity acquisition subunit is used to acquire the number of symmetric feature point pairs in the first number of feature points, wherein the symmetric feature point pair takes the vertical line of the designated edge of the document image as the symmetry axis, and the designated The edge is parallel to the reference line;
  • the quantity judgment subunit is used to judge whether the quantity of the symmetry feature point pair is greater than 0;
  • the rotation subunit is configured to rotate the intermediate document picture clockwise by 180 degrees if the number of the symmetric feature point pairs is greater than 0.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in the figure.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor designed by the computer is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store the data used in the image correction method based on facial feature point detection.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions are executed by the processor to realize a method of image correction based on facial feature point detection.
  • the above-mentioned processor executes the above-mentioned image correction method based on facial feature point detection, wherein the steps included in the method respectively correspond one-to-one with the steps of executing the image correction method based on facial feature point detection in the foregoing embodiment, and will not be repeated here.
  • An embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions (or computer programs) are stored.
  • computer-readable instructions or computer programs
  • a method for image correction based on facial feature point detection is implemented.
  • the steps included in the method respectively correspond to the steps of the image correction method based on facial feature point detection in the foregoing embodiment, and are not repeated here.
  • the computer-readable storage medium is, for example, a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

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

Abstract

一种基于面部特征点检测的图片纠正方法、装置、计算机设备和存储介质,所述方法包括:获取包括人脸的指定证件图片;将所述指定证件图片按第一姿态放置,从而得到中间证件图片;将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到第一特征点数量;若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片;将旋转证件图片输入面部特征点检测模型中进行处理,得到第二特征点数量,并判断第二特征点数量是否大于所述数量阈值;若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片。从而实现了对证件图片进行准确纠正。

Description

基于面部特征点检测的图片纠正方法、装置和计算机设备
本申请要求于2019年10月16日提交中国专利局、申请号为2019109851204,发明名称为“基于面部特征点检测的图片纠正方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及到计算机领域,特别是涉及到一种基于面部特征点检测的图片纠正方法、装置、计算机设备和存储介质。
背景技术
随着人工智能的发展,人工智能对证件的分析的场景越来越多。证件的角度纠正是十分重要的一个功能,对于证件的文字识别准确率有很大的影响,同时也影响对证件其他方面的准确分析。如果对于任一角度身份证件都能将证件最后纠正到标准角度,那么文字或者图像都会很贴近人的视觉感受,并且有利于后面的文字提取等图像处理技术。传统的证件角度纠正,需要找到证件的四个顶点坐标,最后只能把证件纠正到0度(即标准姿态,也即最适于观看或处理的姿态)、90度、180度、270度中的一者,但是无法确定纠正后的角度是这四者中的哪一者,因此不利于后续的图像处理。因此现有技术缺乏对证件图片进行准确纠正的技术方案。
技术问题
本申请的主要目的为提供一种基于面部特征点检测的图片纠正方法、装置、计算机设备和存储介质,旨在对证件图片进行准确纠正。
技术解决方案
为了实现上述目的,本申请提出一种基于面部特征点检测的图片纠正方法,包括以下步骤:
获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
判断所述第一特征点数量是否大于预设的数量阈值;
若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
本申请提供一种基于面部特征点检测的图片纠正装置,包括:
证件图片获取单元,用于获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
证件图像边检测单元,用于根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
第一特征点数量获取单元,用于将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
第一特征点数量判断单元,用于判断所述第一特征点数量是否大于预设的数量阈值;
旋转证件图片获取单元,用于若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
第二特征点数量获取单元,用于将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
图片纠正单元,用于若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
本申请提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现上述任一项所述方法的步骤。
本申请提供一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述任一项所述的方法的步骤。
有益效果
本申请的基于面部特征点检测的图片纠正方法、装置、计算机设备和存储介质,获取包括人脸的指定证件图片;检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片;将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量;若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片;将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片。从而实现了对证件图片进行准确纠正。
附图说明
图1 为本申请一实施例的基于面部特征点检测的图片纠正方法的流程示意图;
图2 为本申请一实施例的基于面部特征点检测的图片纠正装置的结构示意框图;
图3 为本申请一实施例的计算机设备的结构示意框图。
本申请的最佳实施方式
参照图1,本申请实施例提供一种基于面部特征点检测的图片纠正方法,包括以下步骤:
S1、获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
S2、根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
S3、将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
S4、判断所述第一特征点数量是否大于预设的数量阈值;
S5、若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
S6、将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
S7、若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
如上述步骤S1所述,获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状。证件图片一般都包括人脸,因此本申请的基于面部特征点检测的图片纠正方法可用于大部分证件图片,具有普适性。
如上述步骤S2所述,根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态。由于所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态,因此按第一姿态放置的指定证件图片即为以0度(即标准姿态,也即最适于观看或处理的姿态)、90度、180度、270度中的一者进行展示的状态。其中,预设的矩形边检测方法例如为:获取所述指定证件图片中的所有像素点的色值;将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
如上述步骤S3所述,将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成。本申请采用的面部特征点检测模型是通过特殊的训练数据(即仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成)训练而成,因此面部特征点检测模型只能检测出按标准姿态放置的证件图片中的面部特征点。当证件图片不按标准姿态放置时,面部特征点检测模型识别不出面部特征点,或者,只能识别出少量面部特征点。据此,可以作为判断证件图片的摆放角度的依据。其中,所述标准姿态是预先设置或约定的一种姿态,以便于统一观看或统一处理,从而提高图片处理效率。具体地,优选将证件图片展示在屏幕上时,所述证件图片中的人脸与观看者呈正向对视状态。再从与前述第一姿态和所述参考线的角度来看,所述标准资态放置的图片的一条边与所述参考线平行,因此所述标准资态放置的图片与所述第一姿态放置的图片可能存在四种关系中的一种:呈相同姿态、呈顺时针旋转90度角的姿态、呈顺时针旋转180度角的姿态、呈顺时针旋转270度角的姿态。其中所述面部特征点指面部特征点检测模型能够识别出来的特征点,例如为瞳仁特征点、鼻孔特征点等等。这些特征点仅能在标准姿态时被认别(例如瞳仁特征点在标准姿态中有对称特性,且在整个人脸区域中处于靠上的位置,而处于其他姿态例如90度时,瞳仁特征点的这些特性不会被检测到,也即面部特征点检测模型不会将其计入第一特征点),据此可利用面部特征点检测模型作为所述中间证件图片是以何种姿态放置的判断基础。
如上述步骤S4所述,判断所述第一特征点数量是否大于预设的数量阈值。由于只有处于标准姿态放置的证件图片才能被检测出大量的特征点,因此本申请通过判断所述第一特征点数量是否大于预设的数量阈值的方式,来衡量所述中间证件图片是否按标准姿态放置。其中所述数量阈值优选为38。
如上述步骤S5所述,若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者。其中顺时针旋转指定角度,是为了将证件图片旋转至标准姿态,从而便于后续的图片处理。由于矩形图片适于观看或处理的角度被仅有四种,因此将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者,即可将中间证件图片转为剩余三种中的一种。
如上述步骤S6所述,将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值。若第二特征点数量大于所述数量阈值,表明旋转证件图片是按标准姿态放置的。其中,对旋转证件图片进行检测的面部特征点检测模型与对中间证件图片进行检测的面部特征点检测模型相同。
如上述步骤S7所述,若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。若所述第二特征点数量大于所述数量阈值,可确认旋转证件图片是按标准姿态放置的。据此,将所述旋转证件图片记为纠正后的图片,便于后续的图片处理。
在一个实施方式中,所述根据预设的矩形边检测方法,检测出所述证件图像的四条边的步骤S2,包括:
S201、获取所述指定证件图片中的所有像素点的色值;
S202、将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
S203、从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
S204、若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
如上所述,实现了根据预设的矩形边检测方法,检测出所述证件图像的四条边。本申请通过获取所述指定证件图片中的所有像素点的色值;将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值的方式,将指定证件图片区块化,而由于证件图片的采集一般将证件图片填充图像采集界面中的大部分,因此多个区块的交界线中最长的两条线段,应是指定证件图片中的矩形证件图像的较长的两个平行边。再通过判断所述两条线段是否能作为一个矩形的两条平行边;若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边,从而检测出所述证件图像的四条边。
在一个实施方式中,所述指定证件图片中包括姓名栏,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤S3之前,包括:
S211、通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
S212、判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
S213、若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
S214、判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
S215、若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
如上所述,实现了生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。若预存有与所述中间证件图片相同的标准证件图片,则可直接获知中间证件图片的摆放姿势,若为标准姿势摆放,则可直接作为后续图片处理的基础。其中,本申请通过预设的文字识别技术识别所述姓名栏,从而得到姓名,从而寻找是否有相同姓名的标准证件图片。若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,表明所述中间证件图片与所述标准证件图片不相似,因此需要进行面部特征点检测处理。若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值中有一者大于预设的相似度阈值,则将标准证件图片记为纠正后的图片,可作为后续图片处理的基础。
在一个实施方式中,所述根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值的步骤S213,包括:
S2131、获取所述中间证件图片的像素点的色值和所述标准证件图片的像素点的色值,并生成所述中间证件图片的像素点矩阵A和所述标准证件图片的像素点矩阵B,其中所述像素点矩阵A和所述像素点矩阵B均为m×n矩阵;
S2132、根据公式:C=[Aij/avg(Aij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵C,其中Aij为像素点矩阵A中第i行第j列的数值;以及根据公式:D=[Bij/avg(Bij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵D,其中Bij为像素点矩阵B中第i行第j列的数值;
S2133、根据公式:差值矩阵=[|Cij-Dij|],获取所述差值矩阵,统计所述差值矩阵中数值小于预设的差值阈值的元素数量,并将所述元素数量计为所述第一相似度值。
如上所述,实现了计算所述中间证件图片与所述标准证件图片间的第一相似度值。若所述中间证件图片与所述标准证件图片相似,那么对应的像素点的色值也应大致相同。据此,本申请根据公式:C=[Aij/avg(Aij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵C,其中Aij为像素点矩阵A中第i行第j列的数值;以及根据公式:D=[Bij/avg(Bij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵D,其中Bij为像素点矩阵B中第i行第j列的数值;根据公式:差值矩阵=[|Cij-Dij|],获取所述差值矩阵,统计所述差值矩阵中数值小于预设的差值阈值的元素数量,并将所述元素数量计为所述第一相似度值,从而得到所述中间证件图片与所述标准证件图片间的第一相似度值。
在一个实施方式中,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤S3之前,包括:
S221、获取预先收集的样本数据,并将所述样本数据分成训练数据和测试数据;其中,所述样本数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
S222、利用所述训练数据训练预设的神经网络模型,其中训练的采用随机梯度下降法,从而得到中间检测模型;
S223、利用所述测试数据验证所述中间检测模型,并判断是否验证通过;
S224、若验证通过,则将所述中间检测模型记为所述面部特征点检测模型。
如上所述,实现了获取所述面部特征点检测模型。其中,由于训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成,因此最终得到的面部特征点检测模型也仅能识别出标准姿态放置的面部特征点,而无法识别或者无法完全识别其他姿态放置的面部特征点,从而能够作为检测中间证件图片放置姿态的依据。其中,神经网络模型例如为VGG-F模型、ResNet152模型、DPN131模型或者DenseNet模型等。随机梯度下降法是随机取样一些训练数据,替代所有训练数据,用以提高训练速度。再利用所述测试数据验证所述中间检测模型,并判断是否验证通过;若验证通过,则将所述中间检测模型记为所述面部特征点检测模型。从而得到面部特征点检测模型。
在一个实施方式中,所述判断所述第一特征点数量是否大于预设的数量阈值的步骤S4之后,包括:
S41、若所述第一特征点数量大于预设的数量阈值,则对所述中间证件图片进行切削处理,从而得到最终证件图片,其中所述切削处理用于将所述中间证件图片中除所述证件图像之外的区域去除;
S42、将按所述第一姿态放置的所述最终证件图片标记为标准图片。
如上所述,实现了将按所述第一姿态放置的所述最终证件图片标记为标准图片。其中,若所述第一特征点数量大于预设的数量阈值,表明第一姿态即为标准姿态,因此无需进行旋转处理。但是由于中间证件图片中存在矩形证件图像之外的其他无用区域,这在后续的图片处理中会带来不必要的算力浪费,因此本申请采用对所述中间证件图片进行切削处理,从而得到最终证件图片,其中所述切削处理用于将所述中间证件图片中除所述证件图像之外的区域去除的方式,将无用区域去除,以提高后续图片处理的效率。
在一个实施方式中,所述将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者的步骤S5,包括:
S501、获取所述第一特征点数量中的对称特征点对的数量,其中所述对称特征点对以所述证件图像的指定边的中垂线为对称轴,所述指定边与所述参考线平行;
S502、判断所述对称特征点对的数量是否大于0;
S503、若所述对称特征点对的数量大于0,则将所述中间证件图片顺时针旋转180度。
如上所述,实现了将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片。由于人脸是对称的,因此特征点中大部分也是对称的。当第一姿态不是标准姿态时,面部特征点检测模型仍能检测出一些面部特征点(例如处于图像正中间区域的特征点,容易被误识;处于较中间区域的对称特征点例如鼻孔特征点也容易被误识);在这些面部特征点中,若第一姿态相对于标准姿态呈90度旋转或270度时,不应存在对称的面部特征点(因为90度旋转或270度后,打破了以原对称轴对称的特性)。据此,本申请通过获取所述第一特征点数量中的对称特征点对的数量,其中所述对称特征点对以所述证件图像的指定边的中垂线为对称轴,所述指定边与所述参考线平行;判断所述对称特征点对的数量是否大于0的方式,确定是应该顺时针旋转180度,还是应该顺时针旋转90度或270度。若所述对称特征点对的数量大于0,表明无对称特征点对,因此将所述中间证件图片顺时针旋转180度,有利于提高旋转为标准姿态的可能性,相对于先旋转90度或270度的方式,效率更高。
参照图2,本申请实施例提供一种基于面部特征点检测的图片纠正装置,包括:
证件图片获取单元10,用于获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
证件图像边检测单元20,用于根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
第一特征点数量获取单元30,用于将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
第一特征点数量判断单元40,用于判断所述第一特征点数量是否大于预设的数量阈值;
旋转证件图片获取单元50,用于若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
第二特征点数量获取单元60,用于将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
图片纠正单元70,用于若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
其中上述单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述证件图像边检测单元20,包括:
色值获取子单元,用于获取所述指定证件图片中的所有像素点的色值;
区块划分子单元,用于将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
两条线段获取子单元,用于从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
证件图像边获取子单元,用于若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
其中上述子单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述指定证件图片中包括姓名栏,所述装置,包括:
姓名识别单元,用于通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
标准证件图片判断单元,用于判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
多个相似度值获取单元,用于若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
多个相似度值判断单元,用于判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
第一特征点数量获取指令生成单元,用于若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
其中上述单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述多个相似度值获取单元,包括:
像素点矩阵生成子单元,用于获取所述中间证件图片的像素点的色值和所述标准证件图片的像素点的色值,并生成所述中间证件图片的像素点矩阵A和所述标准证件图片的像素点矩阵B,其中所述像素点矩阵A和所述像素点矩阵B均为m×n矩阵;
矩阵C生成子单元,用于根据公式:C=[Aij/avg(Aij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵C,其中Aij为像素点矩阵A中第i行第j列的数值;以及根据公式:D=[Bij/avg(Bij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵D,其中Bij为像素点矩阵B中第i行第j列的数值;
第一相似度值获取子单元,用于根据公式:差值矩阵=[|Cij-Dij|],获取所述差值矩阵,统计所述差值矩阵中数值小于预设的差值阈值的元素数量,并将所述元素数量计为所述第一相似度值。
其中上述子单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述装置,包括:
样本数据获取单元,用于获取预先收集的样本数据,并将所述样本数据分成训练数据和测试数据;其中,所述样本数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
中间检测模型获取单元,用于利用所述训练数据训练预设的神经网络模型,其中训练的采用随机梯度下降法,从而得到中间检测模型;
中间检测模型验理单元,用于利用所述测试数据验证所述中间检测模型,并判断是否验证通过;
面部特征点检测模型标记单元,用于若验证通过,则将所述中间检测模型记为所述面部特征点检测模型。
其中上述单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述装置,包括:
切削单元,用于若所述第一特征点数量大于预设的数量阈值,则对所述中间证件图片进行切削处理,从而得到最终证件图片,其中所述切削处理用于将所述中间证件图片中除所述证件图像之外的区域去除;
标准图片标记单元,用于将按所述第一姿态放置的所述最终证件图片标记为标准图片。
其中上述单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述旋转证件图片获取单元50,包括:
数量获取子单元,用于获取所述第一特征点数量中的对称特征点对的数量,其中所述对称特征点对以所述证件图像的指定边的中垂线为对称轴,所述指定边与所述参考线平行;
数量判断子单元,用于判断所述对称特征点对的数量是否大于0;
旋转子单元,用于若所述对称特征点对的数量大于0,则将所述中间证件图片顺时针旋转180度。
其中上述子单元分别用于执行的操作与前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储基于面部特征点检测的图片纠正方法所用数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种基于面部特征点检测的图片纠正方法。
上述处理器执行上述基于面部特征点检测的图片纠正方法,其中所述方法包括的步骤分别与执行前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。
本领域技术人员可以理解,图中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机可读存储介质,其上存储有计算机可读指令(或称计算机程序),计算机可读指令被处理器执行时实现基于面部特征点检测的图片纠正方法,其中所述方法包括的步骤分别与执行前述实施方式的基于面部特征点检测的图片纠正方法的步骤一一对应,在此不再赘述。其中计算机可读存储介质,例如为非易失性的计算机可读存储介质,或者为易失性的计算机可读存储介质。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于面部特征点检测的图片纠正方法,其特征在于,包括:
    获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
    根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
    将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    判断所述第一特征点数量是否大于预设的数量阈值;
    若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
    将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
    若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
  2. 根据权利要求1所述的基于面部特征点检测的图片纠正方法,其特征在于,所述根据预设的矩形边检测方法,检测出所述证件图像的四条边的步骤,包括:
    获取所述指定证件图片中的所有像素点的色值;
    将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
    从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
    若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
  3. 根据权利要求1所述的基于面部特征点检测的图片纠正方法,其特征在于,所述指定证件图片中包括姓名栏,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤之前,包括:
    通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
    判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
    若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
    判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
    若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
  4. 根据权利要求3所述的基于面部特征点检测的图片纠正方法,其特征在于,所述根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值的步骤,包括:
    获取所述中间证件图片的像素点的色值和所述标准证件图片的像素点的色值,并生成所述中间证件图片的像素点矩阵A和所述标准证件图片的像素点矩阵B,其中所述像素点矩阵A和所述像素点矩阵B均为m×n矩阵;
    根据公式:C=[Aij/avg(Aij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵C,其中Aij为像素点矩阵A中第i行第j列的数值;以及根据公式:D=[Bij/avg(Bij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵D,其中Bij为像素点矩阵B中第i行第j列的数值;
    根据公式:差值矩阵=[|Cij-Dij|],获取所述差值矩阵,统计所述差值矩阵中数值小于预设的差值阈值的元素数量,并将所述元素数量计为所述第一相似度值。
  5. 根据权利要求1所述的基于面部特征点检测的图片纠正方法,其特征在于,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤之前,包括:
    获取预先收集的样本数据,并将所述样本数据分成训练数据和测试数据;其中,所述样本数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    利用所述训练数据训练预设的神经网络模型,其中训练的采用随机梯度下降法,从而得到中间检测模型;
    利用所述测试数据验证所述中间检测模型,并判断是否验证通过;
    若验证通过,则将所述中间检测模型记为所述面部特征点检测模型。
  6. 根据权利要求1所述的基于面部特征点检测的图片纠正方法,其特征在于,所述判断所述第一特征点数量是否大于预设的数量阈值的步骤之后,包括:
    若所述第一特征点数量大于预设的数量阈值,则对所述中间证件图片进行切削处理,从而得到最终证件图片,其中所述切削处理用于将所述中间证件图片中除所述证件图像之外的区域去除;
    将按所述第一姿态放置的所述最终证件图片标记为标准图片。
  7. 根据权利要求1所述的基于面部特征点检测的图片纠正方法,其特征在于,所述将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者的步骤,包括:
    获取所述第一特征点数量中的对称特征点对的数量,其中所述对称特征点对以所述证件图像的指定边的中垂线为对称轴,所述指定边与所述参考线平行;
    判断所述对称特征点对的数量是否大于0;
    若所述对称特征点对的数量大于0,则将所述中间证件图片顺时针旋转180度。
  8. 一种基于面部特征点检测的图片纠正装置,其特征在于,包括:
    证件图片获取单元,用于获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
    证件图像边检测单元,用于根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
    第一特征点数量获取单元,用于将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    第一特征点数量判断单元,用于判断所述第一特征点数量是否大于预设的数量阈值;
    旋转证件图片获取单元,用于若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
    第二特征点数量获取单元,用于将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
    图片纠正单元,用于若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
  9. 根据权利要求8所述的基于面部特征点检测的图片纠正装置,其特征在于,所述证件图像边检测单元,包括:
    色值获取子单元,用于获取所述指定证件图片中的所有像素点的色值;
    区块划分子单元,用于将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
    两条线段获取子单元,用于从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
    证件图像边获取子单元,用于若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
  10. 根据权利要求8所述的基于面部特征点检测的图片纠正装置,其特征在于,所述指定证件图片中包括姓名栏,所述装置,包括:
    姓名识别单元,用于通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
    标准证件图片判断单元,用于判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
    多个相似度值获取单元,用于若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
    多个相似度值判断单元,用于判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
    第一特征点数量获取指令生成单元,用于若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
  11. 根据权利要求10所述的基于面部特征点检测的图片纠正装置,其特征在于,所述多个相似度值获取单元,包括:
    像素点矩阵生成子单元,用于获取所述中间证件图片的像素点的色值和所述标准证件图片的像素点的色值,并生成所述中间证件图片的像素点矩阵A和所述标准证件图片的像素点矩阵B,其中所述像素点矩阵A和所述像素点矩阵B均为m×n矩阵;
    矩阵C生成子单元,用于根据公式:C=[Aij/avg(Aij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵C,其中Aij为像素点矩阵A中第i行第j列的数值;以及根据公式:D=[Bij/avg(Bij)],其中i=1,2,...,m,j=1,2,...,n,获取矩阵D,其中Bij为像素点矩阵B中第i行第j列的数值;
    第一相似度值获取子单元,用于根据公式:差值矩阵=[|Cij-Dij|],获取所述差值矩阵,统计所述差值矩阵中数值小于预设的差值阈值的元素数量,并将所述元素数量计为所述第一相似度值。
  12. 根据权利要求8所述的基于面部特征点检测的图片纠正装置,其特征在于,所述装置,包括:
    样本数据获取单元,用于获取预先收集的样本数据,并将所述样本数据分成训练数据和测试数据;其中,所述样本数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    中间检测模型获取单元,用于利用所述训练数据训练预设的神经网络模型,其中训练的采用随机梯度下降法,从而得到中间检测模型;
    中间检测模型验理单元,用于利用所述测试数据验证所述中间检测模型,并判断是否验证通过;
    面部特征点检测模型标记单元,用于若验证通过,则将所述中间检测模型记为所述面部特征点检测模型。
  13. 根据权利要求8所述的基于面部特征点检测的图片纠正装置,其特征在于,所述装置,包括:
    切削单元,用于若所述第一特征点数量大于预设的数量阈值,则对所述中间证件图片进行切削处理,从而得到最终证件图片,其中所述切削处理用于将所述中间证件图片中除所述证件图像之外的区域去除;
    标准图片标记单元,用于将按所述第一姿态放置的所述最终证件图片标记为标准图片。
  14. 根据权利要求8所述的基于面部特征点检测的图片纠正装置,其特征在于,所述旋转证件图片获取单元,包括:
    数量获取子单元,用于获取所述第一特征点数量中的对称特征点对的数量,其中所述对称特征点对以所述证件图像的指定边的中垂线为对称轴,所述指定边与所述参考线平行;
    数量判断子单元,用于判断所述对称特征点对的数量是否大于0;
    旋转子单元,用于若所述对称特征点对的数量大于0,则将所述中间证件图片顺时针旋转180度。
  15. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现基于面部特征点检测的图片纠正方法,所述基于面部特征点检测的图片纠正方法,包括:
    获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
    根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
    将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    判断所述第一特征点数量是否大于预设的数量阈值;
    若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
    将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
    若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
  16. 根据权利要求15所述的计算机设备,其特征在于,所述根据预设的矩形边检测方法,检测出所述证件图像的四条边的步骤,包括:
    获取所述指定证件图片中的所有像素点的色值;
    将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
    从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
    若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
  17. 根据权利要求15所述的计算机设备,其特征在于,所述指定证件图片中包括姓名栏,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤之前,包括:
    通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
    判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
    若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
    判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
    若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
  18. 一种计算机可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现基于面部特征点检测的图片纠正方法,所述基于面部特征点检测的图片纠正方法,包括:
    获取包括人脸的指定证件图片,其中所述指定证件图片中的证件图像呈矩形状;
    根据预设的矩形边检测方法,检测出所述证件图像的四条边,并将所述指定证件图片按第一姿态放置,从而得到中间证件图片,其中所述第一姿态指所述四条边中的一条与预设的参考线平行的姿态;
    将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成;
    判断所述第一特征点数量是否大于预设的数量阈值;
    若所述第一特征点数量不大于预设的数量阈值,则将所述中间证件图片顺时针旋转指定角度,从而得到旋转证件图片,其中所述指定角度为90度、180度和270度中的一者;
    将旋转证件图片输入所述面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第二特征点数量,并判断所述第二特征点数量是否大于所述数量阈值;
    若所述第二特征点数量大于所述数量阈值,则将所述旋转证件图片记为纠正后的图片,从而完成对所述指定证件图片的纠正。
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述根据预设的矩形边检测方法,检测出所述证件图像的四条边的步骤,包括:
    获取所述指定证件图片中的所有像素点的色值;
    将所述指定证件图片划分为多个区块,其中同一个区块中的像素点的色值的最大值与最小值之差小于预设的色值差阈值;
    从所述多个区块的交界线中选出最长的两条线段,并判断所述两条线段是否能作为一个矩形的两条平行边;
    若所述两条线段能作为一个矩形的两条平行边,则将所述两条线段记为所述证件图像的两条平行边,并根据矩形的相邻边呈90度角的原理,获取所述证件图像的另外两条边。
  20. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述指定证件图片中包括姓名栏,所述将所述中间证件图片输入预设的面部特征点检测模型中进行处理,得到所述面部特征点检测模型输出的第一特征点数量,其中所述面部特征点检测模型是基于神经网络模型,并利用训练数据进行训练而成,所述训练数据仅由标准姿态放置的证件图片和所述标准姿态放置的证件图片中标注的面部特征点构成的步骤之前,包括:
    通过预设的文字识别技术识别所述姓名栏,从而得到姓名;
    判断是否预存有相同姓名的标准证件图片,其中所述标准证件图片按所述标准姿态放置;
    若预存有相同姓名的标准证件图片,则根据预设的图片相似度计算方法,计算所述中间证件图片与所述标准证件图片间的第一相似度值,以及计算所述中间证件图片与顺时针旋转90度后的所述标准证件图片间的第二相似度值,以及计算所述中间证件图片与顺时针旋转180度后的所述标准证件图片间的第三相似度值,以及计算所述中间证件图片与顺时针旋转270度后的所述标准证件图片间的第四相似度值;
    判断所述第一相似度值、第二相似度值、第三相似度值和第四相似度值是否大于预设的相似度阈值;
    若所述第一相似度值、第二相似度值、第三相似度值和第四相似度值均不大于预设的相似度阈值,则生成第一特征点数量获取指令,所述第一特征点数量获取指令用于指示将所述中间证件图片输入预设的面部特征点检测模型中进行处理。
PCT/CN2019/118807 2019-10-16 2019-11-15 基于面部特征点检测的图片纠正方法、装置和计算机设备 WO2021072883A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910985120.4A CN111126376B (zh) 2019-10-16 2019-10-16 基于面部特征点检测的图片纠正方法、装置和计算机设备
CN201910985120.4 2019-10-16

Publications (1)

Publication Number Publication Date
WO2021072883A1 true WO2021072883A1 (zh) 2021-04-22

Family

ID=70495386

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118807 WO2021072883A1 (zh) 2019-10-16 2019-11-15 基于面部特征点检测的图片纠正方法、装置和计算机设备

Country Status (2)

Country Link
CN (1) CN111126376B (zh)
WO (1) WO2021072883A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113436079A (zh) * 2021-06-23 2021-09-24 平安科技(深圳)有限公司 证件图像检测方法和装置、电子设备、存储介质
CN116416671B (zh) * 2023-06-12 2023-10-03 太平金融科技服务(上海)有限公司深圳分公司 一种人脸图像旋正方法、装置、电子设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295638A (zh) * 2016-07-29 2017-01-04 北京小米移动软件有限公司 证件图像倾斜校正方法和装置
US9811716B2 (en) * 2014-11-21 2017-11-07 Korea Institute Of Science And Technology Method for face recognition through facial expression normalization, recording medium and device for performing the method
CN109034165A (zh) * 2018-07-06 2018-12-18 北京中安未来科技有限公司 一种证件图像的裁切方法、装置、系统及存储介质
CN109961064A (zh) * 2019-03-20 2019-07-02 深圳市华付信息技术有限公司 身份证文本定位方法、装置、计算机设备及存储介质
CN110163114A (zh) * 2019-04-25 2019-08-23 厦门瑞为信息技术有限公司 一种人脸角度及人脸模糊度分析方法、系统和计算机设备
CN110287913A (zh) * 2019-06-28 2019-09-27 京东数字科技控股有限公司 图像矫正提示方法和装置、用户终端和存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4946730B2 (ja) * 2007-08-27 2012-06-06 ソニー株式会社 顔画像処理装置及び顔画像処理方法、並びにコンピュータ・プログラム
KR20140022627A (ko) * 2012-08-14 2014-02-25 삼성테크윈 주식회사 인증 장치 및 방법
CN110210341B (zh) * 2019-05-20 2022-12-06 深圳供电局有限公司 基于人脸识别的身份证认证方法及其系统、可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9811716B2 (en) * 2014-11-21 2017-11-07 Korea Institute Of Science And Technology Method for face recognition through facial expression normalization, recording medium and device for performing the method
CN106295638A (zh) * 2016-07-29 2017-01-04 北京小米移动软件有限公司 证件图像倾斜校正方法和装置
CN109034165A (zh) * 2018-07-06 2018-12-18 北京中安未来科技有限公司 一种证件图像的裁切方法、装置、系统及存储介质
CN109961064A (zh) * 2019-03-20 2019-07-02 深圳市华付信息技术有限公司 身份证文本定位方法、装置、计算机设备及存储介质
CN110163114A (zh) * 2019-04-25 2019-08-23 厦门瑞为信息技术有限公司 一种人脸角度及人脸模糊度分析方法、系统和计算机设备
CN110287913A (zh) * 2019-06-28 2019-09-27 京东数字科技控股有限公司 图像矫正提示方法和装置、用户终端和存储介质

Also Published As

Publication number Publication date
CN111126376A (zh) 2020-05-08
CN111126376B (zh) 2022-08-23

Similar Documents

Publication Publication Date Title
WO2020037898A1 (zh) 人脸特征点检测方法、装置、计算机设备及存储介质
WO2018028546A1 (zh) 一种关键点的定位方法及终端、计算机存储介质
WO2019033574A1 (zh) 电子装置、动态视频人脸识别的方法、系统及存储介质
CN108369785A (zh) 活性检测
CN111598038B (zh) 脸部特征点检测方法、装置、设备及存储介质
CN110689000B (zh) 一种基于生成复杂环境下车牌样本的车辆车牌识别方法
CN109918523B (zh) 一种基于yolo9000算法的电路板元器件检测方法
US10037708B2 (en) Method and system for analyzing exam-taking behavior and improving exam-taking skills
WO2021151313A1 (zh) 证件鉴伪方法、装置、电子设备及存储介质
CN108509988B (zh) 一种试卷分数自动统计方法、装置、电子设备及存储介质
WO2020155485A1 (zh) 图片差异性判断方法、装置、计算机设备和存储介质
WO2021072883A1 (zh) 基于面部特征点检测的图片纠正方法、装置和计算机设备
CN113887408B (zh) 活化人脸视频的检测方法、装置、设备及存储介质
CN113033543B (zh) 曲形文本识别方法、装置、设备及介质
CN110163567A (zh) 基于多任务级联卷积神经网络的课堂点名系统
Khanam et al. Implementation of the pHash algorithm for face recognition in a secured remote online examination system
TWI803243B (zh) 圖像擴增方法、電腦設備及儲存介質
WO2021128682A1 (zh) 基于机器学习的网页渲染方法、装置和计算机设备
WO2019061660A1 (zh) 招聘方法、电子装置及可读存储介质
CN113705469A (zh) 人脸识别方法、装置、电子设备及计算机可读存储介质
CN112836682A (zh) 视频中对象的识别方法、装置、计算机设备和存储介质
WO2021073150A1 (zh) 数据检测方法、装置、计算机设备和存储介质
CN112541436B (zh) 专注度分析方法、装置、电子设备及计算机存储介质
CN116310976A (zh) 学习习惯养成方法、装置、电子设备及存储介质
CN113240043B (zh) 基于多图片差异性的鉴伪方法、装置、设备及存储介质

Legal Events

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

Ref document number: 19949155

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19949155

Country of ref document: EP

Kind code of ref document: A1