[go: up one dir, main page]

CN115661839A - Bill filing method, device, terminal and storage medium - Google Patents

Bill filing method, device, terminal and storage medium Download PDF

Info

Publication number
CN115661839A
CN115661839A CN202211169933.4A CN202211169933A CN115661839A CN 115661839 A CN115661839 A CN 115661839A CN 202211169933 A CN202211169933 A CN 202211169933A CN 115661839 A CN115661839 A CN 115661839A
Authority
CN
China
Prior art keywords
image
word
gray
bill
undetermined
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211169933.4A
Other languages
Chinese (zh)
Inventor
张婕
辛锐
何颖
刘玮
张立永
宋丹
程翠林
申静彦
张雅倩
刘光宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Corp of China SGCC
Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd
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 State Grid Corp of China SGCC, Information and Telecommunication Branch of State Grid Hebei Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN202211169933.4A priority Critical patent/CN115661839A/en
Publication of CN115661839A publication Critical patent/CN115661839A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Character Input (AREA)

Abstract

The invention relates to the technical field of bill word processing, in particular to a bill archiving method, a device, a terminal and a storage medium, wherein the method firstly acquires a bill image; then, identifying the bill image to obtain a plurality of character sets; then, acquiring a plurality of word collections according to the word stock and the plurality of character collections; and finally, filling the plurality of word collections into a plurality of item tables according to the relevance of the bills and the business processes. According to the embodiment of the invention, the bill images are separated to obtain the images of the plurality of bills, and the characters of the plurality of bills are identified based on the images of the plurality of bills, so that the bills can be operated in batch, and the processing efficiency is improved. And then, performing word segmentation according to the characters and word stock of the bill to obtain an index of the word segmentation, and filling the completed item table according to the index of the word segmentation, wherein the filling accuracy is high because the filling is performed according to the relevance of the index.

Description

票据归档方法、装置、终端及存储介质Bill archiving method, device, terminal and storage medium

技术领域technical field

本发明涉及票据文字处理技术领域,尤其涉及一种票据归档方法、装置、终端及存储介质。The invention relates to the technical field of bill word processing, and in particular to a bill filing method, device, terminal and storage medium.

背景技术Background technique

目前,为了减轻财务人员的票据审核及收纳工作,以及节省这方面的人力、物力,现有技术人员创造出了自动化的票据收纳机、票据归档机等,如一种现有技术提供了一种票据自动归档系统,通过票据影像成型机构以及票据纸张归档收纳装置实现了票据的自动收纳。At present, in order to reduce the bill review and storage work of financial personnel, and save manpower and material resources in this regard, existing technical personnel have created automated bill storage machines, bill filing machines, etc., such as a prior art provides a bill The automatic filing system realizes the automatic storage of bills through the bill image forming mechanism and the bill paper filing and storage device.

然而,用户在票据归档时往往会一次性存放多份票据进行高速扫描,以进行数据的电子化,当高速扫描设备工作时,批量票据被放入扫描设备,高速扫描设备执行高速扫描,即批量放入纸张的纸张被高速进纸、执行快速扫描及扫描结果(即扫描生成的图像)缓存、批量纸张的高速排出。这个过程并不包含对图像所包含页面进行识别以区分出票据的各份。一份票据包括封面页和发票页,封面页为包括但不限于写有发票明细、金额、纳税人识别号和/或申请人(审核人)签字等信息的纸张,发票页为粘贴有发票的纸张。However, when filing bills, users often store multiple bills at one time for high-speed scanning to digitize data. When the high-speed scanning device is working, batches of bills are put into the scanning device, and the high-speed scanning device performs high-speed scanning, that is, batch Loaded paper is fed at a high speed, fast scanning is performed and the scan results (i.e. scanned images) are buffered, and batches of paper are discharged at high speed. This process does not involve identifying the pages contained in the image to distinguish the individual copies of the document. A bill includes a cover page and an invoice page. The cover page is a paper with information including but not limited to the invoice details, amount, taxpayer identification number and/or signature of the applicant (reviewer), and the invoice page is the paper on which the invoice is pasted. paper.

如果采用边扫描边识别各份票据,则会存在下述问题:If each bill is recognized while scanning, there will be the following problems:

1、每页的扫描结果都要实时判断,会造成每页都要触发识别进程,造成高速扫描的中断,使得高速扫描设备不能利用其批量高速扫描的特性,影响扫描速度;1. The scanning results of each page must be judged in real time, which will cause the recognition process to be triggered for each page, resulting in the interruption of high-speed scanning, so that high-speed scanning equipment cannot take advantage of its batch high-speed scanning characteristics and affect the scanning speed;

2、识别过程中,只有识别出下一份的首页才可得知上次份数的完成,而对于扫描仪来说其不能将已经扫描完成的纸张回退,使得票据分份时会误排出下一份的首页给上一份票据。2. During the identification process, only by identifying the first page of the next copy can we know the completion of the last copy, and for the scanner, it cannot return the scanned paper, so that the bill will be mistakenly discharged when divided The first page of the next copy is given to the previous note.

基于此,需要开发设计出一种票据归档方法。Based on this, it is necessary to develop and design a bill filing method.

发明内容Contents of the invention

本发明实施方式提供了一种票据归档方法、装置、终端及存储介质,用于解决现有技术中票据归档时需要逐张进行处理,效率较为低下的问题。The embodiments of the present invention provide a bill filing method, device, terminal and storage medium, which are used to solve the problem in the prior art that bills need to be processed one by one when filing, and the efficiency is relatively low.

第一方面,本发明实施方式提供了一种票据归档方法,包括:In the first aspect, the embodiment of the present invention provides a bill filing method, including:

获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像;Obtaining a bill image, wherein the bill image includes a plurality of image blocks, and each image block contains an image of a bill;

对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字;Recognizing the bill image, and acquiring a plurality of character sets, wherein the plurality of character sets correspond to a plurality of bills, and the character sets include face characters of the bill;

根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇;Obtaining multiple vocabulary sets according to the lexicon and the multiple character sets, wherein the multiple vocabulary sets correspond to the multiple bills, and the vocabulary set includes multiple vocabulary representing the face text of the bill;

根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。Filling the plurality of vocabulary sets into a plurality of item tables according to the association between the bill and the business process, wherein the business process is associated with the plurality of item tables.

在一种可能实现的方式中,在所述对所述票据图像进行识别,获取多个文字集之前,包括:In a possible implementation manner, before the recognition of the bill image and the acquisition of multiple character sets, the steps include:

对所述票据图像进行去色,获得灰度图像;Decolorizing the bill image to obtain a grayscale image;

对所述灰度图像的分辨率进行调整,获得预设分辨率的图像,其中,所述分辨率进行调整包括以下至少之一:压缩、裁减以及通过差值扩充像素;Adjusting the resolution of the grayscale image to obtain an image with a preset resolution, wherein the adjustment of the resolution includes at least one of the following: compression, cropping, and pixel expansion through difference;

对所述灰度图像的多个像素进行调整,以使得所述灰度图像的多个像素分布于预设的区间,其中,预设的区间表征所述灰度图像的整体灰度的区间;Adjusting the multiple pixels of the grayscale image so that the multiple pixels of the grayscale image are distributed in a preset interval, wherein the preset interval represents the overall grayscale interval of the grayscale image;

