WO2022134831A1 - 证件图片生成方法、装置、设备及存储介质 - Google Patents

证件图片生成方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022134831A1
WO2022134831A1 PCT/CN2021/126108 CN2021126108W WO2022134831A1 WO 2022134831 A1 WO2022134831 A1 WO 2022134831A1 CN 2021126108 W CN2021126108 W CN 2021126108W WO 2022134831 A1 WO2022134831 A1 WO 2022134831A1
Authority
WO
WIPO (PCT)
Prior art keywords
certificate
sample
data
picture
generate
Prior art date
Application number
PCT/CN2021/126108
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 WO2022134831A1 publication Critical patent/WO2022134831A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Definitions

  • the present application relates to the field of artificial intelligence, and in particular, to a method, device, device and storage medium for generating a certificate picture.
  • ID pictures which can be ID photos, membership card ID photos, work ID photos, and student ID photos. Therefore, many application scenarios will use models to identify ID pictures.
  • the main purpose of this application is to improve the accuracy of generating certificate pictures that conform to real scenes.
  • a first aspect of the present application provides a method for generating a certificate image, which includes: obtaining a sample certificate image, where the sample certificate image includes sample text data and sample background data; and using a picture similarity comparison algorithm to generate a certificate image based on the sample certificate certificate background data and certificate text data, the certificate text data includes text language data and font style data; write the certificate text data into a random position of the certificate background data to generate an initial certificate picture;
  • the pictures are preprocessed to generate multiple preprocessed ID pictures; the multiple preprocessed ID pictures are randomly scaled for multiple times by using a preset random scaling function to generate multiple target ID picture groups.
  • the plurality of preprocessed certificate pictures are in one-to-one correspondence with the plurality of target certificate picture groups.
  • a second aspect of the present application provides an apparatus for generating a certificate image, comprising: an acquisition module for acquiring a sample certificate image, wherein the sample certificate image includes sample text data and sample background data; and a data generation module for adopting the image similarity a comparison algorithm, generating certificate background data and certificate text data based on the sample certificate picture, the certificate text data including text language data and font style data; a writing module for writing the certificate text data into the certificate In the random position of the background data, an initial certificate picture is generated; the preprocessing module is used to preprocess the initial certificate picture to generate a plurality of preprocessed certificate pictures; the random scaling module is used to adopt the preset random scaling The function performs multiple random scaling on the plurality of preprocessed certificate pictures, respectively, to generate a plurality of target certificate picture groups, and the plurality of preprocessed certificate pictures are in one-to-one correspondence with the plurality of target certificate picture groups.
  • a third aspect of the present application provides a certificate image generating device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected by a line; the at least one processor The processor invokes the instructions in the memory, so that the certificate image generating device executes the steps of the method for generating a certificate image as follows: obtaining a sample certificate image, which includes sample text data and sample background data ; Using the image similarity comparison algorithm to generate certificate background data and certificate text data based on the sample certificate picture, the certificate text data includes text language data and font style data; Write the certificate text data into the certificate background In a random position of the data, an initial certificate picture is generated; the initial certificate picture is preprocessed to generate a plurality of preprocessed certificate pictures; a preset random scaling function is used to respectively adjust the plurality of preprocessed certificate pictures Perform random scaling multiple times to generate multiple target document picture groups, and the plurality of preprocessed document pictures are in one-to-one correspondence with
  • a fourth aspect of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium runs on a computer, the computer executes the steps of the method for generating a certificate picture as follows: obtaining A sample certificate picture, the sample certificate picture includes sample text data and sample background data; the image similarity comparison algorithm is used to generate certificate background data and certificate text data based on the sample certificate picture, and the certificate text data includes text language data and font style data; write the certificate text data into a random position of the certificate background data to generate an initial certificate picture; preprocess the initial certificate picture to generate a plurality of preprocessed certificate pictures; The set random scaling function respectively randomly scales the plurality of preprocessed certificate pictures for multiple times to generate a plurality of target certificate picture groups, the plurality of preprocessed certificate pictures and the plurality of target certificate picture groups One-to-one correspondence.
  • a sample certificate image is obtained, and the sample certificate image includes sample text data and sample background data; the image similarity comparison algorithm is used to generate the certificate background data and the certificate text data based on the sample certificate image.
  • the document text data includes text language data and font style data; the document text data is written into a random position of the document background data to generate an initial document picture; the initial document picture is preprocessed to generate a plurality of pre- The processed certificate pictures; the plurality of preprocessed certificate pictures are randomly scaled for multiple times by using a preset random scaling function to generate a plurality of target certificate picture groups, and the plurality of preprocessed certificate pictures are The multiple target certificate picture groups are in one-to-one correspondence.
  • the image similarity comparison algorithm is used to determine the certificate background data and the certificate text data based on the certificate picture, and the certificate text data is randomly written into the certificate background data to generate the initial certificate picture, and then the initial certificate picture is preprocessed and random scaling to generate multiple target ID picture groups, which solves the problem of not being able to meet the generation needs of multiple languages and multiple IDs, and also improves the accuracy of generating ID photos that match the real scene.
  • FIG. 1 is a schematic diagram of an embodiment of a method for generating a certificate image in the embodiment of the application
  • FIG. 2 is a schematic diagram of another embodiment of the method for generating a certificate image in the embodiment of the application;
  • FIG. 3 is a schematic diagram of an embodiment of an apparatus for generating a certificate image in an embodiment of the application
  • FIG. 4 is a schematic diagram of another embodiment of the certificate image generating device in the embodiment of the application.
  • FIG. 5 is a schematic diagram of an embodiment of a certificate image generating device in an embodiment of the present application.
  • An embodiment of the method for generating a certificate image in the embodiment of the present application includes:
  • the server obtains a sample ID picture including sample text data and sample background data. It should be emphasized that, in order to further ensure the privacy and security of the above-mentioned sample ID picture, the above-mentioned sample ID picture can also be stored in a node of a blockchain.
  • the sample ID pictures can be membership card ID photos, ID photos, work ID photos, and student ID photos.
  • the sample text data and sample background data of different ID pictures are different.
  • the sample text data includes the sample text language and the sample font style.
  • the sample text language refers to the text language type, and the text language type can be Chinese type, English type and French type. Types, etc., the sample font styles include Song style, italic style, and bold style, etc., and the sample background data includes line data, color data, and so on.
  • the execution subject of the present application may be a certificate image generating device, or may be a terminal or a server, which is not specifically limited here.
  • the embodiments of the present application take the server as an execution subject as an example for description.
  • the server generates document background data and document text data including text language data and font style data based on the sample document picture.
  • the sample background data of different sample ID pictures is different, the server needs to determine the background data that matches the sample background data as the ID background data; the sample text language and sample font style of different nationality ID or different country ID cards are different, the server refers to the sample text language to determine Text language data, and determine font style data with reference to sample font styles.
  • the sample background data of the sample certificate picture is the image data of the building A1
  • the sample text language is Chinese
  • the sample font style is Song type
  • the server determines the certificate background data A2 based on the sample background data "image data of the building A1", based on The sample text language Chinese determines the text language data, and finally determines the font style data A3 based on the sample font style, wherein the document background data A2 and the font style data A3 constitute the document text data.
  • the server writes the document text data into a random position of the document background data to generate an initial document picture.
  • the document text data is text data with a length.
  • the server writes the text data with a length into a random position of the document background data to generate an initial document image.
  • the length of the position is consistent with the length of the document text data.
  • the server performs preprocessing such as image enhancement and data enhancement on the initial certificate picture, thereby generating multiple preprocessed certificate pictures.
  • the server needs to perform image enhancement, data enhancement and random transformation on the original certificate image. That is, preprocessing, so as to generate a picture similar to the picture in the real scene, that is, the preprocessed certificate picture.
  • 105 Use a preset random scaling function to perform random scaling on multiple preprocessed ID images respectively, to generate multiple target ID image groups, and multiple pre-processed ID images and multiple target ID image groups one by one correspond.
  • the server randomly scales each preprocessed certificate picture into a target certificate picture group including multiple target certificate pictures by using a random scaling function, so as to obtain multiple target certificate picture groups.
  • the server uses the preset random scaling function resize to randomly scale the preprocessed certificate pictures.
  • the resolution of the preprocessed certificate image is randomly reduced by 1-3 times, and enlargement refers to the random enlargement of the resolution of the preprocessed certificate image by 1-3 times, and a target certificate image group is generated based on each preprocessed certificate image, so as to obtain multiple A target ID picture group.
  • the image similarity comparison algorithm is used to determine the certificate background data and the certificate text data based on the certificate picture, and the certificate text data is randomly written into the certificate background data to generate the initial certificate picture, and then the initial certificate picture is preprocessed and random scaling to generate multiple target ID picture groups, which solves the problem of not being able to meet the generation needs of multiple languages and multiple IDs, and also improves the accuracy of generating ID photos that match the real scene.
  • another embodiment of the method for generating a certificate image in the embodiment of the present application includes:
  • sample ID picture includes sample text data and sample background data
  • the server obtains sample ID pictures including sample text data and sample background data. It should be emphasized that, in order to further ensure the privacy and security of the above sample ID pictures, the above sample ID pictures can also be stored in a node of a blockchain.
  • the sample ID pictures can be membership card ID photos, ID photos, work ID photos, and student ID photos.
  • the sample text data and sample background data of different ID pictures are different.
  • the sample text data includes the sample text language and the sample font style.
  • the sample text language refers to the text language type, and the text language type can be Chinese type, English type and French type. Types, etc., the sample font styles include Song style, italic style, and bold style, etc., and the sample background data includes line data, color data, and so on.
  • certificate text data includes text language data and font style data
  • the server generates document background data and document text data including text language data and font style data based on the sample document picture.
  • the sample background data of different sample ID pictures is different, the server needs to determine the background data that matches the sample background data as the ID background data; the sample text language and sample font style of different nationality ID or different country ID cards are different, the server refers to the sample text language to determine Text language data, and determine font style data with reference to sample font styles.
  • the sample background data of the sample certificate picture is the image data of the building A1
  • the sample text language is Chinese
  • the sample font style is Song type
  • the server determines the certificate background data A2 based on the sample background data "image data of the building A1", based on The sample text language Chinese determines the text language data, and finally determines the font style data A3 based on the sample font style, wherein the document background data A2 and the font style data A3 constitute the document text data.
  • the server extracts sample text data and sample background data from the sample certificate image; the sample background data is image data, and in the server, the storage form of the image data is a matrix, and the server adopts the image similarity comparison algorithm based on the sample background of the matrix
  • the data determines the matching document background data in the database; then the server extracts the feature vector from the sample text data to generate the sample text vector, and finally uses the Logistic regression model, that is, the linear regression model, to identify the sample text data, and input the sample text vector.
  • the target sample text language and the target sample font style are first generated, and then the server combines the database to determine the text language data and font style data based on the target sample text language and target sample font in the Logistic regression model, that is, the document text data.
  • the server uses the image similarity comparison algorithm to determine the matching document background data in the database based on the sample background data of the matrix, including:
  • the server extracts sample pixel points, sample centroids, sample projections and sample blocks from the sample background data; the server determines the similar background data of multiple pixels in the database based on the sample pixels; the server determines the similar background data of multiple pixels based on the sample centroids The server determines the similar background data of the multiple sample centers of gravity based on the sample projection; the server determines the similar background data of the multiple sample projections based on the sample projection; the server determines the document background data based on the sample segmentation. .
  • the server calculates the similarity between two pictures, it mainly compares the pixel point, the center of gravity, the projection and the block to generate the similarity.
  • the sample background data exists in the form of a matrix.
  • the elements in the matrix are color values composed of three RGB parameters. The value range of these three parameters is 0 to 255.
  • the server first binarizes the sample background data, that is, The three parameters of the binarized sample background data are 0 or 255, where parameter 0 represents a black pixel, and parameter 1 represents a white pixel. In binary, "1" is used to represent a black pixel, and "0" is used to represent a white pixel.
  • the matrix of the sample background data after binarization is a pixel matrix composed of 0 and 1.
  • the server firstly compares the pixels of multiple pictures in the database with the sample background data after binarization, and determines the picture data whose pixel similarity in the database is higher than the pixel similarity threshold as the pixel similar background data. Obtain similar background data of multiple pixels; then the server compares the similar background data of multiple pixels with the binarized sample background data, where the center of gravity is the area where the black pixels are concentrated, and the server calculates the binarized data separately.
  • the sum of the abscissas and ordinates of multiple black pixels in the sample background data of the Use the average ordinate to process the total length of the ordinate to obtain the center of gravity of the sample, compare the center of the similar background data of multiple pixels with the center of the sample, obtain the similarity of the center of gravity, and compare the pixels that are greater than the threshold of the similarity of the center of gravity to similar backgrounds
  • the data is determined as the background data of the sample center of gravity similar to the background data, and the background data of the similar center of gravity of multiple samples is obtained; the projection comparison first counts the number of black row pixels and the number of black column pixels in the binarized sample background data, and generates the corresponding sample background Data feature vector, and then calculate the background data feature vector of the sample gravity center similar to the background data respectively, and calculate the Euclidean distance based on the multiple background data feature vectors and the sample background data feature vector respectively, and determine the sample gravity center similar background data with the Euclidean distance greater than the distance threshold.
  • the server writes the document text data into a random position of the document background data to generate an initial document picture.
  • the document text data is text data with a length.
  • the server writes the text data with a length into a random position of the document background data to generate an initial document image.
  • the length of the position is consistent with the length of the document text data.
  • the server uses a preset random function to determine the coordinate position to which the document text data needs to be written, and obtains the text coordinate position; then the server intercepts the background data corresponding to the text coordinate position in the document background data to obtain the intercepted document background data , at this time, the length of the certificate text data is consistent with the length of the corresponding background data, and the certificate text data is directly merged into the intercepted certificate background data to generate the initial certificate picture.
  • the server performs image enhancement on the initial certificate image.
  • the image enhancement in this embodiment does not make the image clearer, but blurs the initial certificate image to generate an image-enhanced certificate image, thereby improving the image-enhanced certificate image and the real image. Similarity in the scene.
  • the server performs brightness adjustment, chromaticity adjustment and sharpness adjustment on the initial certificate image, and generates a certificate image after the initial image enhancement.
  • the certificate picture after the initial image enhancement is generated; Gaussian blur, Gaussian noise processing and random resolution adjustment are performed on the certificate picture after the initial image enhancement to generate the certificate picture before and after the image enhancement.
  • the server performs data enhancement on the image-enhanced certificate picture, thereby generating a data-enhanced certificate picture.
  • the data enhancement processing includes adding light spots, white strips, polylines, black spots, shadows, raindrops, and adjusting color channels to the image-enhanced certificate pictures. Through these processes, the richness of the enhanced certificate pictures and the generation of more Pictures that match the real scene.
  • the server performs random transformation on the data-enhanced certificate picture, and randomly transforms one data-enhanced certificate picture into multiple pre-processed certificate pictures, thereby generating multiple pre-processed certificate pictures.
  • the server performs multiple random rotations on the data-enhanced certificate picture, and each random rotation generates a rotated certificate picture, so as to obtain multiple rotated certificate pictures; then the server rotates each rotated certificate picture.
  • Perform affine transformation that is, perform linear transformation and translation in the vector space to generate another vector space, thereby generating multiple radiologically transformed ID images; finally, the server performs perspective transformation on each radiologically transformed ID image, using perspective transformation It is easy to identify text with oblique fonts, thereby generating multiple preprocessed ID images.
  • 207 Use a preset random scaling function to perform random scaling on multiple pre-processed ID pictures, respectively, to generate multiple target ID image groups, and multiple pre-processed ID images and multiple target ID image groups one by one correspond.
  • the server randomly scales each preprocessed certificate picture into a target certificate picture group including multiple target certificate pictures by using a random scaling function, so as to obtain multiple target certificate picture groups.
  • the server uses the preset random scaling function resize to randomly scale the preprocessed certificate pictures.
  • the resolution of the preprocessed certificate image is randomly reduced by 1-3 times, and enlargement refers to the random enlargement of the resolution of the preprocessed certificate image by 1-3 times, and a target certificate image group is generated based on each preprocessed certificate image, so as to obtain multiple A target ID picture group.
  • the image similarity comparison algorithm is used to determine the certificate background data and the certificate text data based on the certificate picture, and the certificate text data is randomly written into the certificate background data to generate the initial certificate picture, and then the initial certificate picture is preprocessed and random scaling to generate multiple target ID picture groups, which solves the problem of not being able to meet the generation needs of multiple languages and multiple IDs, and also improves the accuracy of generating ID photos that match the real scene.
  • An embodiment of the device for generating a certificate image in the embodiment of the present application includes:
  • the obtaining module 301 is configured to obtain a sample certificate picture, where the sample certificate picture includes sample text data and sample background data;
  • a data generation module 302 configured to use an image similarity comparison algorithm to generate certificate background data and certificate text data based on the sample certificate picture, where the certificate text data includes text language data and font style data;
  • a writing module 303 configured to write the document text data into a random position of the document background data to generate an initial document picture
  • a preprocessing module 304 configured to preprocess the initial certificate picture to generate a plurality of preprocessed certificate pictures
  • the random scaling module 305 is configured to perform random scaling on the plurality of preprocessed ID pictures respectively by using a preset random scaling function to generate a plurality of target ID picture groups, the plurality of preprocessed ID pictures One-to-one correspondence with the multiple target certificate picture groups.
  • the image similarity comparison algorithm is used to determine the certificate background data and the certificate text data based on the certificate picture, and the certificate text data is randomly written into the certificate background data to generate the initial certificate picture, and then the initial certificate picture is preprocessed and random scaling to generate multiple target ID picture groups, which solves the problem of not being able to meet the generation needs of multiple languages and multiple IDs, and also improves the accuracy of generating ID photos that match the real scene.
  • another embodiment of the apparatus for generating a certificate image in the embodiment of the present application includes:
  • the obtaining module 301 is configured to obtain a sample certificate picture, where the sample certificate picture includes sample text data and sample background data;
  • a data generation module 302 configured to use an image similarity comparison algorithm to generate certificate background data and certificate text data based on the sample certificate picture, where the certificate text data includes text language data and font style data;
  • a writing module 303 configured to write the document text data into a random position of the document background data to generate an initial document picture
  • a preprocessing module 304 configured to preprocess the initial certificate picture to generate a plurality of preprocessed certificate pictures
  • the random scaling module 305 is configured to perform random scaling on the plurality of preprocessed ID pictures respectively by using a preset random scaling function to generate a plurality of target ID picture groups, the plurality of preprocessed ID pictures One-to-one correspondence with the multiple target certificate picture groups.
  • the data generation module 302 includes:
  • Extraction unit 3021 for extracting sample text data and sample background data from the sample certificate picture
  • the background data determination unit 3022 is configured to use the image similarity comparison algorithm to determine the document background data that matches the sample background data in the database;
  • a feature extraction unit 3023 configured to perform feature extraction on the sample text data to generate a sample text vector
  • the identification unit 3024 is configured to identify the sample text vector by using a preset linear regression model, and determine document text data, where the document text data includes text language data and font style data.
  • the background data determination unit 3022 can also be specifically used for:
  • Document context data is determined in the plurality of sample projected similar context data based on the sample partitioning.
  • the writing module 303 can also be specifically used for:
  • the certificate text data is merged into the intercepted certificate background data to generate an initial certificate picture.
  • the preprocessing module 304 includes:
  • An image enhancement unit 3041 configured to perform image enhancement on the initial certificate picture to generate an image-enhanced certificate picture
  • a data enhancement unit 3042 configured to perform data enhancement on the image-enhanced certificate picture, and generate a data-enhanced certificate picture
  • the random transformation unit 3043 is configured to perform random transformation on the data-enhanced certificate pictures to generate a plurality of pre-processed certificate pictures.
  • the image enhancement unit 3041 can also be specifically used for:
  • Gaussian blur, Gaussian noise processing and random resolution adjustment are performed on the document picture after the initial image enhancement, to generate the document picture after image enhancement.
  • the random transformation unit 3043 can also be specifically used for:
  • Perspective transformation is performed on the plurality of affine transformed certificate pictures to generate a plurality of preprocessed certificate pictures.
  • the image similarity comparison algorithm is used to determine the certificate background data and the certificate text data based on the certificate picture, and the certificate text data is randomly written into the certificate background data to generate the initial certificate picture, and then the initial certificate picture is preprocessed and random scaling to generate multiple target ID picture groups, which solves the problem of not being able to meet the generation needs of multiple languages and multiple IDs, and also improves the accuracy of generating ID photos that match the real scene.
  • FIG. 5 is a schematic structural diagram of a certificate image generation device provided by an embodiment of the present application.
  • the certificate image generation device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units). , CPU) 510 (eg, one or more processors) and memory 520, one or more storage media 530 (eg, one or more mass storage devices) storing application programs 533 or data 532.
  • the memory 520 and the storage medium 530 may be short-term storage or persistent storage.
  • the program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the certificate image generating device 500 .
  • the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the certificate picture generating device 500 .
  • the certificate image generating device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and/or, one or more operating systems 531, such as Windows Server , Mac OS X, Unix, Linux, FreeBSD and more.
  • operating systems 531 such as Windows Server , Mac OS X, Unix, Linux, FreeBSD and more.
  • the present application also provides a certificate image generating device, the computer device includes a memory and a processor, and computer-readable instructions are stored in the memory.
  • the processor executes the steps in the above embodiments. The steps of the certificate picture generating method.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • the computer-readable storage medium may also be a volatile computer-readable storage medium.
  • the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the method for generating a certificate image.
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

