Image file identification method, device, equipment, medium and product
Through the image file identification method, the trade contract and invoice information are automatically processed and identified, and the cumbersome and inefficient problems of manual maintenance and verification in the existing technology are solved, and work efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411961777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-29
AI Technical Summary
When financial institutions handle legal loan business such as bank notes and trade financing for customers, they need to manually maintain and verify trade contract and invoice information, resulting in large workloads, time-consuming and labor-intensive, and poor accuracy.
An image file recognition method is provided, by receiving the initial image file to be identified, determining its image type, performing preprocessing to obtain target image files in standard file format, extracting character information, and performing semantic recognition to obtain structured information.
This method reduces the cumbersome and errors of manual operation, improves the work efficiency and accuracy of information entry, and realizes the automated processing of image files.
Smart Images

Figure CN119904885A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image file recognition method, device, equipment, medium and product. Background Art
[0002] When financial institutions handle legal loan services such as bank bills and trade financing for their customers, in order to ensure that the financing is based on a real trade background, they need to collect (or enter) the trade contract and invoice information provided by the customer and verify its authenticity.
[0003] The existing method is usually that after the user submits the silver bill invoice application, the corresponding trade contract and invoice paper materials are handed over to the bank counter. The staff manually maintains the trade contract and invoice information one by one into the credit system. And the paper materials are scanned into image materials and archived. The staff manually verifies the contract information (such as the buyer, seller, amount, date, signature, etc.) and verifies the invoice information (such as verifying the authenticity of the invoice). Taking silver bills as an example, if 100 silver bills are issued, then there are 10 trade contracts and 1,000 invoices. The existing method requires a lot of time and effort to manually complete the system entry and verification of trade contract and invoice information, which is a very large workload. This time-consuming and labor-intensive process not only affects work efficiency, but also has poor accuracy. Summary of the invention
[0004] The present application provides an image file recognition method, device, equipment, medium and product, which provides an automated solution for the links involving image file processing in business processes, reduces the tediousness and errors of manual operations, and improves the work efficiency and accuracy of information entry.
[0005] In a first aspect, the present application provides a method for image file recognition, the method comprising:
[0006] Receiving an initial image file to be identified, and determining the image type of the initial image file;
[0007] When the image type is a non-standard file, preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format;
[0008] Extracting characters from the target image file to obtain corresponding key data sets;
[0009] Semantic recognition is performed on the key data set to obtain structured information corresponding to the initial image file.
[0010] Furthermore, the initial image file is preprocessed to obtain a target image file corresponding to the initial image file in a standard file format, including: detecting a page tilt angle of the initial image file relative to a standard recognition angle; rotating the initial image file to a standard recognition angle based on the page tilt angle; identifying a document homepage in the initial image file at the standard recognition angle, the document homepage being a homepage corresponding to a plurality of sub-files in the initial image file; and when the number of the document homepages is at least two, splitting the initial image file based on the page position of the document homepage in the initial image file to obtain at least two copies of the target image file.
[0011] Furthermore, when the non-standard document is a trade contract, identifying the document front page in the initial image file includes: for any page in the initial image file, identifying whether the content of the page contains cover identification information, and the cover identification information includes at least the contract number and the signatory parties; if the cover identification information is contained, determining that the page is the document front page; traversing each page in the initial image file to obtain the document front page contained in the initial image file.
[0012] Furthermore, the method also includes: when the image type is a standard file, obtaining a standard template corresponding to the standard file; performing semantic recognition on the initial image file based on the standard template to obtain structured information corresponding to the initial image file.
[0013] Furthermore, when the standard document is an invoice, before performing semantic recognition on the initial image file based on the standard template, it also includes: calling the invoice verification interface to perform authenticity verification on the initial image file; when the authenticity verification result is successful, executing semantic recognition on the initial image file based on the standard template.
[0014] Furthermore, before preprocessing the initial image file to obtain the target image file corresponding to the initial image file in the standard file format, it also includes: determining whether the initial image file is in a compressed package format; if so, decompressing the initial image file.
[0015] In a second aspect, the present application provides an image file recognition device, the device comprising:
[0016] A type determination module, used for receiving an initial image file to be identified and determining the image type of the initial image file;
[0017] A file processing module, for preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format when the image type is a non-standard file;
[0018] An information extraction module is used to extract characters from the target image file to obtain a corresponding key data set;
[0019] The file recognition module is used to perform semantic recognition on the key data set to obtain structured information corresponding to the initial image file.
[0020] In a third aspect, the present application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the image file recognition method described in any embodiment of the present application.
[0021] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image file recognition method described in any embodiment of the present application when executed.
[0022] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the image file recognition method described in any embodiment of the present application.
[0023] In order to solve the defects of the prior art in the background technology, the embodiment of the present application provides an image file recognition method, and the execution of this method can bring the following beneficial effects: receiving the initial image file to be recognized and determining the image type of the initial image file; when the image type is a non-standard file, pre-processing the initial image file to obtain the target image file corresponding to the initial image file in the standard file format, which can greatly improve the versatility of the file and the convenience of subsequent processing, so that non-standard files of different formats and specifications can be included in a unified and standardized processing flow. Extract the characters in the target image file to obtain the corresponding key data set; perform semantic recognition on the key data set to convert discrete character information into structured information corresponding to the initial image file with a clear logical structure and semantic connotation. This structured information can be directly integrated and applied by various business systems, providing strong support for decision-making in different business scenarios within the enterprise. The present application provides an automated solution for the links involving image file processing in the business process, reduces the tediousness and errors of manual operations, and improves the work efficiency and accuracy of information entry.
[0024] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium, wherein the computer-readable storage medium may be packaged together with the processor of the image file recognition device, or may be packaged separately from the processor of the image file recognition device, and this application does not limit this.
[0025] The description of the second, third, ..., and fifth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, ..., and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description.
[0027] It is understandable that before using the technical solutions disclosed in the embodiments of this application, the type, scope of use, and usage scenarios of the personal information involved in this application should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 A schematic diagram of a first process of an image file recognition method provided in an embodiment of the present application;
[0030] Figure 2 A second flow chart of an image file recognition method provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of the structure of an image file recognition device provided in an embodiment of the present application;
[0032] Figure 4 It is a block diagram of an electronic device used to implement an image file recognition method according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0034] It should be noted that the terms "first", "second", "target", and "original" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having", and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0035] Figure 1 This is a first flow diagram of an image file recognition method provided in an embodiment of the present application. This embodiment can be applied to scenarios where a financial institution handles financial services for a user and identifies trade documents uploaded on a client. The image file recognition method provided in this embodiment can be executed by an image file recognition device provided in an embodiment of the present application. The device can be implemented in software and / or hardware and integrated in an electronic device that executes the method.
[0036] See also Figure 1 The method of this embodiment includes but is not limited to the following steps:
[0037] S110: receiving an initial image file to be identified, and determining the image type of the initial image file.
[0038] The initial image file may be an image file obtained by scanning or photographing a trade document on the client. A trade document may be a paper document generated when handling financial business for a user. Image types may include non-standard files and standard files; non-standard files may be files that do not use a standard file format, such as a contract; standard files may be files that use a standard file format, such as an invoice. The embodiment of the present application takes a non-standard file as a contract and a standard file as an invoice as an example to explain the image file recognition method of the present application.
[0039] In an embodiment of the present application, when a financial institution uses a digital information processing system to handle financial services for a user, the user scans or takes a photo of the file to be uploaded in the interactive interface (such as a self-service data upload interface) to obtain an initial image file, and then uploads the initial image file to the system. The system needs to build a dedicated image file receiving module and start the monitoring state in the network environment to receive the initial image files to be identified from different data sources. When there is an image file transmission request, the receiving module will establish a stable connection channel according to the data transmission protocol client, and then download and store the image file to a locally specified cache area or a dedicated storage directory.
[0040] Optionally, the image file receiving module may use a plurality of pre-set data transmission protocols, such as the common Hyper Text Transfer Protocol (HTTP), File Transfer Protocol (FTP) or Secret File Transfer Protocol (SFTP).
[0041] After successfully receiving the initial image file, the system will call the built-in intelligent recognition program to determine the image type of the initial image file. In one embodiment, the intelligent recognition program's recognition mechanism for the image type can be based on text content features, using natural language processing technology and text matching algorithms to analyze the text content in the initial image file, calculate the frequency and relevance of various specific keywords, and thereby determine whether the image file is a non-standard document (i.e., a contract) or a standard document (i.e., an invoice). For example, a contract image file contains specific key words and terms, such as "Party A", "Party B", "Contract Number", "Liability for Breach of Contract" and other typical contract terms, and an invoice image file contains specific text elements, such as "invoice code", "invoice number", "purchaser name" and other key information related to financial transactions.
[0042] In another embodiment, the recognition mechanism of the image type by the intelligent recognition program can also be based on the layout characteristics, using image analysis technology to accurately measure the size and position relationship of different areas in the image file, identify the font, font size, line spacing and other layout attributes of the text, and further assist in determining whether the image file is a non-standard file or a standard file. For example: a contract image file usually has a relatively standardized page layout format, and its content is often clearly divided according to chapters, clauses, etc. There may be a title bar that clearly marks the name or subject of the contract, and the body part elaborates on the rights and obligations of both parties in the form of clauses, and there may be a reserved signature and seal area. The position of these areas on the page is relatively fixed and has certain layout rules. Invoice image files have a strict tax regulations format, generally the name of the invoice (such as special value-added tax invoice, general value-added tax invoice, etc.) is clearly displayed at the top, followed by the invoice code, invoice number, invoice date, purchaser and seller information, etc. The spacing, font size, alignment, etc. between each information block follow the unified tax standards.
[0043] S120: When the image type is a non-standard file, pre-process the initial image file to obtain a target image file corresponding to the initial image file in a standard file format.
[0044] Specifically, the initial image file is preprocessed to obtain a target image file corresponding to the initial image file in a standard file format, including: detecting a page tilt angle of the initial image file relative to a standard recognition angle; rotating the initial image file to the standard recognition angle based on the page tilt angle; identifying a document homepage in the initial image file at the standard recognition angle, the document homepage being a homepage corresponding to a plurality of sub-files in the initial image file; when the number of document homepages is at least two, splitting the initial image file based on the page position of the document homepage in the initial image file to obtain at least two target image files.
[0045] In the embodiment of the present application, first, a general image edge detection algorithm is used to identify the edge contour of the text area or image body in the image file, and then the angle deviation between these edges and the standard recognition angle (i.e., the preset standard horizontal or vertical direction) is calculated to determine the page tilt angle. Then, based on the tilt angle value calculated by the page tilt angle, the system uses the image rotation algorithm to accurately rotate the image with the center of the image file as the rotation axis. During the rotation process, image pixel processing methods such as bilinear interpolation can be used to ensure that the rotated image can accurately reach the standard recognition angle while maintaining the original text and image clarity. Finally, at the standard recognition angle, the target detection algorithm in the deep learning model is used to identify the document home page in the initial image file. The algorithm has been trained with a large amount of different types of document home page image data, and can accurately identify areas with document home page features, such as specific title formats, unique header designs, or iconic pattern positions. These features become the key basis for identifying the document home page. The model determines which pages belong to the document home page by scanning and feature matching each area in the image file.
[0046] It is worth noting that when there are at least two document homepages, this means that the initial image file contains multiple sub-files. At this time, the system will record the page number position information of each document homepage in detail, and then determine the page range corresponding to each sub-file based on this information. Through image cutting technology, the initial image file is cut along the boundary of the sub-file to obtain an independent target image file. For example, if the initial image file has a total of 10 pages, if there are two document homepages located on page 1 and page 3 respectively, then the initial image file will be split into one target image file from page 1 to page 2, and another target image file from page 3 to page 10, ensuring that each target image file corresponds to a complete sub-file, which provides a convenient file structure foundation for the subsequent separate processing and information extraction of each sub-file, greatly improving the efficiency and accuracy of document image processing.
[0047] Furthermore, when the non-standard document is a trade contract, identifying the document front page in the initial image file includes: for any page in the initial image file, using a general content recognition engine to identify whether the content of the page contains cover identification information, the cover identification information at least includes the contract number and the signing parties; if the cover identification information is contained, then the page is determined to be the document front page. Each page in the initial image file is traversed to obtain the document front page contained in the initial image file.
[0048] Furthermore, before the initial image file is preprocessed to obtain the target image file corresponding to the initial image file in the standard file format, it also includes: reading the first part of the byte data of the initial image file, and determining whether the initial image file is in a compressed package format based on the file header identification information unique to the common compressed package format. If it is in a compressed package format, calling the decompression program to decompress the initial image file. Optionally, during the decompression process, the decompressed file will also be checked for integrity to ensure that no data is lost or damaged during the compression and decompression process.
[0049] S130: Extract characters from the target image file to obtain a corresponding key data set.
[0050] In an embodiment of the present application, the target image file is scanned line by line to effectively separate the text area from the background area in the image. For the text area, the outline, stroke structure and other features of each character are analyzed, and the specific content of each character is determined by matching it with the character library in the pre-trained model. The system will filter out key data sets with critical significance based on pre-set rules and business needs. For example, if the target image file is a contract, then the contract number, signing date, names of both parties, contract amount, core vocabulary in key terms, etc. will be extracted as part of the key data set.
[0051] S140: Perform semantic recognition on the key data set to obtain structured information corresponding to the initial image file.
[0052] In the embodiment of the present application, after the extraction of the key data set is completed, in order to further explore the deep information contained therein and convert it into a more valuable and easy-to-process form, it is necessary to perform a semantic recognition operation on the key data set. The seemingly discrete character information in the key data set is converted into information units with a clear logical structure and semantic connotation. These information units are further integrated and organized to eventually form structured information corresponding to the initial image file.
[0053] For example, structured information presented in a lightweight data exchange format (JavaScript Object Notation, JSON) may contain fields such as "Contract Subject", "Signing Date", "Contract Amount", and "Goods Details", each of which corresponds to specific content derived from semantic analysis of key data sets. Such structured information can be easily read, stored, and processed by other business systems, providing a solid data foundation for many business processes such as contract management, data analysis, and decision support, greatly improving the efficiency and accuracy of information processing, and promoting efficient operation and refined management of the business.
[0054] The technical solution provided in this embodiment receives an initial image file to be identified and determines the image type of the initial image file; when the image type is a non-standard file, the initial image file is pre-processed to obtain a target image file corresponding to the initial image file in a standard file format, which can greatly improve the versatility of the file and the convenience of subsequent processing, so that non-standard files of different formats and specifications can be included in a unified and standardized processing flow. The characters in the target image file are extracted to obtain the corresponding key data set; semantic recognition is performed on the key data set to convert discrete character information into structured information corresponding to the initial image file with a clear logical structure and semantic connotation. This structured information can be directly integrated and applied by various business systems to provide strong support for decision-making in different business scenarios within the enterprise. The present application provides an automated solution for the links involving image file processing in the business process, reduces the tediousness and errors of manual operations, and improves the work efficiency and accuracy of information entry.
[0055] The following further describes the image file recognition method provided by the embodiment of the present application. Figure 2 The second flow chart of an image file recognition method provided in the embodiment of the present application is as follows: the present embodiment is a detailed explanation of the process of recognizing the initial image file when the image type is a standard file.
[0056] See also Figure 2 The method of this embodiment includes but is not limited to the following steps:
[0057] S210: Receive an initial image file to be identified, and determine the image type of the initial image file.
[0058] S220: When the image type is a standard file, obtain a standard template corresponding to the standard file.
[0059] In an embodiment of the present application, after the image type is clearly determined to be a standard file, the system will connect to a database or repository that specifically stores various types of standard file templates. After the connection is successful, the system will perform an accurate search in the repository based on the pre-set standard file type identification code or feature tag. After retrieving a potential matching standard template, the system will further initiate a detailed comparison and verification mechanism. The key structural elements, core clause layout, specific format details, etc. in the image file will be compared one by one with the candidate standard templates. Only when all comparison and verification indicators have reached a high degree of matching, it is finally determined that the template is the standard template corresponding to the standard file.
[0060] In addition, after obtaining the standard template, it will be checked for integrity and version to ensure that the obtained standard template is the latest, complete and correct, so that a series of key operations such as information extraction, format conversion, compliance checking, etc. can be carried out based on this standard template, thereby providing solid guarantees for the efficiency and accuracy of the entire document processing process.
[0061] S230: Call the invoice verification interface to verify the authenticity of the initial image file.
[0062] In the embodiment of the present application, the system will start the invoice verification process, and first call the invoice verification interface. This invoice verification interface is usually a channel connected to the authoritative tax department invoice verification system or a professional third-party invoice verification service platform.
[0063] When calling this interface, the system will first pre-process the initial image file, and use optical character recognition (OCR) technology and general image analysis algorithms to extract key invoice information from the image file. This information may include invoice code, invoice number, invoice date, purchaser taxpayer identification number, seller taxpayer identification number, amount, tax amount, etc. Then, the extracted key invoice information is packaged and sorted according to the parameter format specified by the invoice verification interface, and the data is sent to the invoice verification interface through a secure network transmission protocol. After receiving the data, the invoice verification interface will query and compare it in its corresponding invoice database. After the verification steps, the invoice verification interface will return the verification result to the caller. If the invoice information completely matches the records in the database and complies with all relevant regulations, the interface returns the result of "invoice is true"; otherwise, if there is any information mismatch, data anomaly, or the invoice has been invalidated or reported lost, the interface returns the result of "invoice is false" and can provide detailed error information or abnormal reason explanation.
[0064] S240: When the authenticity verification result is successful, semantic recognition is performed on the initial image file based on the standard template to obtain structured information corresponding to the initial image file.
[0065] In the embodiment of the present application, after the authenticity verification of the invoice is completed and the result is successful, the system will accurately call the standard template corresponding to the invoice type, and through comprehensive semantic recognition and analysis of each column of the invoice, the system will organize and sort the extracted information according to the structured format defined by the standard template. Finally, the structured information corresponding to the initial image file is obtained, for example, presented in JSON format, which contains fields such as "purchaser information", "seller information", "invoice amount", "tax rate", and "tax amount". Each field stores accurate information after semantic recognition and verification. These structured information can be easily received, stored, and further processed by the financial system, tax declaration system, or the business management system of the enterprise, greatly improving the efficiency and accuracy of invoice information processing.
[0066] The technical solution provided in this embodiment receives the initial image file to be identified and determines the image type of the initial image file; when the image type is a standard file, obtains the standard template corresponding to the standard file; calls the invoice verification interface to verify the authenticity of the initial image file; when the authenticity verification result is a successful verification, performs semantic recognition on the initial image file based on the standard template to obtain the structured information corresponding to the initial image file. This structured information can be directly integrated and applied by various business systems to provide strong support for decision-making in different business scenarios within the enterprise. The present application provides an automated solution for the links involving image file processing in the business process, reduces the tediousness and errors of manual operations, and improves the work efficiency and accuracy of information entry.
[0067] Figure 3 A schematic diagram of the structure of an image file recognition device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the device 300 may include:
[0068] The type determination module 310 is used to receive an initial image file to be identified and determine the image type of the initial image file;
[0069] The file processing module 320 is used for preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format when the image type is a non-standard file;
[0070] An information extraction module 330 is used to extract characters from the target image file to obtain a corresponding key data set;
[0071] The file recognition module 340 is used to perform semantic recognition on the key data set to obtain structured information corresponding to the initial image file.
[0072] Furthermore, the above-mentioned file processing module 320 can be specifically used to: detect the page tilt angle of the initial image file relative to the standard recognition angle; rotate the initial image file to the standard recognition angle based on the page tilt angle; identify the document homepage in the initial image file at the standard recognition angle, and the document homepage is the homepage corresponding to multiple sub-files in the initial image file; when the number of the document homepages is at least two, split the initial image file based on the page position of the document homepage in the initial image file to obtain at least two copies of the target image file.
[0073] Furthermore, the file processing module 320 can be specifically used to: when the non-standard document is a trade contract, for any page in the initial image file, identify whether the content of the page contains cover identification information, the cover identification information at least including the contract number and the contracting parties; if the cover identification information is contained, determine that the page is the first page of the document. Traverse each page in the initial image file to obtain the first page of the document contained in the initial image file.
[0074] Furthermore, the above-mentioned image document recognition device may also include: a standard document recognition module;
[0075] The standard file recognition module is used to obtain a standard template corresponding to the standard file when the image type is a standard file; perform semantic recognition on the initial image file based on the standard template to obtain structured information corresponding to the initial image file.
[0076] Furthermore, the above-mentioned standard document recognition module can be specifically used for: when the standard document is an invoice, before performing semantic recognition on the initial image file based on the standard template, calling the invoice verification interface to perform authenticity verification on the initial image file; when the authenticity verification result is a successful verification, executing semantic recognition of the initial image file based on the standard template.
[0077] Furthermore, the file processing module 320 can be specifically used to: determine whether the initial image file is in a compressed package format before preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format; if so, decompress the initial image file.
[0078] The image document recognition device provided in this embodiment can be applied to the image document recognition method provided in any of the above embodiments, and has corresponding functions and beneficial effects.
[0079] Figure 4It is a block diagram of an electronic device for implementing an image file recognition method of an embodiment of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0080] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0081] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0082] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as an image file recognition method.
[0083] In some embodiments, the image file recognition method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the image file recognition method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the image file recognition method in any other appropriate manner (for example, by means of firmware).
[0084] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0085] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0086] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0087] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0088] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server) or a computing system that includes middleware components (e.g., an application server) or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein) or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0089] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0090] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. For example, those skilled in the art can use the various forms of processes shown above to reorder, add, or delete steps; the steps recorded in the present application can be performed in parallel, sequentially, or in different orders, as long as the desired results of the technical solution of the present application can be achieved, and this document does not limit them here.
[0091] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A method for image file recognition, characterized in that: The method comprises: Receiving an initial image file to be identified, and determining the image type of the initial image file; When the image type is a non-standard file, preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format; Extracting characters from the target image file to obtain corresponding key data sets; Semantic recognition is performed on the key data set to obtain structured information corresponding to the initial image file.
2. The image file recognition method according to claim 1, characterized in that: Preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format includes: Detecting the page tilt angle of the initial image file relative to a standard recognition angle; Rotating the initial image file to a standard recognition angle based on the page tilt angle; Under the standard recognition angle, identifying the first page of a document in the initial image file, the first page of the document being the first pages corresponding to the multiple sub-files in the initial image file; When the number of the document first pages is at least two, the initial image file is split based on the page positions of the document first pages in the initial image file to obtain at least two copies of the target image files.
3. The image file recognition method according to claim 2, characterized in that: When the non-standard document is a trade contract, identifying the first page of the document in the initial image file includes: For any page in the initial image file, identifying whether the content of the page contains cover identification information, wherein the cover identification information at least includes a contract number and the contracting parties; If the cover identification information is included, determining that the page is the home page of the document; Each page in the initial image file is traversed to obtain the document homepage contained in the initial image file.
4. The image file recognition method according to claim 1, characterized in that: The method further comprises: When the image type is a standard file, obtaining a standard template corresponding to the standard file; The initial image file is semantically recognized based on the standard template to obtain structured information corresponding to the initial image file.
5. The image file recognition method according to claim 4, characterized in that: When the standard document is an invoice, before semantic recognition is performed on the initial image document based on the standard template, the method further includes: Calling the invoice verification interface to verify the authenticity of the initial image file; When the authenticity verification result is successful, semantic recognition of the initial image file is performed based on the standard template.
6. The image file recognition method according to claim 1, characterized in that: Before preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format, the method further includes: Determine whether the initial image file is in a compressed package format; If so, the initial image file is decompressed.
7. An image file recognition device, characterized in that: The device comprises: A type determination module, used for receiving an initial image file to be identified and determining the image type of the initial image file; A file processing module, for preprocessing the initial image file to obtain a target image file corresponding to the initial image file in a standard file format when the image type is a non-standard file; An information extraction module is used to extract characters from the target image file to obtain a corresponding key data set; The file recognition module is used to perform semantic recognition on the key data set to obtain structured information corresponding to the initial image file.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the image file recognition method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the image file recognition method according to any one of claims 1 to 6 when executed.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the image file recognition method according to any one of claims 1 to 6.