对所述灰度图像的多个像素的灰度曲线进行调整,以符合预设的灰度分布。The grayscale curves of the pixels of the grayscale image are adjusted to conform to the preset grayscale distribution.

在一种可能实现的方式中,所述对所述灰度图像的多个像素进行调整,以使得所述灰度图像的多个像素分布于预设的区间,包括:In a possible implementation manner, the adjusting the multiple pixels of the grayscale image so that the multiple pixels of the grayscale image are distributed in a preset interval includes:

获取对应所述灰度图像中多个像素的多个灰度值;Acquiring multiple grayscale values corresponding to multiple pixels in the grayscale image;

灰度值调整步骤:根据第一公式,调整所述多个灰度值,其中,所述第一公式为:Gray value adjustment step: adjusting the plurality of gray values according to a first formula, wherein the first formula is:

Figure BDA0003859897490000031
Figure BDA0003859897490000031

式中,pid为灰度图像中第i个区间调整后的灰度值,pio为灰度图像中第i个区间调整前的灰度值,pmin为灰度图像中区间调整前的最小值,pmax为灰度图像中区间调整前的最大值,a为预设的区间的最大值,b为预设的区间的最小值。In the formula, p id is the adjusted gray value of the i-th interval in the gray-scale image, p io is the gray-scale value of the i-th interval in the gray-scale image before adjustment, and p min is the gray-scale value before the interval adjustment in the gray-scale image The minimum value, p max is the maximum value before the interval adjustment in the grayscale image, a is the maximum value of the preset interval, and b is the minimum value of the preset interval.

在一种可能实现的方式中,所述对所述灰度图像的多个像素的灰度曲线进行调整,以符合预设的灰度分布,包括:In a possible implementation manner, the adjusting the grayscale curves of the plurality of pixels of the grayscale image to conform to a preset grayscale distribution includes:

获取对应所述灰度图像中多个像素的多个灰度值;Acquiring multiple grayscale values corresponding to multiple pixels in the grayscale image;

对所述多个灰度值按照值的大小进行排序,并根据预设的多个值的区间划分为多个灰度集;Sorting the plurality of grayscale values according to the size of the value, and dividing them into a plurality of grayscale sets according to preset intervals of the plurality of values;

统计多个灰度集中灰度值的数量,获得灰度区间序列,其中,所述灰度区间序列中的每个元素表征对应值的区间中灰度值的数量;Counting the number of grayscale values in multiple grayscale sets to obtain a grayscale interval sequence, wherein each element in the grayscale interval sequence represents the number of grayscale values in the interval of the corresponding value;

若所述灰度值区间序列与样本序列的偏差大于阈值,则根据所述灰度值区间序列与样本序列的偏差通过第二公式,调整所述多个灰度值,并跳转至所述灰度值调整步骤,其中,所述样本序列表征灰度图样本对应值的区间的灰度值的数量,所述第二公式为:If the deviation between the gray value interval sequence and the sample sequence is greater than the threshold, adjust the plurality of gray values through the second formula according to the deviation between the gray value interval sequence and the sample sequence, and jump to the The gray value adjustment step, wherein the sample sequence represents the number of gray values in the interval corresponding to the gray image samples, and the second formula is:

Figure BDA0003859897490000032
Figure BDA0003859897490000032

式中,pic为灰度图像中第i个曲线调整后的灰度值,pid为灰度图像中第i个曲线调整前的灰度值,c为凹凸系数,d为位置系数,b为预设的区间的最小值。In the formula, p ic is the adjusted gray value of the i-th curve in the gray-scale image, p id is the gray-scale value of the i-th curve in the gray-scale image before adjustment, c is the concave-convex coefficient, d is the position coefficient, b is the minimum value of the preset interval.

在一种可能实现的方式中,所述对所述票据图像进行识别,获取多个文字集,包括:In a possible implementation manner, the identifying the bill image and acquiring multiple character sets includes:

根据所述票据图像提取多个图像块,其中,多个图像块与多个票据相对应;extracting multiple image blocks according to the bill image, wherein the multiple image blocks correspond to multiple bills;

将所述多个图像块分别送入到文字识别模型中,获取与所述多个图像块相对应的多个文字集,其中,所述文字识别模型基于CNN神经网络模型构建的初始模型,经过多个训练样本训练获得;Send the multiple image blocks into the text recognition model respectively, and obtain multiple text sets corresponding to the multiple image blocks, wherein the text recognition model is based on the initial model constructed by the CNN neural network model, after Multiple training samples are obtained through training;

其中,所述根据所述票据图像提取多个图像块,包括:Wherein, the extracting a plurality of image blocks according to the bill image includes:

对于所述票据图像分别从水平和竖直方向分别执行如下步骤:For the bill image, perform the following steps respectively from the horizontal and vertical directions:

获取扫描集,其中,扫描集为空集合;Get the scan set, where the scan set is an empty set;

取值步骤:通过所述扫描集从所述票据图像的起始位置获取一行或一列的多个像素值;Value acquisition step: acquiring a plurality of pixel values of one row or one column from the starting position of the receipt image through the scan set;

计算所述扫描集中各个元素的和,作为扫描和;calculating the sum of each element in the scan set as a scan sum;

若所述扫描和小于阈值,则标记所述扫描集所在的行或列为空白;If the scan sum is less than a threshold, mark the row or column where the scan set is located as blank;

若所述扫描集未达到所述票据图像的末端位置,则按照预设的移动距离,移动所述扫描集在所述票据图像中的位置,并跳转至所述取值步骤;If the scan set does not reach the end position of the bill image, move the position of the scan set in the bill image according to a preset moving distance, and jump to the step of obtaining a value;

统计连续空白的行或列,将所述连续空白超过阈值的行或列作为裁切线;Count the rows or columns of continuous blanks, and use the rows or columns of the continuous blanks exceeding the threshold as the cutting line;

根据多个裁切线裁切所述票据图像,获得多个图像块。Cutting the bill image according to multiple cutting lines to obtain multiple image blocks.

在一种可能实现的方式中,所述根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇,包括:In a possible implementation manner, the multiple vocabulary sets are acquired according to the thesaurus and the multiple word sets, wherein the multiple vocabulary sets correspond to the multiple notes, and the vocabulary sets include multiple Vocabulary characterizing the face text of bills, including:

对于每个文字集执行如下步骤:For each text set perform the following steps:

获取待定索引以及词汇集,所述待定索引为空索引,所述词汇集为空词汇集;Obtain a pending index and a vocabulary set, the pending index is an empty index, and the vocabulary set is an empty vocabulary set;

从文字集的开始位置,选取一个字作为待定词;From the beginning position of the text set, select a word as the undetermined word;

查找步骤:从所述词库中查找所述待定词;Searching step: searching for the undetermined word from the thesaurus;

若所述词库中包括有所述待定词,则将获取的所述待定词的索引作为待定索引,并选取所述待定词后的一个字,加入到所述待定词中,跳转至所述查找步骤;If the undetermined word is included in the thesaurus, the obtained index of the undetermined word is used as the undetermined index, and a word after the undetermined word is selected, added to the undetermined word, and jumps to the Describe the search steps;

若所述词库中不包括有所述待定词,且所述待定索引为空索引,则选取所述待定词后的一个字,加入到所述待定词中,并跳转至所述查找步骤;If the undetermined word is not included in the thesaurus, and the undetermined index is an empty index, then select a character after the undetermined word, add it to the undetermined word, and jump to the search step ;