本申请涉及人工智能领域,公开了证件图片生成方法、装置、设备及存储介质,用于提高生成符合真实场景证件图片的准确率。证件图片生成方法包括:获取样本证件图片,样本证件图片包括样本文字数据和样本背景数据;采用图片相似度比对算法,基于样本证件图片生成证件背景数据和证件文字数据,证件文字数据包括文字语言数据和字体样式数据;将证件文字数据写入证件背景数据的随机位置中,生成初始证件图片;对初始证件图片进行预处理,生成多个预处理后的证件图片;采用预置的随机缩放函数分别对多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组。此外,本申请还涉及区块链技术,样本证件图片可存储于区块链中。

Description

证件图片生成方法、装置、设备及存储介质
本申请要求于2020年12月23日提交中国专利局、申请号为202011538787.9、发明名称为“证件图片生成方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及人工智能领域,尤其涉及一种证件图片生成方法、装置、设备及存储介质。
背景技术
随着社会的发展,各个行业都涉及到证件图片,证件可以为身份证件图片、会员卡证件图片、工作证件图片和学生证件图片等。因此很多应用场景会用到模型识别证件图片。
然而,发明人意识到,在现有技术中,各类证件的检测识别算法越来越多,通常采用大量的证件图片来训练证件检测模型,进行证件识别,由于证件检测模型需要用到的训练数据,即证件图片具有较高的隐私性和较高安全性,获取的过程较为困难,因此采用造数的方式来生成证件图片。但是在生成证件图片时,无法满足多种语言和多种证件的生成需求,导致生成符合真实场景证件图片的准确率较低。
发明内容
本申请的主要目的在于提高生成符合真实场景证件图片的准确率。
本申请第一方面提供了一种证件图片生成方法,包括:获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;对所述初始证件图片进行预处理,生成多个预处理后的证件图片;采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
本申请第二方面提供了一种证件图片生成装置,包括:获取模块,用于获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;数据生成模块,用于采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;写入模块,用于将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;预处理模块,用于对所述初始证件图片进行预处理,生成多个预处理后的证件图片;随机缩放模块,用于采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
本申请第三方面提供了一种证件图片生成设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互连;所述至少一个处理器调用所述存储器中的所述指令,以使得所述证件图片生成设备执行如下所述的证件图片生成方法的步骤:获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;对所述初始证件图片进行预处理,生成多个预处理后的证件图片;采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
本申请第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行如下所述的证件图片生成方法的步骤:获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;对所述初始证件图片进行预处理,生成多个预处理后的证件图片;采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
本申请的技术方案中,获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;对所述初始证件图片进行预处理,生成多个预处理后的证件图片;采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。本申请实施例中,采用图片相似度比对算法基于证件图片确定证件背景数据和证件文字数据,并将证件文字数据随机写入证件背景数据,生成初始证件图片,然后对初始证件图片进行预处理和随机缩放,生成多个目标证件图片组,解决了无法满足多种语言和多种证件的生成需求问题,也提高了生成符合真实场景证件图片的准确率。
附图说明
图1为本申请实施例中证件图片生成方法的一个实施例示意图;
图2为本申请实施例中证件图片生成方法的另一个实施例示意图;
图3为本申请实施例中证件图片生成装置的一个实施例示意图;
图4为本申请实施例中证件图片生成装置的另一个实施例示意图;
图5为本申请实施例中证件图片生成设备的一个实施例示意图。
具体实施方式
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
为便于理解,下面对本申请实施例的具体流程进行描述,请参阅图1,本申请实施例中证件图片生成方法的一个实施例包括:
101、获取样本证件图片,样本证件图片包括样本文字数据和样本背景数据;
服务器获取包括样本文字数据和样本背景数据的样本证件图片,需要强调的是,为进一步保证上述样本证件图片的私密和安全性,上述样本证件图片还可以存储于一区块链的节点中。
样本证件图片可以为会员卡证件图片、身份证件图片、工作证件图片和学生证件图片等。不同证件图片的样本文字数据和样本背景数据不同,其中,样本文字数据包括样本文 字语言和样本字体样式,样本文字语言指的是文字语言类型,该文字语言类型可以为中文类型、英文类型和法语类型等,样本字体样式包括宋体样式、楷体样式以及黑体样式等,样本背景数据包括线条数据、颜色数据等。
可以理解的是,本申请的执行主体可以为证件图片生成装置,还可以是终端或者服务器,具体此处不做限定。本申请实施例以服务器为执行主体为例进行说明。
102、采用图片相似度比对算法,基于样本证件图片生成证件背景数据和证件文字数据,证件文字数据包括文字语言数据和字体样式数据;
服务器基于样本证件图片生成证件背景数据和包括文字语言数据和字体样式数据的证件文本数据。不同样本证件图片的样本背景数据不同,服务器需要确定与样本背景数据相匹配的背景数据作为证件背景数据;不同民族证件或者不同国家证件的样本文字语言和样本字体样式不同,服务器参考样本文字语言确定文字语言数据,并参考样本字体样式确定字体样式数据。
例如,样本证件图片的样本背景数据为建筑物A1的图像数据、样本文字语言为中文以及样本字体样式为宋体,服务器则基于样本背景数据“建筑物A1的图像数据”确定证件背景数据A2,基于样本文字语言中文确定文字语言数据,最后基于样本字体样式确定字体样式数据A3,其中证件背景数据A2和字体样式数据A3组成证件文字数据。
103、将证件文字数据写入证件背景数据的随机位置中,生成初始证件图片;
服务器将证件文字数据写入证件背景数据的随机位置中,生成初始证件图片。
证件文字数据为有长度的文字数据,服务器将有长度的文本数据写入证件背景数据的随机位置中,生成初始证件图片,该位置的长度与证件文本数据的长度一致。
104、对初始证件图片进行预处理,生成多个预处理后的证件图片;
服务器对初始证件图片进行图像增强和数据增强等预处理,从而生成多个预处理后的证件图片。
在真实场景中,证件的表面存在各种各样的模糊问题、损坏和污渍问题以及拍摄角度倾斜问题,当得到初始证件图片时,服务器需要将初始证件图片进行图像增强、数据增强和随机变换,即预处理,从而生成与真实场景中的图片相似的图片,即预处理后的证件图片。
105、采用预置的随机缩放函数分别对多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,多个预处理后的证件图片与多个目标证件图片组一一对应。
服务器采用随机缩放函数将每个预处理后的证件图片随机缩放为包括多个目标证件图片的目标证件图片组,从而得到多个目标证件图片组。
服务器在对初始证件图片进行预处理之后,采用预置的随机缩放函数resize分别对多个预处理后的证件图片进行随机缩放,在本实施例中,缩小指的是对预处理后的证件图片的分辨率随机缩小1-3倍,放大指的是对预处理后的证件图片的分辨率随机放大1-3倍,基于每个预处理后的证件图片生成一个目标证件图片组,从而得到多个目标证件图片组。
本申请实施例中,采用图片相似度比对算法基于证件图片确定证件背景数据和证件文字数据,并将证件文字数据随机写入证件背景数据,生成初始证件图片,然后对初始证件图片进行预处理和随机缩放,生成多个目标证件图片组,解决了无法满足多种语言和多种证件的生成需求问题,也提高了生成符合真实场景证件图片的准确率。
请参阅图2,本申请实施例中证件图片生成方法的另一个实施例包括:
201、获取样本证件图片,样本证件图片包括样本文字数据和样本背景数据;
服务器获取包括样本文字数据和样本背景数据的样本证件图片,需要强调的是,为进一步保证上述样本证件图片的私密和安全性,上述样本证件图片还可以存储于一区块链的 节点中。
样本证件图片可以为会员卡证件图片、身份证件图片、工作证件图片和学生证件图片等。不同证件图片的样本文字数据和样本背景数据不同,其中,样本文字数据包括样本文字语言和样本字体样式,样本文字语言指的是文字语言类型,该文字语言类型可以为中文类型、英文类型和法语类型等,样本字体样式包括宋体样式、楷体样式以及黑体样式等,样本背景数据包括线条数据、颜色数据等。
202、采用图片相似度比对算法,基于样本证件图片生成证件背景数据和证件文字数据,证件文字数据包括文字语言数据和字体样式数据;
服务器基于样本证件图片生成证件背景数据和包括文字语言数据和字体样式数据的证件文本数据。不同样本证件图片的样本背景数据不同,服务器需要确定与样本背景数据相匹配的背景数据作为证件背景数据;不同民族证件或者不同国家证件的样本文字语言和样本字体样式不同,服务器参考样本文字语言确定文字语言数据,并参考样本字体样式确定字体样式数据。
例如,样本证件图片的样本背景数据为建筑物A1的图像数据、样本文字语言为中文以及样本字体样式为宋体,服务器则基于样本背景数据“建筑物A1的图像数据”确定证件背景数据A2,基于样本文字语言中文确定文字语言数据,最后基于样本字体样式确定字体样式数据A3,其中证件背景数据A2和字体样式数据A3组成证件文字数据。
具体的,服务器从样本证件图片中提取样本文字数据和样本背景数据;样本背景数据为图片数据,在服务器中,图片数据的存储形式为矩阵,服务器采用图片相似度对比算法基于为矩阵的样本背景数据在数据库中确定相匹配的证件背景数据;然后服务器从样本文字数据中提取特征向量,生成样本文字向量,最后采用Logistic回归模型,即线性回归模型进行样本文字数据的识别,将样本文字向量输入Logistic回归模型中,首先生成目标样本文字语言和目标样本字体样式,然后服务器结合数据库在Logistic回归模型基于目标样本文字语言和目标样本字体确定文字语言数据和字体样式数据,即证件文字数据。
服务器采用图片相似度对比算法基于为矩阵的样本背景数据在数据库中确定相匹配的证件背景数据包括:
服务器从样本背景数据中提取样本像素点、样本重心、样本投影和样本分块;服务器基于样本像素点在数据库中确定多个像素点相似背景数据;服务器基于样本重心在多个像素点相似背景数据中确定多个样本重心相似背景数据;服务器基于样本投影在多个样本重心相似背景数据中确定多个样本投影相似背景数据;服务器基于样本分块在多个样本投影相似背景数据中确定证件背景数据。
需要说明的是,服务器在计算两张图片的相似度时,主要对像素点、重心、投影和分块进行对比,从而生成相似度。样本背景数据以矩阵的形式存在,该矩阵中的元素是由RGB三个参数构成的颜色值,这三个参数的取值范围为0~255,服务器首先将样本背景数据进行二值化,即二值化后的样本背景数据的三个参数为0或者255,其中参数0表示黑色像素,参数1表示白色像素,在二进制中,采用“1”来表示黑色像素,采用“0”表示白色像素,此时二值化后的样本背景数据的矩阵是由0和1组成的像素点矩阵。
服务器首先将数据库中的多个图片分别与二值化后的样本背景数据进行像素点对比,将数据库中像素点相似度高于像素点相似度阈值的图片数据确定为像素点相似背景数据,从而得到多个像素点相似背景数据;然后服务器将多个像素点相似背景数据与二值化后的样本背景数据进行重心对比,其中,重心为黑色像素点集中的区域,服务器分别计算二值化后的样本背景数据的多个黑色像素点的横坐标和纵坐标的和,并分别除以黑色像素点的个数,得到平均横坐标、平均纵坐标,采用平均横坐标除以横坐标的总长度、采用平均纵坐标处理纵坐标的总长度,得到样本重心,将多个像素点相似背景数据的中心与样本中心 进行比对,得到重心相似度,并将大于重心相似度阈值的像素点相似背景数据确定为样本重心相似背景数据,得到多个样本重心相似背景数据;投影比对首先统计二值化后的样本背景数据中的黑色行像素点数量和黑色列像素点数量,生成对应的样本背景数据特征向量,然后分别计算样本重心相似背景数据的背景数据特征向量,并分别基于多个背景数据特征向量和样本背景数据特征向量计算欧式距离,将欧式距离大于距离阈值的样本重心相似背景数据确定为样本投影相似背景数据,生成多个样本投影相似背景数据;最后将二值化后的样本背景数据和多个样本投影相似背景数据分别划分为多个区块进行相似度比对,将相似度最大的样本投影相似背景数据确定为证件背景数据。
203、将证件文字数据写入证件背景数据的随机位置中,生成初始证件图片;
服务器将证件文字数据写入证件背景数据的随机位置中,生成初始证件图片。
证件文字数据为有长度的文字数据,服务器将有长度的文本数据写入证件背景数据的随机位置中,生成初始证件图片,该位置的长度与证件文本数据的长度一致。
具体的,服务器采用预置的随机函数,确定证件文字数据需要写入的坐标位置,得到文字坐标位置;然后服务器在证件背景数据中截取文字坐标位置对应的背景数据,得到截取后的证件背景数据,此时,证件文字数据的长度与对应的背景数据长度一致,直接将该证件文字数据合并至截取后的证件背景数据中,生成初始证件图片。
204、对初始证件图片进行图像增强,生成图像增强后的证件图片;
服务器对初始证件图片进行图像增强,本实施例中的图像增强并非使图片更加清晰,而是将初始证件图片进行模糊化,生成图片增强后的证件图片,从而提高图片增强后的证件图片与真实场景中的相似度。
具体的,服务器对初始证件图片进行亮度调整、色度调整和锐度调整,生成初次图像增强后的证件图片,以亮度调整进行说明,将初始证件图片的亮度调低或者调高,然后对色度和锐度分别调整之后,生成初次图像增强后的证件图片;对初次图像增强后的证件图片进行高斯模糊、高斯噪声处理和分辨率随机调整,生成图像增前后的证件图片。
205、对图像增强后的证件图片进行数据增强,生成数据增强后的证件图片;
服务器对图像增强后的证件图片进行数据增强,从而生成数据增强后的证件图片。其中数据增强处理包括在图像增强后的证件图片上添加光点、白带、折线、黑点、阴影、雨点以及调整颜色通道等,通过这些处理以提高图像增强后的证件图片的丰富性以及生成更加符合真实场景的图片。
206对数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片;
服务器对数据增强后的证件图片进行随机变换,将一张数据增强后的证件图片随机变换为多张预处理后的证件图片,从而生成多个预处理后的证件图片。
具体的,服务器对数据增强后的证件图片进行多个随机旋转,每一次随机旋转都生成一个旋转后的证件图片,从而得到多个旋转后的证件图片;然后服务器对每个旋转后的证件图片进行仿射变换,即在向量空间进行线性变换和平移,生成另一个向量空间,从而生成多个放射变换后的证件图片;最后服务器对每个放射变换后的证件图片进行透视变换,采用透视变换便于识别字体倾斜的文字,从而生成多个预处理后的证件图片。
207、采用预置的随机缩放函数分别对多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,多个预处理后的证件图片与多个目标证件图片组一一对应。
服务器采用随机缩放函数将每个预处理后的证件图片随机缩放为包括多个目标证件图片的目标证件图片组,从而得到多个目标证件图片组。
服务器在对初始证件图片进行预处理之后,采用预置的随机缩放函数resize分别对多个预处理后的证件图片进行随机缩放,在本实施例中,缩小指的是对预处理后的证件图片的分辨率随机缩小1-3倍,放大指的是对预处理后的证件图片的分辨率随机放大1-3倍, 基于每个预处理后的证件图片生成一个目标证件图片组,从而得到多个目标证件图片组。
本申请实施例中,采用图片相似度比对算法基于证件图片确定证件背景数据和证件文字数据,并将证件文字数据随机写入证件背景数据,生成初始证件图片,然后对初始证件图片进行预处理和随机缩放,生成多个目标证件图片组,解决了无法满足多种语言和多种证件的生成需求问题,也提高了生成符合真实场景证件图片的准确率。
上面对本申请实施例中证件图片生成方法进行了描述,下面对本申请实施例中证件图片生成装置进行描述,请参阅图3,本申请实施例中证件图片生成装置一个实施例包括:
获取模块301,用于获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
数据生成模块302,用于采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
写入模块303,用于将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
预处理模块304,用于对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
随机缩放模块305,用于采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
本申请实施例中,采用图片相似度比对算法基于证件图片确定证件背景数据和证件文字数据,并将证件文字数据随机写入证件背景数据,生成初始证件图片,然后对初始证件图片进行预处理和随机缩放,生成多个目标证件图片组,解决了无法满足多种语言和多种证件的生成需求问题,也提高了生成符合真实场景证件图片的准确率。
请参阅图4,本申请实施例中证件图片生成装置的另一个实施例包括:
获取模块301,用于获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
数据生成模块302,用于采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
写入模块303,用于将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
预处理模块304,用于对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
随机缩放模块305,用于采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
可选的,数据生成模块302包括:
提取单元3021,用于从所述样本证件图片中提取样本文字数据和样本背景数据;
背景数据确定单元3022,用于采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据;
特征提取单元3023,用于对所述样本文字数据进行特征提取,生成样本文字向量;
识别单元3024,用于采用预置的线性回归模型对所述样本文字向量进行识别,确定证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据。
可选的,背景数据确定单元3022还可以具体用于:
从所述样本背景数据中提取样本像素点、样本重心、样本投影和样本分块;
基于所述样本像素点在数据库中确定多个像素点相似背景数据;
基于所述样本重心在所述多个像素点相似背景数据中确定多个样本重心相似背景数据;
基于所述样本投影在所述多个样本重心相似背景数据中确定多个样本投影相似背景数据;
基于样本分块在所述多个样本投影相似背景数据中确定证件背景数据。
可选的,写入模块303还可以具体用于:
采用预置的随机函数,在所述证件背景数据的中确定所述证件文字数据的坐标位置,生成文字坐标位置;
在所述证件背景数据中截取所述文字坐标位置对应的证件背景数据,生成截取后的证件背景数据;
将所述证件文字数据合并至所述截取后的证件背景数据中,生成初始证件图片。
可选的,预处理模块304包括:
图像增强单元3041,用于对所述初始证件图片进行图像增强,生成图像增强后的证件图片;
数据增强单元3042,用于对所述图像增强后的证件图片进行数据增强,生成数据增强后的证件图片;
随机变换单元3043,用于对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片。
可选的,图像增强单元3041还可以具体用于:
对所述初始证件图片进行亮度调整、色度调整和锐度调整,生成初次图像增强后的证件图片;
对所述初次图像增强后的证件图片进行高斯模糊、高斯噪声处理和分辨率随机调整,生成图像增强后的证件图片。
可选的,随机变换单元3043还可以具体用于:
对所述数据增强后的证件图片进行随机旋转,生成多个旋转后的证件图片;
对所述多个旋转后的证件图片进行仿射变换,生成多个仿射变换后的证件图片;
对所述多个仿射变换后的证件图片进行透视变换,生成多个预处理后的证件图片。
本申请实施例中,采用图片相似度比对算法基于证件图片确定证件背景数据和证件文字数据,并将证件文字数据随机写入证件背景数据,生成初始证件图片,然后对初始证件图片进行预处理和随机缩放,生成多个目标证件图片组,解决了无法满足多种语言和多种证件的生成需求问题,也提高了生成符合真实场景证件图片的准确率。
上面图3和图4从模块化功能实体的角度对本申请实施例中的证件图片生成装置进行详细描述,下面从硬件处理的角度对本申请实施例中证件图片生成设备进行详细描述。
图5是本申请实施例提供的一种证件图片生成设备的结构示意图,该证件图片生成设备500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)510(例如,一个或一个以上处理器)和存储器520,一个或一个以上存储应用程序533或数据532的存储介质530(例如一个或一个以上海量存储设备)。其中,存储器520和存储介质530可以是短暂存储或持久存储。存储在存储介质530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对证件图片生成设备500中的一系列指令操作。更进一步地,处理器510可以设置为与存储介质530通信,在证件图片生成设备500上执行存储介质530中的一系列指令操作。
证件图片生成设备500还可以包括一个或一个以上电源540,一个或一个以上有线或 无线网络接口550,一个或一个以上输入输出接口560,和/或,一个或一个以上操作系统531,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图5示出的证件图片生成设备结构并不构成对证件图片生成设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
本申请还提供一种证件图片生成设备,所述计算机设备包括存储器和处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时,使得处理器执行上述各实施例中的所述证件图片生成方法的步骤。
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,该计算机可读存储介质也可以为易失性计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行所述证件图片生成方法的步骤。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种证件图片生成方法,其中,所述证件图片生成方法包括:
    获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
    采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
    将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
    对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
    采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
  2. 根据权利要求1所述的证件图片生成方法,其中,所述采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据包括:
    从所述样本证件图片中提取样本文字数据和样本背景数据;
    采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据;
    对所述样本文字数据进行特征提取,生成样本文字向量;
    采用预置的线性回归模型对所述样本文字向量进行识别,确定证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据。
  3. 根据权利要求2所述的证件图片生成方法,其中,所述采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据包括:
    从所述样本背景数据中提取样本像素点、样本重心、样本投影和样本分块;
    基于所述样本像素点在数据库中确定多个像素点相似背景数据;
    基于所述样本重心在所述多个像素点相似背景数据中确定多个样本重心相似背景数据;
    基于所述样本投影在所述多个样本重心相似背景数据中确定多个样本投影相似背景数据;
    基于样本分块在所述多个样本投影相似背景数据中确定证件背景数据。
  4. 根据权利要求1所述的证件图片生成方法,其中,所述将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片包括:
    采用预置的随机函数,在所述证件背景数据的中确定所述证件文字数据的坐标位置,生成文字坐标位置;
    在所述证件背景数据中截取所述文字坐标位置对应的证件背景数据,生成截取后的证件背景数据;
    将所述证件文字数据合并至所述截取后的证件背景数据中,生成初始证件图片。
  5. 根据权利要求1所述的证件图片生成方法,其中,所述对所述初始证件图片进行预处理,生成多个预处理后的证件图片包括:
    对所述初始证件图片进行图像增强,生成图像增强后的证件图片;
    对所述图像增强后的证件图片进行数据增强,生成数据增强后的证件图片;
    对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片。
  6. 根据权利要求5所述的证件图片生成方法,其中,所述对所述初始证件图片进行图像增强,生成图像增强后的证件图片包括:
    对所述初始证件图片进行亮度调整、色度调整和锐度调整,生成初次图像增强后的证件图片;
    对所述初次图像增强后的证件图片进行高斯模糊、高斯噪声处理和分辨率随机调整, 生成图像增强后的证件图片。
  7. 根据权利要求5所述的证件图片生成方法,其中,所述对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片包括:
    对所述数据增强后的证件图片进行随机旋转,生成多个旋转后的证件图片;
    对所述多个旋转后的证件图片进行仿射变换,生成多个仿射变换后的证件图片;
    对所述多个仿射变换后的证件图片进行透视变换,生成多个预处理后的证件图片。
  8. 一种证件图片生成装置,其中,所述证件图片生成装置包括:
    获取模块,用于获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
    数据生成模块,用于采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
    写入模块,用于将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
    预处理模块,用于对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
    随机缩放模块,用于采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
  9. 一种证件图片生成设备,其中,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
    获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
    采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
    将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
    对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
    采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
  10. 根据权利要求9所述的证件图片生成设备,其中,所述处理器执行所述采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据的步骤时,包括:
    从所述样本证件图片中提取样本文字数据和样本背景数据;
    采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据;
    对所述样本文字数据进行特征提取,生成样本文字向量;
    采用预置的线性回归模型对所述样本文字向量进行识别,确定证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据。
  11. 根据权利要求10所述的证件图片生成设备,其中,所述处理器执行所述采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据的步骤时,包括
    从所述样本背景数据中提取样本像素点、样本重心、样本投影和样本分块;
    基于所述样本像素点在数据库中确定多个像素点相似背景数据;
    基于所述样本重心在所述多个像素点相似背景数据中确定多个样本重心相似背景数据;
    基于所述样本投影在所述多个样本重心相似背景数据中确定多个样本投影相似背景数据;
    基于样本分块在所述多个样本投影相似背景数据中确定证件背景数据。
  12. 根据权利要求9所述的证件图片生成设备,其中,所述处理器执行所述将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片的步骤时,包括:
    采用预置的随机函数,在所述证件背景数据的中确定所述证件文字数据的坐标位置,生成文字坐标位置;
    在所述证件背景数据中截取所述文字坐标位置对应的证件背景数据,生成截取后的证件背景数据;
    将所述证件文字数据合并至所述截取后的证件背景数据中,生成初始证件图片。
  13. 根据权利要求9所述的证件图片生成设备,其中,所述处理器执行所述对所述初始证件图片进行预处理,生成多个预处理后的证件图片的步骤时,包括:
    对所述初始证件图片进行图像增强,生成图像增强后的证件图片;
    对所述图像增强后的证件图片进行数据增强,生成数据增强后的证件图片;
    对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片。
  14. 根据权利要求13所述的证件图片生成设备,其中,所述处理器执行所述对所述初始证件图片进行图像增强,生成图像增强后的证件图片的步骤时,包括:
    对所述初始证件图片进行亮度调整、色度调整和锐度调整,生成初次图像增强后的证件图片;
    对所述初次图像增强后的证件图片进行高斯模糊、高斯噪声处理和分辨率随机调整,生成图像增强后的证件图片。
  15. 根据权利要求13所述的证件图片生成设备,其中,所述处理器执行所述对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片的步骤时,包括:
    对所述数据增强后的证件图片进行随机旋转,生成多个旋转后的证件图片;
    对所述多个旋转后的证件图片进行仿射变换,生成多个仿射变换后的证件图片;
    对所述多个仿射变换后的证件图片进行透视变换,生成多个预处理后的证件图片。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:
    获取样本证件图片,所述样本证件图片包括样本文字数据和样本背景数据;
    采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据;
    将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片;
    对所述初始证件图片进行预处理,生成多个预处理后的证件图片;
    采用预置的随机缩放函数分别对所述多个预处理后的证件图片进行多次随机缩放,生成多个目标证件图片组,所述多个预处理后的证件图片与所述多个目标证件图片组一一对应。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行所述采用图片相似度比对算法,基于所述样本证件图片生成证件背景数据和证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据的步骤时,包括:
    从所述样本证件图片中提取样本文字数据和样本背景数据;
    采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据;
    对所述样本文字数据进行特征提取,生成样本文字向量;
    采用预置的线性回归模型对所述样本文字向量进行识别,确定证件文字数据,所述证件文字数据包括文字语言数据和字体样式数据。
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述计算机可读存储介质中 存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行所述采用图片相似度比对算法,在数据库中确定与所述样本背景数据相匹配的证件背景数据的步骤时,包括:
    从所述样本背景数据中提取样本像素点、样本重心、样本投影和样本分块;
    基于所述样本像素点在数据库中确定多个像素点相似背景数据;
    基于所述样本重心在所述多个像素点相似背景数据中确定多个样本重心相似背景数据;
    基于所述样本投影在所述多个样本重心相似背景数据中确定多个样本投影相似背景数据;
    基于样本分块在所述多个样本投影相似背景数据中确定证件背景数据。
  19. 根据权利要求16所述的计算机可读存储介质,其中,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行所述将所述证件文字数据写入所述证件背景数据的随机位置中,生成初始证件图片的步骤时,包括:
    采用预置的随机函数,在所述证件背景数据的中确定所述证件文字数据的坐标位置,生成文字坐标位置;
    在所述证件背景数据中截取所述文字坐标位置对应的证件背景数据,生成截取后的证件背景数据;
    将所述证件文字数据合并至所述截取后的证件背景数据中,生成初始证件图片。
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行所述对所述初始证件图片进行预处理,生成多个预处理后的证件图片的步骤时,包括:
    对所述初始证件图片进行图像增强,生成图像增强后的证件图片;
    对所述图像增强后的证件图片进行数据增强,生成数据增强后的证件图片;
    对所述数据增强后的证件图片进行随机变换,生成多个预处理后的证件图片。