若所述词库中不包括有所述待定词,且所述待定索引为非空索引,则将所述待定索引加入到所述词汇集中,并将所述待定索引置为空索引,如果所述待定词未达到所述文字集的末端,则选取所述待定词后的一个字作为待定词,并跳转至所述查找步骤。If the undetermined word is not included in the thesaurus, and the undetermined index is a non-empty index, then the undetermined index is added to the vocabulary set, and the undetermined index is set as an empty index. If the undetermined word does not reach the end of the word set, select a word after the undetermined word as the undetermined word, and jump to the search step.

在一种可能实现的方式中,根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,包括:In a possible implementation manner, according to the correlation between the bill and the business process, the multiple vocabulary sets are filled into multiple item tables, including:

获取业务流以及与所述业务流相关的多个项目表,其中,所述业务流与所述多个票据相关联;Obtaining a business flow and a plurality of item tables related to the business flow, wherein the business flow is associated with the plurality of notes;

对于每个项目表,执行如下步骤:For each project table, perform the following steps:

提取列表项以及待填写项,其中,所述待填写项根据所述列表项填写词汇;Extracting list items and items to be filled, wherein, the items to be filled are filled with vocabulary according to the list items;

根据所述列表项,从所述词库中找到所述列表项的索引;Find the index of the list item from the thesaurus according to the list item;

从所述词汇集中找到与所述列表项的索引差值最小的词汇,填入与所述列表项所对应的填写项,其中,所述词汇集中相对应的词汇相邻排列。Find the vocabulary with the smallest index difference with the list item from the vocabulary set, and fill in the item corresponding to the list item, wherein the corresponding vocabulary in the vocabulary set is arranged adjacently.

第二方面,本发明实施方式提供了一种票据归档装置,用于实现如上第一方面或第一方面的任一种可能的实现方式所述的票据归档方法,所述票据归档装置包括:In the second aspect, the embodiment of the present invention provides a bill filing device, which is used to implement the bill filing method described in the first aspect or any possible implementation manner of the first aspect, the bill filing device includes:

图像获取模块,用于获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像;An image acquisition module, configured to acquire a bill image, wherein the bill image includes a plurality of image blocks, and each image block contains an image of a bill;

文字识别模块,用于对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字;A character recognition module, configured to recognize the bill image and acquire multiple character sets, wherein the multiple character sets correspond to multiple bills, and the character sets include the face characters of the bills;

分词模块,用于根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇;A word segmentation module, configured to acquire a plurality of vocabulary sets according to the thesaurus and the plurality of character sets, wherein the plurality of vocabulary sets correspond to the plurality of notes, and the vocabulary set includes a plurality of words representing the face text of the note ;

以及,as well as,

填表模块,用于根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。The form filling module is configured to fill the plurality of vocabulary sets into a plurality of item tables according to the association between the bill and the business process, wherein the business process is associated with the plurality of item tables.

第三方面,本发明实施方式提供了一种终端,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上第一方面或第一方面的任一种可能的实现方式所述方法的步骤。In the third aspect, the embodiment of the present invention provides a terminal, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the above when executing the computer program Steps in the method described in the first aspect or any possible implementation manner of the first aspect.

第四方面,本发明实施方式提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上第一方面或第一方面的任一种可能的实现方式所述方法的步骤。In a fourth aspect, the embodiment of the present invention provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above first aspect or the first aspect is implemented. A possible implementation manner is the steps of the described method.

本发明实施方式与现有技术相比存在的有益效果是:The beneficial effect that the embodiment of the present invention exists compared with prior art is:

本发明实施方式公开了的一种票据归档方法,其首先获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像;然后,对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字;接着,根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇;最后,根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。本发明实施方式,其对票据图像进行了分隔,获取到多个票据的图像,再基于多个票据的图像,识别出多个票据的文字,因此,可以批量操作票据,提高了处理的效率。再根据票据的文字和词库,进行分词,获取分词的索引,根据分词的索引,对完成项目表的填写,由于依靠索引的关联性填写,因此,填写的准确度高。A bill filing method disclosed in the embodiment of the present invention, which first acquires a bill image, wherein the bill image includes a plurality of image blocks, and each image block contains an image of a bill; then, the bill image is processed Identifying and obtaining multiple character sets, wherein the multiple character sets correspond to multiple bills, and the character sets include the face characters of the bills; then, according to the lexicon and the multiple character sets, obtain multiple vocabulary sets, wherein, The plurality of vocabulary sets correspond to the plurality of bills, and the vocabulary set includes a plurality of vocabulary representing the face text of the bills; finally, according to the relevance between the bill and the business process, the plurality of vocabulary sets are filled in a plurality of items table, wherein the business process is associated with the plurality of project tables. In the embodiment of the present invention, the bill images are separated, multiple bill images are obtained, and the characters of multiple bills are recognized based on the multiple bill images. Therefore, the bills can be operated in batches, and the processing efficiency is improved. Then, according to the text and thesaurus of the bill, perform word segmentation to obtain the index of the word segmentation. According to the index of the word segmentation, the filling of the completed item table is based on the relevance of the index, so the accuracy of filling is high.

附图说明Description of drawings

为了更清楚地说明本发明实施方式中的技术方案,下面将对实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings that need to be used in the embodiments or descriptions of the prior art. Obviously, the drawings in the following descriptions are only of the present invention. For some embodiments, those of ordinary skill in the art can also obtain other drawings based on these drawings without paying creative efforts.

图1是本发明实施方式提供的票据归档方法的流程图;Fig. 1 is a flow chart of the bill filing method provided by the embodiment of the present invention;

图2是本发明实施方式提供的图像分隔过程示意图;Fig. 2 is a schematic diagram of an image separation process provided by an embodiment of the present invention;

图3是本发明实施方式提供的票据归档装置功能框图;Fig. 3 is a functional block diagram of the bill filing device provided by the embodiment of the present invention;

图4是本发明实施方式提供的终端功能框图。Fig. 4 is a functional block diagram of a terminal provided by an embodiment of the present invention.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本发明实施方式。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施方式中也可以实现本发明。在其它情况中,省略对众所周知的系统、装置以及方法的详细说明,以免不必要的细节妨碍本发明的描述。In the following description, specific details such as specific system structures and techniques are presented for illustration rather than limitation, so as to thoroughly understand the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图通过具体实施方式来进行说明。In order to make the purpose, technical solution and advantages of the present invention more clear, the following will describe through specific implementation manners in conjunction with the accompanying drawings.

下面对本发明的实施例作详细说明,本实例在以本发明技术方案为前提下进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。Below the embodiment of the present invention is described in detail, and this example is carried out under the premise of technical solution of the present invention, has provided detailed implementation mode and concrete operation process, but protection scope of the present invention is not limited to following embodiment .

图1为本发明实施方式提供的票据归档方法的流程图。Fig. 1 is a flow chart of a bill filing method provided by an embodiment of the present invention.

如图1所示,其示出了本发明实施方式提供的票据归档方法的实现流程图,详述如下:As shown in Figure 1, it shows the implementation flow chart of the bill filing method provided by the embodiment of the present invention, which is described in detail as follows:

在步骤101中,获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像。In step 101, a bill image is acquired, wherein the bill image includes a plurality of image blocks, and each image block contains an image of a bill.