PCT/CN2021/126108 2020-12-23 2021-10-25 证件图片生成方法、装置、设备及存储介质 WO2022134831A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011538787.9 2020-12-23
CN202011538787.9A CN112669412A (zh) 2020-12-23 2020-12-23 证件图片生成方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022134831A1 true WO2022134831A1 (zh) 2022-06-30

Family

ID=75408691

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/126108 WO2022134831A1 (zh) 2020-12-23 2021-10-25 证件图片生成方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN112669412A (zh)
WO (1) WO2022134831A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115410191A (zh) * 2022-11-03 2022-11-29 平安银行股份有限公司 文本图像识别方法、装置、设备和存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112669412A (zh) * 2020-12-23 2021-04-16 深圳壹账通智能科技有限公司 证件图片生成方法、装置、设备及存储介质
CN114463821A (zh) * 2022-02-15 2022-05-10 平安科技(深圳)有限公司 证件数据生成方法、装置、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059689A (zh) * 2019-03-19 2019-07-26 平安科技(深圳)有限公司 样本集构建方法、装置、计算机设备和存储介质
US20200143162A1 (en) * 2017-10-20 2020-05-07 Alibaba Group Holding Limited Document verification and identity verification method and device
CN111222517A (zh) * 2020-01-16 2020-06-02 深圳壹账通智能科技有限公司 测试样本生成方法、系统、计算机设备及存储介质
CN111310634A (zh) * 2020-02-10 2020-06-19 支付宝实验室(新加坡)有限公司 证件类型识别模板的生成方法、证件识别方法及装置
CN112669412A (zh) * 2020-12-23 2021-04-16 深圳壹账通智能科技有限公司 证件图片生成方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200143162A1 (en) * 2017-10-20 2020-05-07 Alibaba Group Holding Limited Document verification and identity verification method and device
CN110059689A (zh) * 2019-03-19 2019-07-26 平安科技(深圳)有限公司 样本集构建方法、装置、计算机设备和存储介质
CN111222517A (zh) * 2020-01-16 2020-06-02 深圳壹账通智能科技有限公司 测试样本生成方法、系统、计算机设备及存储介质
CN111310634A (zh) * 2020-02-10 2020-06-19 支付宝实验室(新加坡)有限公司 证件类型识别模板的生成方法、证件识别方法及装置
CN112669412A (zh) * 2020-12-23 2021-04-16 深圳壹账通智能科技有限公司 证件图片生成方法、装置、设备及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115410191A (zh) * 2022-11-03 2022-11-29 平安银行股份有限公司 文本图像识别方法、装置、设备和存储介质
CN115410191B (zh) * 2022-11-03 2023-02-03 平安银行股份有限公司 文本图像识别方法、装置、设备和存储介质