在步骤102中,对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字。In step 102, the image of the bill is recognized, and multiple character sets are acquired, wherein the multiple character sets correspond to multiple bills, and the character sets include the characters on the face of the bill.

在一些实施方式中,所述步骤102包括:In some embodiments, the step 102 includes:

根据所述票据图像提取多个图像块,其中,多个图像块与多个票据相对应;extracting multiple image blocks according to the bill image, wherein the multiple image blocks correspond to multiple bills;

将所述多个图像块分别送入到文字识别模型中,获取与所述多个图像块相对应的多个文字集,其中,所述文字识别模型基于CNN神经网络模型构建的初始模型,经过多个训练样本训练获得;Send the multiple image blocks into the text recognition model respectively, and obtain multiple text sets corresponding to the multiple image blocks, wherein the text recognition model is based on the initial model constructed by the CNN neural network model, after Multiple training samples are obtained through training;

其中,所述根据所述票据图像提取多个图像块,包括:Wherein, the extracting a plurality of image blocks according to the bill image includes:

对于所述票据图像分别从水平和竖直方向分别执行如下步骤:For the bill image, perform the following steps respectively from the horizontal and vertical directions:

获取扫描集,其中,扫描集为空集合;Get the scan set, where the scan set is an empty set;

取值步骤:通过所述扫描集从所述票据图像的起始位置获取一行或一列的多个像素值;Value acquisition step: acquiring a plurality of pixel values of one row or one column from the starting position of the receipt image through the scan set;

计算所述扫描集中各个元素的和,作为扫描和;calculating the sum of each element in the scan set as a scan sum;

若所述扫描和小于阈值,则标记所述扫描集所在的行或列为空白;If the scan sum is less than a threshold, mark the row or column where the scan set is located as blank;

若所述扫描集未达到所述票据图像的末端位置,则按照预设的移动距离,移动所述扫描集在所述票据图像中的位置,并跳转至所述取值步骤;If the scan set does not reach the end position of the bill image, move the position of the scan set in the bill image according to a preset moving distance, and jump to the step of obtaining a value;

统计连续空白的行或列,将所述连续空白超过阈值的行或列作为裁切线;Count the rows or columns of continuous blanks, and use the rows or columns of the continuous blanks exceeding the threshold as the cutting line;

根据多个裁切线裁切所述票据图像,获得多个图像块。Cutting the bill image according to multiple cutting lines to obtain multiple image blocks.

示例性地,本发明实施方式中,对于票据图像的识别是基于将图像分隔为多个块,每个块包含一张票据的图像,然后再将图像输入到识别模型中进行识别的。Exemplarily, in the embodiment of the present invention, the recognition of the bill image is based on dividing the image into multiple blocks, each block contains an image of a bill, and then inputting the image into the recognition model for recognition.

识别模型是基于初始模型训练获得的,而在一些应用场景中,初始模型基于CNN神经网络模型进行构建,CNN神经网络模型具体而言,包括有卷积层、池化层、全连接的隐含层和输出层,卷积层用于通过卷积的方式提取到图像的主要特征,而池化层则用于进一步汇集特征,减少特征的数据量,池化层输出的数据经过全连接的隐含层计算后,通过输出层输出指示图像中包括的文字。The recognition model is obtained based on the initial model training, and in some application scenarios, the initial model is constructed based on the CNN neural network model. Specifically, the CNN neural network model includes a convolutional layer, a pooling layer, and a fully connected hidden layer. Layer and output layer, the convolutional layer is used to extract the main features of the image through convolution, and the pooling layer is used to further collect features and reduce the amount of feature data. The data output by the pooling layer is fully connected hidden After the inclusion layer is calculated, the text included in the indicated image is output through the output layer.

对于训练步骤,具体而言,就是将多个文字的图像样本送入到初始模型中,通过初始模型输出的结果与文字的偏差,调整模型的参数,也就是通过迭代的方式,逐步提高初始模型的识别精度,直至模型具备预期的识别精度。For the training step, specifically, it is to send image samples of multiple characters into the initial model, and adjust the parameters of the model through the deviation between the output result of the initial model and the text, that is, to gradually improve the initial model through iteration. recognition accuracy until the model has the expected recognition accuracy.

对于图像分隔步骤而言,其基本原理是识别多个票据图像的边界,如图2所示,票据图像201中包括有多个图像块202,多个图像块202之间的空白远高于图像块行间距之间的空白,通过识别空白宽度,就可以找到分隔线,对图像进行分隔。For the image separation step, the basic principle is to identify the boundaries of multiple bill images. As shown in FIG. The blank between the block line spacing, by identifying the blank width, you can find the separation line and separate the image.

在一种应用场景中,分割是通过扫描集204按照预定的顺序,例如,从上到下、从左到右水平或竖直的取出图像中一行或一列的像素值,图2中,是从上往下,取出水平行203所在的像素值,放入到扫描集204中的。In one application scenario, the segmentation is to scan the set 204 in a predetermined order, for example, from top to bottom, from left to right horizontally or vertically to take out the pixel values of one row or one column in the image. In FIG. 2, it is from From top to bottom, take out the pixel value where the horizontal line 203 is located, and put it into the scan set 204 .

扫描完以后,计算扫描集204中各个元素的和,若该和小于阈值,则说明该行空白较多,将该行标记为空白,然后,按照预定的顺序移动水平行203,重复上述步骤。After scanning, the sum of each element in the scan set 204 is calculated. If the sum is less than the threshold value, it indicates that the row is blank, and the row is marked as blank. Then, the horizontal row 203 is moved in a predetermined order, and the above steps are repeated.

若连续多行均为空白,则可以将多行中的一行作为裁切线,根据裁切线裁切,获得多个图像块。If multiple consecutive lines are all blank, one of the multiple lines may be used as a cutting line, and cut according to the cutting line to obtain multiple image blocks.

在步骤102之前,包括:Before step 102, including:

对所述票据图像进行去色,获得灰度图像;Decolorizing the bill image to obtain a grayscale image;

对所述灰度图像的分辨率进行调整,获得预设分辨率的图像,其中,所述分辨率进行调整包括以下至少之一:压缩、裁减以及通过差值扩充像素;Adjusting the resolution of the grayscale image to obtain an image with a preset resolution, wherein the adjustment of the resolution includes at least one of the following: compression, cropping, and pixel expansion through difference;

对所述灰度图像的多个像素进行调整,以使得所述灰度图像的多个像素分布于预设的区间,其中,预设的区间表征所述灰度图像的整体灰度的区间;Adjusting the multiple pixels of the grayscale image so that the multiple pixels of the grayscale image are distributed in a preset interval, wherein the preset interval represents the overall grayscale interval of the grayscale image;

对所述灰度图像的多个像素的灰度曲线进行调整,以符合预设的灰度分布。The grayscale curves of the pixels of the grayscale image are adjusted to conform to the preset grayscale distribution.

在一些实施方式中,所述对所述灰度图像的多个像素进行调整,以使得所述灰度图像的多个像素分布于预设的区间,包括:In some implementation manners, the adjusting the multiple pixels of the grayscale image so that the multiple pixels of the grayscale image are distributed in a preset interval includes:

获取对应所述灰度图像中多个像素的多个灰度值;Acquiring multiple grayscale values corresponding to multiple pixels in the grayscale image;

灰度值调整步骤:根据第一公式,调整所述多个灰度值,其中,所述第一公式为:Gray value adjustment step: adjusting the plurality of gray values according to a first formula, wherein the first formula is:

Figure BDA0003859897490000091
Figure BDA0003859897490000091

式中,pid为灰度图像中第i个区间调整后的灰度值,pio为灰度图像中第i个区间调整前的灰度值,pmin为灰度图像中区间调整前的最小值,pmax为灰度图像中区间调整前的最大值,a为预设的区间的最大值,b为预设的区间的最小值。In the formula, p id is the adjusted gray value of the i-th interval in the gray-scale image, p io is the gray-scale value of the i-th interval in the gray-scale image before adjustment, and p min is the gray-scale value before the interval adjustment in the gray-scale image The minimum value, p max is the maximum value before the interval adjustment in the grayscale image, a is the maximum value of the preset interval, and b is the minimum value of the preset interval.

在一些实施方式中,所述对所述灰度图像的多个像素的灰度曲线进行调整,以符合预设的灰度分布,包括:In some implementation manners, the adjusting the grayscale curves of the plurality of pixels of the grayscale image to conform to a preset grayscale distribution includes:

获取对应所述灰度图像中多个像素的多个灰度值;Acquiring multiple grayscale values corresponding to multiple pixels in the grayscale image;

对所述多个灰度值按照值的大小进行排序,并根据预设的多个值的区间划分为多个灰度集;Sorting the plurality of grayscale values according to the size of the value, and dividing them into a plurality of grayscale sets according to preset intervals of the plurality of values;

统计多个灰度集中灰度值的数量,获得灰度区间序列,其中,所述灰度区间序列中的每个元素表征对应值的区间中灰度值的数量;Counting the number of grayscale values in multiple grayscale sets to obtain a grayscale interval sequence, wherein each element in the grayscale interval sequence represents the number of grayscale values in the interval of the corresponding value;

若所述灰度值区间序列与样本序列的偏差大于阈值,则根据所述灰度值区间序列与样本序列的偏差通过第二公式,调整所述多个灰度值,并跳转至所述灰度值调整步骤,其中,所述样本序列表征灰度图样本对应值的区间的灰度值的数量,所述第二公式为:If the deviation between the gray value interval sequence and the sample sequence is greater than the threshold, adjust the plurality of gray values through the second formula according to the deviation between the gray value interval sequence and the sample sequence, and jump to the The gray value adjustment step, wherein the sample sequence represents the number of gray values in the interval corresponding to the gray image samples, and the second formula is:

Figure BDA0003859897490000101
Figure BDA0003859897490000101

式中,pic为灰度图像中第i个曲线调整后的灰度值,pid为灰度图像中第i个曲线调整前的灰度值,c为凹凸系数,d为位置系数,b为预设的区间的最小值。In the formula, p ic is the adjusted gray value of the i-th curve in the gray-scale image, p id is the gray-scale value of the i-th curve in the gray-scale image before adjustment, c is the concave-convex coefficient, d is the position coefficient, b is the minimum value of the preset interval.

示例性地,如我们所知,图像保持较好的一致性,有利于图像识别的过程,因此对于识别前的预处理必不可少。Exemplarily, as we know, images maintain good consistency, which is beneficial to the process of image recognition, so it is essential for preprocessing before recognition.

本发明实施方式中,对于图像的预处理,是首先对图像进行去色,然后调整图像的分辨率到预设的区间,接着再调整图像的整体灰度数值区间,最后,调整各个灰度区间的分布。In the embodiment of the present invention, the preprocessing of the image is to firstly decolorize the image, then adjust the resolution of the image to a preset interval, then adjust the overall grayscale value interval of the image, and finally adjust each grayscale interval Distribution.

就调整图像整体灰度区间而言,其采用第一公式调整图像中各个像素的数值:In terms of adjusting the overall grayscale range of the image, it uses the first formula to adjust the value of each pixel in the image:

Figure BDA0003859897490000102
Figure BDA0003859897490000102

式中,pid为灰度图像中第i个区间调整后的灰度值,pio为灰度图像中第i个区间调整前的灰度值,pmin为灰度图像中区间调整前的最小值,pmax为灰度图像中区间调整前的最大值,a为预设的区间的最大值,b为预设的区间的最小值。In the formula, p id is the adjusted gray value of the i-th interval in the gray-scale image, p io is the gray-scale value of the i-th interval in the gray-scale image before adjustment, and p min is the gray-scale value before the interval adjustment in the gray-scale image The minimum value, p max is the maximum value before the interval adjustment in the grayscale image, a is the maximum value of the preset interval, and b is the minimum value of the preset interval.

在调整好整体图像的像素值区间后,需要调整图像的灰度曲线,即调整图像中各个灰度区间的分布。After adjusting the pixel value interval of the overall image, it is necessary to adjust the grayscale curve of the image, that is, to adjust the distribution of each grayscale interval in the image.

首先,统计各个灰度区间中像素值的数量,如果各个区间像素值的数量不符合预期的要求,例如,低数值的灰度区间占比较多,则说明灰度曲线较凸。而如果高数值的灰度区间占比较多,则说明灰度曲线较凹。First, count the number of pixel values in each grayscale interval. If the number of pixel values in each interval does not meet the expected requirements, for example, the proportion of grayscale intervals with low values is more, indicating that the grayscale curve is more convex. And if there are more grayscale intervals with high values, it means that the grayscale curve is more concave.

应用第二公式可以调整曲线的凹凸度:The bumpiness of the curve can be adjusted by applying the second formula:

Figure BDA0003859897490000111
Figure BDA0003859897490000111

式中,pic为灰度图像中第i个曲线调整后的灰度值,pid为灰度图像中第i个曲线调整前的灰度值,c为凹凸系数,d为位置系数,b为预设的区间的最小值。In the formula, p ic is the adjusted gray value of the i-th curve in the gray-scale image, p id is the gray-scale value of the i-th curve in the gray-scale image before adjustment, c is the concave-convex coefficient, d is the position coefficient, b is the minimum value of the preset interval.

对于较凹的曲线,则可以将凹凸系数置为负值,就可以通过第二公式调整灰度曲线,使得其凹度变小。For a more concave curve, the concave-convex coefficient can be set to a negative value, and the gray-scale curve can be adjusted through the second formula to make its concavity smaller.

对于较凸的曲线,将凹凸系数置为正值,就可以通过第二公式调整灰度曲线,使得其凸度变小。For a more convex curve, setting the concave-convex coefficient to a positive value can adjust the gray-scale curve through the second formula to make its convexity smaller.

而位置系数是控制凸点位置的系数,例如,凸点接近于灰度曲线的最右位置,则将位置系数置为较大的正值,如果凸点接近于灰度曲线的最左侧位置,则将位置系数置为较小的正值或负值。The position coefficient is a coefficient to control the position of the bump. For example, if the bump is close to the rightmost position of the grayscale curve, set the position coefficient to a larger positive value. If the bump is close to the leftmost position of the grayscale curve , set the position factor to a small positive or negative value.

在步骤103中,根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇。In step 103, a plurality of vocabulary sets are obtained according to the thesaurus and the plurality of character sets, wherein the plurality of vocabulary sets correspond to the plurality of bills, and the vocabulary sets include a plurality of vocabulary representing the face text of the bill .