Also Published As

Publication number Publication date
CN112669412A (zh) 2021-04-16

Similar Documents

Publication Publication Date Title
WO2022134831A1 (zh) 证件图片生成方法、装置、设备及存储介质
US11481878B2 (en) Content-based detection and three dimensional geometric reconstruction of objects in image and video data
US20240048658A1 (en) Content-based object detection, 3d reconstruction, and data extraction from digital images
US9779296B1 (en) Content-based detection and three dimensional geometric reconstruction of objects in image and video data
WO2021017261A1 (zh) 识别模型训练方法、图像识别方法、装置、设备及介质
US11620733B2 (en) Content-based object detection, 3D reconstruction, and data extraction from digital images
US20200410074A1 (en) Identity authentication method and apparatus, electronic device, and storage medium
US20190304066A1 (en) Synthesis method of chinese printed character images and device thereof
US10248954B2 (en) Method and system for verifying user identity using card features
US20160026861A1 (en) Methods and apparatus for capturing, processing, training, and detecting patterns using pattern recognition classifiers
Spreeuwers et al. Towards robust evaluation of face morphing detection
US8494297B2 (en) Automatic detection and mapping of symmetries in an image
WO2017161756A1 (zh) 视频鉴别方法及系统
US8532344B2 (en) Methods and apparatus for generation of cancelable face template
WO2022156178A1 (zh) 图像目标对比方法、装置、计算机设备及可读存储介质
US11238271B2 (en) Detecting artificial facial images using facial landmarks
CN111079571A (zh) 证卡信息识别及其边缘检测模型训练方法、装置
CN113111880A (zh) 证件图像校正方法、装置、电子设备及存储介质
EP3436865A1 (en) Content-based detection and three dimensional geometric reconstruction of objects in image and video data
CN110059711A (zh) 图像的对齐方法、装置及设备
KR102223754B1 (ko) 객체 이미지 개선 방법 및 장치
WO2021051948A1 (zh) 一种基于神经网络的证件识别的训练方法及装置
JPWO2019241265A5 (zh)
AU2014277851A1 (en) Detecting a gap between text columns from text line fragments
JPH11203404A (ja) 景観画像中文字読み取り方法およびその装置およびその方法を記録した記録媒体

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: 21908832

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.11.2023)