在一些实施方式中,步骤103包括:In some implementations, step 103 includes:

对于每个文字集执行如下步骤:For each text set perform the following steps:

获取待定索引以及词汇集,所述待定索引为空索引,所述词汇集为空词汇集;Obtain a pending index and a vocabulary set, the pending index is an empty index, and the vocabulary set is an empty vocabulary set;

从文字集的开始位置,选取一个字作为待定词;From the beginning position of the text set, select a word as the undetermined word;

查找步骤:从所述词库中查找所述待定词;Searching step: searching for the undetermined word from the thesaurus;

若所述词库中包括有所述待定词,则将获取的所述待定词的索引作为待定索引,并选取所述待定词后的一个字,加入到所述待定词中,跳转至所述查找步骤;If the undetermined word is included in the thesaurus, the obtained index of the undetermined word is used as the undetermined index, and a word after the undetermined word is selected, added to the undetermined word, and jumps to the Describe the search steps;

若所述词库中不包括有所述待定词,且所述待定索引为空索引,则选取所述待定词后的一个字,加入到所述待定词中,并跳转至所述查找步骤;If the undetermined word is not included in the thesaurus, and the undetermined index is an empty index, then select a character after the undetermined word, add it to the undetermined word, and jump to the search step ;

若所述词库中不包括有所述待定词,且所述待定索引为非空索引,则将所述待定索引加入到所述词汇集中,并将所述待定索引置为空索引,如果所述待定词未达到所述文字集的末端,则选取所述待定词后的一个字作为待定词,并跳转至所述查找步骤。If the undetermined word is not included in the thesaurus, and the undetermined index is a non-empty index, then the undetermined index is added to the vocabulary set, and the undetermined index is set as an empty index. If the undetermined word does not reach the end of the word set, select a word after the undetermined word as the undetermined word, and jump to the search step.

示例性地,词库中包括有多个词汇,多个词汇按照对应性的顺序排列,排列号即为该词汇的索引。对应性是指两个词的应答对,例如,对于设备名称这个词汇,对应的词汇包括变压器、隔离开关、断路器、路由器、交换机等等。Exemplarily, the thesaurus includes a plurality of words, and the plurality of words are arranged in order of correspondence, and the arrangement number is the index of the word. Correspondence refers to the answer pair of two words, for example, for the vocabulary of equipment name, the corresponding vocabulary includes transformer, disconnector, circuit breaker, router, switch and so on.

对于文字集分词时,通过文字组合找到词库中对应的词汇,则说明分词成功,再此基础上如果再加入一个字,再在词库中找对应的词汇,如果找到则将新加入的字作为新的词,否则,说明分词完成。For the word segmentation of the text set, find the corresponding vocabulary in the thesaurus through text combination, which means that the word segmentation is successful. On this basis, if you add another word, then find the corresponding vocabulary in the thesaurus. If found, the newly added word will be added. As a new word, otherwise, the word participle is complete.

将分词对应的索引加入到词汇集中,就获得了对应文字集的词汇集。The index corresponding to the word segmentation is added to the vocabulary set, and the vocabulary set corresponding to the text set is obtained.

在步骤104中,根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。In step 104, the plurality of vocabulary sets are filled into a plurality of item tables according to the association between the ticket and the business process, wherein the business process is associated with the plurality of item tables.

在一些实施方式中,步骤104包括:In some embodiments, step 104 includes:

获取业务流以及与所述业务流相关的多个项目表,其中,所述业务流与所述多个票据相关联;Obtaining a business flow and a plurality of item tables related to the business flow, wherein the business flow is associated with the plurality of notes;

对于每个项目表,执行如下步骤:For each project table, perform the following steps:

提取列表项以及待填写项,其中,所述待填写项根据所述列表项填写词汇;Extracting list items and items to be filled, wherein, the items to be filled are filled with vocabulary according to the list items;

根据所述列表项,从所述词库中找到所述列表项的索引;Find the index of the list item from the thesaurus according to the list item;

从所述词汇集中找到与所述列表项的索引差值最小的词汇,填入与所述列表项所对应的填写项,其中,所述词汇集中相对应的词汇相邻排列。Find the vocabulary with the smallest index difference with the list item from the vocabulary set, and fill in the item corresponding to the list item, wherein the corresponding vocabulary in the vocabulary set is arranged adjacently.

示例性地,一般而言,一个业务流对应多个项目表单,将多个词汇集与多个项目表单关联后,就可以实现填表过程。Exemplarily, generally speaking, one business flow corresponds to multiple project forms, and after associating multiple vocabulary sets with multiple project forms, the form filling process can be realized.

具体来说,基于词库提取列表项的索引,根据列表项的索引从词汇集中找到与之差最小的词汇,填入到填写项中。Specifically, the index of the list item is extracted based on the thesaurus, and the vocabulary with the smallest difference is found from the vocabulary set according to the index of the list item, and filled into the filling item.

本发明票据归档方法实施方式,其首先获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像;然后,对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字;接着,根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇;最后,根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。本发明实施方式,其对票据图像进行了分隔,获取到多个票据的图像,再基于多个票据的图像,识别出多个票据的文字,因此,可以批量操作票据,提高了处理的效率。再根据票据的文字和词库,进行分词,获取分词的索引,根据分词的索引,对完成项目表的填写,由于依靠索引的关联性填写,因此,填写的准确度高。The embodiment of the bill filing method of the present invention first acquires the bill image, wherein the bill image includes a plurality of image blocks, and each image block contains an image of a bill; then, the bill image is identified to obtain multiple A character set, wherein a plurality of character sets correspond to a plurality of bills, and the character set includes face characters of bills; then, according to the thesaurus and the plurality of character sets, a plurality of vocabulary sets are obtained, wherein the plurality of vocabulary The set corresponds to the plurality of bills, and the vocabulary set includes a plurality of vocabulary representing the face text of the bill; finally, according to the relevance between the bill and the business process, the plurality of vocabulary sets are filled in multiple item tables, wherein, The business process is associated with the multiple item tables. In the embodiment of the present invention, the bill images are separated, multiple bill images are obtained, and the characters of multiple bills are recognized based on the multiple bill images. Therefore, the bills can be operated in batches, and the processing efficiency is improved. Then, according to the text and thesaurus of the bill, perform word segmentation to obtain the index of the word segmentation. According to the index of the word segmentation, the filling of the completed item table is based on the relevance of the index, so the accuracy of filling is high.

应理解,上述实施方式中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施方式的实施过程构成任何限定。It should be understood that the sequence numbers of the steps in the above embodiments do not mean the order of execution, and the execution order of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

以下为本发明的装置实施方式,对于其中未详尽描述的细节,可以参考上述对应的方法实施方式。The following are device implementations of the present invention, and for details that are not described in detail, reference may be made to the corresponding method implementations above.

图3是本发明实施方式提供的票据归档装置功能框图,参照图3,票据归档装置3包括:图像获取模块301、文字识别模块302、分词模块303以及填表模块304,其中:Fig. 3 is a functional block diagram of the bill filing device provided by the embodiment of the present invention. With reference to Fig. 3, the bill filing device 3 includes: an image acquisition module 301, a character recognition module 302, a word segmentation module 303 and a form filling module 304, wherein:

图像获取模块301,用于获取票据图像,其中,票据图像中包括有多个图像块,每个图像块包含有一张票据的图像;An image acquisition module 301, configured to acquire a receipt image, wherein the receipt image includes a plurality of image blocks, and each image block contains an image of a receipt;

文字识别模块302,用于对所述票据图像进行识别,获取多个文字集,其中,多个文字集与多个票据相对应,文字集中包括票据的票面文字;A character recognition module 302, configured to recognize the bill image and acquire multiple character sets, wherein the multiple character sets correspond to multiple bills, and the character sets include the face characters of the bills;

分词模块303,用于根据词库以及所述多个文字集,获取多个词汇集,其中,所述多个词汇集与所述多个票据相对应,词汇集包括多个表征票据票面文字的词汇;The word segmentation module 303 is configured to acquire multiple vocabulary sets according to the thesaurus and the multiple character sets, wherein the multiple vocabulary sets correspond to the multiple bills, and the vocabulary sets include multiple character vocabulary;

填表模块304,用于根据票据与业务流程的关联性,将所述多个词汇集填入多个项目表中,其中,所述业务流程关联所述多个项目表。The form filling module 304 is configured to fill the multiple vocabulary sets into multiple item tables according to the association between the bill and the business process, wherein the business process is associated with the multiple item tables.

图4是本发明实施方式提供的终端的功能框图。如图4所示,该实施方式的终端4包括:处理器400和存储器401,所述存储器401中存储有可在所述处理器400上运行的计算机程序402。所述处理器400执行所述计算机程序402时实现上述各个票据归档方法及实施方式中的步骤,例如图1所示的步骤101至步骤104。Fig. 4 is a functional block diagram of a terminal provided by an embodiment of the present invention. As shown in FIG. 4 , the terminal 4 in this embodiment includes: a processor 400 and a memory 401 , and the memory 401 stores a computer program 402 that can run on the processor 400 . When the processor 400 executes the computer program 402, it realizes the steps in the above-mentioned various bill filing methods and implementations, for example, steps 101 to 104 shown in FIG. 1 .

示例性的,所述计算机程序402可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器401中,并由所述处理器400执行,以完成本发明。Exemplarily, the computer program 402 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 401 and executed by the processor 400 to complete this invention.

所述终端4可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端4可包括,但不仅限于,处理器400、存储器401。本领域技术人员可以理解,图4仅仅是终端4的示例,并不构成对终端4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端4还可以包括输入输出设备、网络接入设备、总线等。The terminal 4 may be a computing device such as a desktop computer, a notebook, a palmtop computer, or a cloud server. The terminal 4 may include, but not limited to, a processor 400 and a memory 401 . Those skilled in the art can understand that FIG. 4 is only an example of the terminal 4 and does not constitute a limitation on the terminal 4. It may include more or less components than shown in the figure, or combine some components, or different components, such as The terminal 4 may also include an input and output device, a network access device, a bus, and the like.

所称处理器400可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 400 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.

所述存储器401可以是所述终端4的内部存储单元,例如终端4的硬盘或内存。所述存储器401也可以是所述终端4的外部存储设备,例如所述终端4上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器401还可以既包括所述终端4的内部存储单元也包括外部存储设备。所述存储器401用于存储所述计算机程序402以及所述终端4所需的其他程序和数据。所述存储器401还可以用于暂时地存储已经输出或者将要输出的数据。The storage 401 may be an internal storage unit of the terminal 4 , such as a hard disk or memory of the terminal 4 . The memory 401 may also be an external storage device of the terminal 4, such as a plug-in hard disk equipped on the terminal 4, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, Flash Card (Flash Card), etc. Further, the memory 401 may also include both an internal storage unit of the terminal 4 and an external storage device. The memory 401 is used to store the computer program 402 and other programs and data required by the terminal 4 . The memory 401 can also be used to temporarily store data that has been output or will be output.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施方式中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施方式中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the implementation manner may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the above system, reference may be made to the corresponding process in the foregoing method implementation manners, and details are not repeated here.

在上述实施方式中,对各个实施方式的描述都各有侧重,某个实施方式中没有详述或记载的部分,可以参见其它实施方式的相关描述。In the foregoing implementation manners, the descriptions of each implementation manner have their own emphases, and for parts that are not detailed or recorded in a certain implementation manner, refer to the relevant descriptions of other implementation manners.

本领域普通技术人员可以意识到,结合本文中所公开的实施方式描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.

在本发明所提供的实施方式中,应该理解到,所揭露的装置/终端和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端实施方式仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in the present invention, it should be understood that the disclosed device/terminal and method may be implemented in other ways. For example, the device/terminal implementation described above is only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or Components may be combined or integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施方式中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施方式方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法及装置实施方式的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。If the integrated module/unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention realizes all or part of the processes in the methods of the above-mentioned embodiments, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, it can realize the steps of the above-mentioned methods and device implementations. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (Read-Only Memory, ROM) , random access memory (Random Access Memory, RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

以上所述实施方式仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施方式对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施方式所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施方式技术方案的精神和范围,均应包含在本发明的保护范围之内。The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still be applied to the foregoing embodiments Modifications to the technical solutions described in the method, or equivalent replacement of some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should be included in the within the protection scope of the present invention.

Claims (10)

1. A method for archiving documents, comprising:
acquiring a bill image, wherein the bill image comprises a plurality of image blocks, and each image block comprises an image of a bill;
identifying the bill image to obtain a plurality of character sets, wherein the character sets correspond to the bills and comprise the bill face characters of the bills;
acquiring a plurality of word collections according to a word bank and the character collections, wherein the word collections correspond to the notes and comprise a plurality of words representing the face characters of the notes;
and filling the plurality of word collections into a plurality of item tables according to the relevance between the bills and the business processes, wherein the business processes are relevant to the plurality of item tables.
2. The document filing method according to claim 1, wherein before said recognizing the document image and obtaining the plurality of character sets, comprising:
decolorizing the bill image to obtain a gray image;
adjusting the resolution of the gray image to obtain an image with a preset resolution, wherein the adjustment of the resolution comprises at least one of the following steps: compressing, clipping, and expanding pixels by difference;
adjusting a plurality of pixels of the gray-scale image so that the plurality of pixels of the gray-scale image are distributed in a preset interval, wherein the preset interval represents an interval of the integral gray scale of the gray-scale image;
and adjusting the gray curve of a plurality of pixels of the gray image to accord with preset gray distribution.
3. The bill filing method according to claim 2, wherein the adjusting the plurality of pixels of the grayscale image so that the plurality of pixels of the grayscale image are distributed in a preset interval comprises:
acquiring a plurality of gray values corresponding to a plurality of pixels in the gray image;
gray value adjustment: adjusting the plurality of gray values according to a first formula, wherein the first formula is as follows:
Figure FDA0003859897480000011
in the formula, p id Adjusted gray value, p, for the ith interval in a gray image io For the gray value before the i-th interval adjustment in the gray image, p min For the minimum value before the spatial adjustment in the grayscale image, o max The maximum value before the interval adjustment in the gray-scale image is shown, wherein a is the maximum value of the preset interval, and b is the minimum value of the preset interval.
4. The document filing method according to claim 3, wherein the adjusting the gray curve of the plurality of pixels of the gray image to conform to a preset gray distribution comprises:
acquiring a plurality of gray values corresponding to a plurality of pixels in the gray image;
sorting the plurality of gray values according to the size of the values, and dividing the gray values into a plurality of gray sets according to preset intervals of a plurality of values;
counting the number of gray values in a plurality of gray level sets to obtain a gray level interval sequence, wherein each element in the gray level interval sequence represents the number of gray values in an interval of corresponding values;
if the deviation between the gray value interval sequence and the sample sequence is greater than a threshold value, adjusting the plurality of gray values according to the deviation between the gray value interval sequence and the sample sequence through a second formula, and skipping to the gray value adjusting step, wherein the sample sequence represents the number of gray values in an interval of corresponding values of a gray map sample, and the second formula is as follows:
Figure FDA0003859897480000021
in the formula, p ic Adjusted gray value, p, for the ith curve in the gray image id The gray value before the ith curve in the gray image is adjusted, c is a concave-convex coefficient, d is a position coefficient, and b is the minimum value of a preset interval.
5. The document archiving method according to claim 1, wherein said recognizing the document image to obtain a plurality of text sets comprises:
extracting a plurality of image blocks according to the bill images, wherein the plurality of image blocks correspond to the plurality of bills;
respectively sending the image blocks into a character recognition model, and acquiring a plurality of character sets corresponding to the image blocks, wherein the character recognition model is obtained by training a plurality of training samples based on an initial model constructed by a CNN neural network model;
wherein, the extracting a plurality of image blocks according to the bill image comprises:
respectively executing the following steps from the horizontal direction and the vertical direction for the bill image respectively:
acquiring a scanning set, wherein the scanning set is an empty set;
a value taking step: acquiring a plurality of pixel values of one row or one column from the starting position of the bill image through the scanning set;
calculating the sum of each element in the scanning set as a scanning sum;
if the scanning sum is smaller than the threshold value, marking the row or column where the scanning set is located as blank;
if the scanning set does not reach the tail end position of the bill image, moving the position of the scanning set in the bill image according to a preset moving distance, and skipping to the value taking step;
counting rows or columns of continuous blanks, and taking the rows or columns of the continuous blanks exceeding a threshold value as cutting lines;
and cutting the bill image according to the plurality of cutting lines to obtain a plurality of image blocks.
6. The document filing method according to any one of claims 1 to 5, wherein said obtaining a plurality of vocabulary sets from a lexicon and said plurality of character sets comprises:
for each set of words the following steps are performed:
acquiring an undetermined index and a word set, wherein the undetermined index is a null index, and the word set is a null word set;
selecting a character from the starting position of the character set as a word to be determined;
a searching step: searching the word to be determined from the word bank;
if the word bank comprises the undetermined word, taking the acquired index of the undetermined word as an undetermined index, selecting a word behind the undetermined word, adding the word into the undetermined word, and jumping to the searching step;
if the word bank does not contain the undetermined word and the undetermined index is a null index, selecting a word behind the undetermined word, adding the word into the undetermined word, and jumping to the searching step;
if the word bank does not contain the undetermined word and the undetermined index is a non-empty index, adding the undetermined index into the word set, setting the undetermined index as an empty index, and if the undetermined word does not reach the tail end of the word set, selecting a word behind the undetermined word as the undetermined word and jumping to the searching step.
7. The method of claim 6, wherein populating the plurality of vocabulary entries into a plurality of item tables based on the association of the ticket with the business process comprises:
acquiring a service flow and a plurality of item tables related to the service flow, wherein the service flow is associated with the plurality of tickets;
for each item table, the following steps are performed:
extracting a list item and an item to be filled, wherein the item to be filled fills a vocabulary according to the list item;
according to the list item, finding the index of the list item from the word stock;
and finding out the vocabulary with the minimum index difference value with the list item from the vocabulary set, and filling the filling item corresponding to the list item, wherein the vocabularies corresponding to the vocabulary set are arranged adjacently.
8. A bill filing apparatus for realizing the bill filing method according to any one of claims 1 to 7, the bill filing apparatus comprising:
the image acquisition module is used for acquiring a bill image, wherein the bill image comprises a plurality of image blocks, and each image block comprises an image of a bill;
the character recognition module is used for recognizing the bill images to obtain a plurality of character sets, wherein the character sets correspond to the bills, and the character sets comprise the bill face characters of the bills;
the word segmentation module is used for acquiring a plurality of word collections according to a word bank and the character collections, wherein the word collections correspond to the bills, and comprise a plurality of vocabularies representing the characters on the bill surfaces;
and the number of the first and second groups,
and the table filling module is used for filling the plurality of word collections into a plurality of project tables according to the relevance between the bills and the business process, wherein the business process is relevant to the plurality of project tables.
9. A terminal comprising a memory and a processor, the memory having stored therein a computer program operable on the processor, wherein the processor, when executing the computer program, performs the steps of the method according to any of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202211169933.4A 2022-09-22 2022-09-22 Bill filing method, device, terminal and storage medium Pending CN115661839A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211169933.4A CN115661839A (en) 2022-09-22 2022-09-22 Bill filing method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211169933.4A CN115661839A (en) 2022-09-22 2022-09-22 Bill filing method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN115661839A true CN115661839A (en) 2023-01-31

Family

ID=84985383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211169933.4A Pending CN115661839A (en) 2022-09-22 2022-09-22 Bill filing method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115661839A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116778513A (en) * 2023-08-24 2023-09-19 国网山西省电力公司太原供电公司 Intelligent archiving control method for bills in power industry

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116778513A (en) * 2023-08-24 2023-09-19 国网山西省电力公司太原供电公司 Intelligent archiving control method for bills in power industry
CN116778513B (en) * 2023-08-24 2023-10-27 国网山西省电力公司太原供电公司 Intelligent archiving control method for bills in power industry

Similar Documents

Publication Publication Date Title
US11580763B2 (en) Representative document hierarchy generation
CN110399798B (en) Discrete picture file information extraction system and method based on deep learning
CN112508011A (en) OCR (optical character recognition) method and device based on neural network
US7801358B2 (en) Methods and systems for analyzing data in media material having layout
US8321357B2 (en) Method and system for extraction
Wilkinson et al. Neural Ctrl-F: segmentation-free query-by-string word spotting in handwritten manuscript collections
CN112800848A (en) Structured extraction method, device and equipment of information after bill identification
EP4138050A1 (en) Table generating method and apparatus, electronic device, storage medium and product
CN110738238B (en) Classification positioning method and device for certificate information
CN103995904A (en) Recognition system for image file electronic data
CN113033269B (en) Data processing method and device
Konidaris et al. A segmentation-free word spotting method for historical printed documents
CN112560849A (en) Neural network algorithm-based grammar segmentation method and system
CN113901933B (en) Electronic invoice information extraction method, device and equipment based on artificial intelligence
CN113435449A (en) OCR image character recognition and paragraph output method based on deep learning
CN111241955B (en) Bill information extraction method and system
CN115661839A (en) Bill filing method, device, terminal and storage medium
CN118522019B (en) Text recognition method, electronic device and storage medium
CN104899551B (en) A kind of form image sorting technique
JP7430219B2 (en) Document information structuring device, document information structuring method and program
CN116030469A (en) Processing method, processing device, processing equipment and computer readable storage medium
CN118569206A (en) Document analysis method and device and electronic equipment
Boiangiu et al. Efficient solutions for ocr text remote correction in content conversion systems
CN118585573B (en) A structured processing method for layout files
CN113537225B (en) Method for character recognition, electronic device, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination