Consumption voucher tampering detection method and device, computer equipment and storage medium
Through the area detection model and morphological processing technology, combined with multi-dimensional verification of text position and pixel information, the problem of low detection accuracy of consumer voucher tampering in the existing technology is solved, and higher detection accuracy and lower detection accuracy are achieved. False positive rate.
Patent Information
- Application Number
- CN202411134256.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-20
AI Technical Summary
The existing consumer voucher tamper detection technology has low accuracy when handling financial and insurance businesses, and is particularly difficult to detect slight offsets, font changes or color differences in text, resulting in the inability to accurately identify tampering behavior in images.
The area detection model is used to identify key areas in the consumption voucher, enhance the consistency of the text area through morphological processing, and perform tamper detection from multiple preset verification dimensions based on the position information and pixel information of the text area, including central alignment calibration Verification, text level check and text color check.
It improves the accuracy of consumer voucher tamper detection, reduces the false alarm rate, can effectively deal with interference from image noise and complex backgrounds, and accurately detects tampering behavior.
Smart Images

Figure CN119169637A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a consumption credential tampering detection method, device, computer equipment and storage medium. Background Art
[0002] In industries such as finance and insurance, it is usually necessary to upload relevant consumption vouchers when processing claims and reimbursements. With the popularization of image editing technology, the acts of forging or tampering with vouchers have become more frequent, which poses a challenge to the authenticity verification of related businesses. Now it mainly relies on convolutional neural network (CNN) models to detect PS (Photoshop) traces in images. Although CNN models perform well in image recognition, they have low sensitivity to position and geometric information, and it is difficult to effectively detect features such as slight offsets of text, font changes, or color differences. Therefore, when processing sensitive information including financial bills, insurance documents, etc., this deficiency may lead to the inability to accurately identify tampering in images. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a consumption credential tampering detection method, apparatus, computer equipment and storage medium to solve the problem of low accuracy in consumption credential tampering detection.
[0004] In order to solve the above technical problems, the embodiment of the present application provides a consumption credential tampering detection method, which adopts the following technical solution:
[0005] Obtain the consumption voucher to be tested;
[0006] Input the consumption voucher into a region detection model to obtain key regions in the consumption voucher;
[0007] Performing morphological processing on each of the key regions to obtain a text region of each character in each of the key regions;
[0008] Based on the position information and pixel information of each text area, the consumption voucher is tamper-checked from a preset verification dimension to obtain a tamper-check result.
[0009] In order to solve the above technical problems, the embodiment of the present application also provides a consumption credential tampering detection device, which adopts the following technical solution:
[0010] The voucher acquisition module is used to obtain the consumption voucher to be tested;
[0011] A region detection module, used for inputting the consumption voucher into a region detection model to obtain key regions in the consumption voucher;
[0012] A region identification module, used for performing morphological processing on each key region to obtain a text region of each character in each key region;
[0013] The tampering verification module is used to perform tampering verification on the consumption voucher from a preset verification dimension based on the position information and pixel information of each text area to obtain a tampering verification result.
[0014] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0015] Obtain the consumption voucher to be tested;
[0016] Input the consumption voucher into a region detection model to obtain key regions in the consumption voucher;
[0017] Performing morphological processing on each of the key regions to obtain a text region of each character in each of the key regions;
[0018] Based on the position information and pixel information of each text area, the consumption voucher is tamper-checked from a preset verification dimension to obtain a tamper-check result.
[0019] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0020] Obtain the consumption voucher to be tested;
[0021] Input the consumption voucher into a region detection model to obtain key regions in the consumption voucher;
[0022] Performing morphological processing on each of the key regions to obtain a text region of each character in each of the key regions;
[0023] Based on the position information and pixel information of each text area, the consumption voucher is tamper-checked from a preset verification dimension to obtain a tamper-check result.
[0024] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects: based on the area detection model, the key areas in the consumption voucher are efficiently identified and classified; then, morphological processing is performed on each key area to enhance the coherence of the text area, accurately extract the text area of each text, and effectively deal with the interference of image noise and complex background; according to the position information and pixel information of each text area, the tampering traces in the consumption voucher are carefully detected from multiple preset verification dimensions, which can accurately detect tampering behavior, reduce the false alarm rate, and improve the accuracy of consumption voucher tampering detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0027] Figure 2 is a flow chart of an embodiment of a consumption credential tampering detection method according to the present application;
[0028] Figure 3 is a structural schematic diagram of an embodiment of a consumption credential tampering detection device according to the present application;
[0029] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0033] like Figure 1As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0034] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0035] The terminal devices 101, 102, and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0036] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0037] It should be noted that the consumption credential tampering detection method provided in the embodiment of the present application is generally executed by a server, and accordingly, the consumption credential tampering detection device is generally set in the server.
[0038] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0039] Continue to refer Figure 2 , shows a flow chart of an embodiment of a consumption credential tampering detection method according to the present application. The consumption credential tampering detection method comprises the following steps:
[0040] Step S201, obtaining the consumption voucher to be tested.
[0041] In this embodiment, the electronic device (eg, Figure 1The server shown in the figure) can communicate with the terminal device through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, Wi-Fi connection, Bluetooth connection, Wi MAX connection, Zigbee connection, UWB (ultra wi deband) connection, and other wireless connection methods currently known or to be developed in the future.
[0042] Specifically, a consumption voucher to be detected is received. The consumption voucher can be an image file, including various forms of financial vouchers, such as invoices, receipts, reimbursement documents, etc. These images are usually obtained by scanning or taking pictures and input into the system. The consumption voucher can also be a screenshot file.
[0043] Step S202: input the consumption voucher into the area detection model to obtain the key areas in the consumption voucher.
[0044] Specifically, the consumption voucher is input into a pre-trained region detection model. The model can be built based on a convolutional neural network, which can identify and classify various key regions in the consumption voucher. The model output is an image with these regions labeled, where each region is identified by a bounding box.
[0045] In one embodiment, the key areas include a title area, an amount area, and a consumption information area. The title area is usually located above or in a prominent position on the consumption voucher, and contains basic information about the voucher and a descriptive title, such as the voucher type, merchant name, or company name. The amount area contains the transaction amount recorded in the consumption voucher, such as the total transaction amount, taxes, and other relevant financial data. The consumption information area records detailed consumption items and service content, such as the name and quantity of the goods or services, the unit price and total price, the time and place of consumption, and other detailed transaction information (such as order number, operator).
[0046] Step S203, performing morphological processing on each key area to obtain the text area of each character in each key area.
[0047] Specifically, morphological processing is performed on each key area, including binarization and closing operations, and the bounding rectangle of each character in the key area is extracted, and the bounding rectangle is used as the character area of each character.
[0048] Step S204, based on the position information and pixel information of each text area, the consumption voucher is tamper-checked from a preset verification dimension to obtain a tamper-check result.
[0049] Specifically, the text area has position information and pixel information. The position information is information related to the position of the text area, such as the coordinates of the text area; the pixel information is information related to the pixel display of the text area, such as the pixel value of each pixel in the text area.
[0050] Based on the position information and pixel information of each text area, the consumption voucher is tampered with from multiple preset verification dimensions. These verification dimensions work together to detect PS traces in the image, including whether there are abnormalities in the position and size of the text, and whether there are abnormalities in the text color display, so as to obtain the tampering verification result. The tampering verification result shows whether the consumption voucher has been tampered with.
[0051] In this embodiment, the key areas in the consumption voucher are efficiently identified and classified based on the area detection model; then, morphological processing is performed on each key area to enhance the coherence of the text area, accurately extract the text area of each character, and effectively deal with the interference of image noise and complex background; according to the position information and pixel information of each text area, the tampering traces in the consumption voucher are carefully detected from multiple preset verification dimensions, which can accurately detect tampering behavior, reduce the false alarm rate, and improve the accuracy of consumption voucher tampering detection.
[0052] Furthermore, the above-mentioned step S203 may include: adjusting the consumption voucher marked with each key area to a preset size to obtain a first image; binarizing each key area in the first image to obtain a binarized image of each key area; performing a morphological closing operation on the binarized image of each key area to obtain a closed operation image of each key area; in the closed operation image of each key area, obtaining an external matrix of each connected area to obtain the text area of each text in each key area.
[0053] Specifically, the detected consumption voucher containing key area marks is resized, and the image is adjusted to a preset uniform size (such as a predetermined width and corresponding height) for standardized processing, so that subsequent processing can be performed at a consistent scale, ensuring the reliability and consistency of the detection results.
[0054] Binarization is performed on each key area in the first image. Binarization is to convert an image into an image with only black and white colors, so that the text part is clearly distinguished from the background, which is convenient for subsequent morphological processing. The binary image of each key area can clearly highlight the text area.
[0055] Morphological closing operations are applied to the binary images of each key area. Closing operations include dilation and erosion, which can fill small holes in the text, connect broken parts, and smooth the edges of the text. After the closing operation, the text in each key area becomes more coherent and complete, which is easier to identify and extract.
[0056] In the closed operation image, each connected region is identified and the external matrix of the connected region is obtained. Each external matrix corresponds to a word or a word group. In this way, the system can accurately locate each word area in each key area. The accurate positioning of these word areas provides basic data for subsequent tampering detection.
[0057] In this embodiment, the image size of the consumption voucher is adjusted so that consumption vouchers of different sizes are processed at the same scale, which increases the standardization and accuracy of the detection process; the binarization process simplifies the complex color image into a black and white image, making the text part clearly visible and reducing the interference of background noise; the morphological closing operation enhances the coherence and integrity of the text and repairs the breaks and holes in the text; the extrinsic matrix of each connected area is obtained to accurately locate the text area, providing a data basis for tampering detection and ensuring the accuracy of subsequent tampering detection.
[0058] Furthermore, the above step S204 may include: obtaining preset verification dimensions, the verification dimensions including center alignment verification, text horizontal verification and text color verification; based on the position information of each text area, performing a center alignment verification on the consumption voucher to obtain a verification sub-result; based on the position information of each text area, performing a text horizontal verification on the consumption voucher to obtain a verification sub-result; based on the pixel information of each text area, performing a text color verification on the consumption voucher to obtain a verification sub-result; and generating a tampering verification result of the consumption voucher based on the obtained verification sub-result.
[0059] Specifically, a preset verification dimension is obtained, which defines different verification methods for detecting tampering traces in the consumption voucher. The verification dimension includes center alignment verification, text level verification, and text color verification.
[0060] According to the position information of each text area in each key area, the consumption voucher is centrally aligned and checked to determine the rationality and consistency of the text layout and obtain the check result.
[0061] According to the position information of each text area in each key area, the consumption voucher is verified horizontally to check the horizontal alignment of the text and obtain the verification result.
[0062] According to the pixel information of each text area in each key area, the consumption voucher is verified for text color, and the color characteristics of the text are compared to detect potential tampering and obtain the verification sub-result.
[0063] The sub-results of center alignment check, text level check and text color check are integrated to generate a comprehensive tampering check result. This result indicates whether the consumption voucher has been tampered with, providing a basis for further processing or review.
[0064] In this embodiment, a preset verification dimension is obtained, and the verification dimension defines different verification methods, including center alignment verification, text horizontal verification, and text color verification; these verification methods are combined to comprehensively and accurately identify various tampering methods, reduce the possibility of false alarms and omissions, and ensure the authenticity and integrity of consumption vouchers.
[0065] Furthermore, the above-mentioned step of performing a center alignment check on the consumption voucher based on the position information of each text area to obtain a verification sub-result may include: calculating the center point of each key area according to the text area of each character in each key area; comparing the center point of each key area to perform a center alignment check to obtain a verification sub-result.
[0066] Specifically, the text area of each word in each key area is obtained. These text areas have been accurately located through the previous morphological processing and external matrix analysis. The center point of each key area (such as the title area and the amount area) is calculated. The center point is determined according to the center position of the external rectangle containing all the text areas.
[0067] Compare the center points of each key area to check whether they are aligned. Specifically, compare the horizontal offset of the center point of each key area, such as comparing the horizontal offset of the center point of the title area and the amount area, to determine whether they are within a reasonable range. If the horizontal offset exceeds the preset threshold, there may be tampering. The check sub result is generated by comparison to indicate whether the center of each key area is aligned, and then determine whether the voucher has been tampered with.
[0068] In this embodiment, by calculating and comparing the center points of each key area, anomalies in the overall layout of the consumption voucher can be effectively discovered; the center alignment check ensures the relative position relationship of the key areas, and can detect whether the consumption voucher has been artificially adjusted or tampered with, thereby improving the accuracy of tampering detection.
[0069] Furthermore, the above-mentioned step of performing text level verification on the consumption voucher based on the position information of each text area to obtain a verification sub-result may include: for each key area, calculating the center point of each line of text in the key area according to the text area of each text in the key area; generating a center sequence according to the center point of each line of text, and calculating the variance of the center sequence; comparing the variance with a preset variance threshold to perform text level verification to obtain a verification sub-result.
[0070] Specifically, for each key area, the center point of each line of text is calculated according to the text area of each text in the key area. Here, the center point is calculated by determining the geometric center of each text area in each line.
[0071] Generate a center sequence for the center point of each line of text in row order. This sequence represents the change of the vertical position (i.e., y coordinate) of each line of text. Calculate the variance of this center sequence, which reflects the horizontal consistency of each line of text. If the variance is small, it means that the lines of text are arranged neatly, which conforms to normal printing or writing habits; if the variance is large, it means that the arrangement of each line of text may be abnormal, indicating that the text has been tampered with or rearranged.
[0072] The variance is compared with the preset variance threshold. If the variance exceeds the variance threshold, it means that the text arrangement is abnormal and there may be tampering. The check sub-result is generated based on the comparison result to indicate whether the horizontal arrangement of the text is normal.
[0073] In this embodiment, the text horizontal check can accurately reflect the arrangement of the text by calculating the center point of each line of text and analyzing the variance of these center points; by comparing the variance with the variance threshold, it can identify obviously abnormal text arrangements, which is suitable for detecting tampering by adjusting the text position, thereby improving the accuracy of tampering detection.
[0074] Furthermore, the above-mentioned step of performing text color verification on the consumption voucher based on the pixel information of each text area to obtain a verification sub-result may include: for each key area, calculating the average pixel value of the text area of each text in the key area respectively as the text color of each text; determining the adjacent areas of each text, and calculating the average pixel value of the adjacent areas respectively as the adjacent text color of each text; comparing the text color of each text and the color of its adjacent text to perform text color verification to obtain a verification sub-result.
[0075] Specifically, for each key area, the average pixel value of each text area in the key area is calculated. The average pixel value is obtained by calculating the average pixel value of all pixels in the text area, thereby determining the color feature of each text. In one embodiment, a mask of each text area is obtained, and the pixel values of the pixels involved in the original consumption voucher are extracted according to the mask.
[0076] For each text area, its neighboring area is determined. The neighboring area usually refers to an area within a certain range (such as the same line) adjacent to the current text area. The average pixel value of the neighboring area is calculated as the color of the neighboring text.
[0077] The text color of each word is compared with the color of the adjacent words in its adjacent area. If the color difference is too large (for example, the percentage of color difference is greater than a preset threshold), there may be tampering. Smaller color differences mean that the text color is consistent and conforms to normal printing or writing habits, while larger color differences may indicate that the text has been tampered with or recolored. For example, the color of the tampered text may be different from the original text color, or the text color may be inconsistent due to the use of editing tools. Through this comparison method, anomalies in text color can be detected and a verification sub-result can be generated.
[0078] In this embodiment, the text color verification accurately reflects the color characteristics of the text by calculating the average pixel value of each text area and its adjacent areas; by comparing the text color of each text area with the adjacent text color, obviously abnormal color conditions are identified, which is suitable for detecting behaviors involving tampering with text color, thereby improving the accuracy of tampering detection.
[0079] Furthermore, after the above-mentioned step of obtaining the tampering verification result, it may also include: when it is determined according to the tampering verification result that the consumption voucher has been tampered with, the consumption voucher is returned, or a review instruction is generated according to the consumption voucher and the tampering verification result, so as to manually verify the consumption voucher according to the review instruction.
[0080] Specifically, when the consumption voucher is detected to be tampered with through the tampering verification result, further processing will be performed. The consumption voucher detected to be tampered with can be returned to the submitter or relevant department to prompt resubmission.
[0081] Alternatively, a review instruction is generated based on the consumption voucher and the tampering verification result. The review instruction is sent to a dedicated auditor, who conducts further inspection and confirmation of the consumption voucher based on the instruction to ensure that the consumption voucher determined to be tampered with is reviewed more accurately and comprehensively, which helps reduce the risk of false alarms and omissions.
[0082] In this embodiment, when tampering of the consumption voucher is detected, you can choose to automatically return the voucher or generate a review instruction for manual review, which not only improves the system's automation and response speed, but also enhances the credibility and accuracy of the detection results.
[0083] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned consumption credentials, the above-mentioned consumption credentials can also be stored in a node of a blockchain.
[0084] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0085] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0086] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0087] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0088] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0089] Further references Figure 3 , as a response to the above Figure 2 In order to realize the method shown in the figure, the present application provides an embodiment of a consumption credential tampering detection device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0090] like Figure 3 As shown, the consumption voucher tampering detection device 300 described in this embodiment includes: a voucher acquisition module 301, a region detection module 302, a region identification module 303 and a tampering verification module 304, wherein:
[0091] The voucher acquisition module 301 is used to acquire the consumption voucher to be tested.
[0092] The area detection module 302 is used to input the consumption voucher into the area detection model to obtain the key areas in the consumption voucher.
[0093] The region identification module 303 is used to perform morphological processing on each key region to obtain the text region of each character in each key region.
[0094] The tampering verification module 304 is used to perform tampering verification on the consumption voucher from a preset verification dimension based on the position information and pixel information of each text area to obtain a tampering verification result.
[0095] In this embodiment, the key areas in the consumption voucher are efficiently identified and classified based on the area detection model; then, morphological processing is performed on each key area to enhance the coherence of the text area, accurately extract the text area of each character, and effectively deal with the interference of image noise and complex background; according to the position information and pixel information of each text area, the tampering traces in the consumption voucher are carefully detected from multiple preset verification dimensions, which can accurately detect tampering behavior, reduce the false alarm rate, and improve the accuracy of consumption voucher tampering detection.
[0096] In some optional implementations of this embodiment, the region identification module 303 may include:
[0097] The size adjustment submodule is used to adjust the consumption voucher marked with each key area to a preset size to obtain a first image.
[0098] The binarization processing submodule is used to perform binarization processing on each key area in the first image to obtain a binarized image of each key area.
[0099] The closing operation submodule is used to perform a morphological closing operation on the binary image of each key area to obtain a closing operation image of each key area.
[0100] The matrix acquisition submodule is used to acquire the external matrix of each connected area in the closed operation image of each key area, and obtain the text area of each character in each key area.
[0101] In some optional implementations of this embodiment, the tamper verification module 304 may include:
[0102] The dimension acquisition submodule is used to obtain preset verification dimensions, which include center alignment verification, text horizontal verification, and text color verification.
[0103] The alignment check submodule is used to perform center alignment check on the consumption voucher based on the position information of each text area to obtain a check sub result.
[0104] The horizontal verification submodule is used to perform text horizontal verification on the consumption voucher based on the position information of each text area to obtain a verification submodule result.
[0105] The color verification submodule is used to perform text color verification on the consumption voucher based on the pixel information of each text area to obtain a verification submodule result.
[0106] The result generation submodule is used to generate a tampering verification result of the consumption voucher according to the obtained verification sub-result.
[0107] In some optional implementations of this embodiment, the alignment check submodule may include:
[0108] The center calculation unit is used to calculate the center point of each key area according to the text area of each character in each key area.
[0109] The alignment verification unit is used to compare the center points of each key area to perform center alignment verification and obtain a verification result.
[0110] In some optional implementations of this embodiment, the horizontal check submodule may include:
[0111] The point calculation unit is used to calculate the center point of each line of text in each key area according to the text area of each text in the key area.
[0112] The variance calculation unit is used to generate a center sequence according to the center point of each line of text and calculate the variance of the center sequence.
[0113] The level check unit is used to compare the variance with a preset variance threshold to perform text level check and obtain a check result.
[0114] In some optional implementations of this embodiment, the color check submodule may include:
[0115] The average calculation unit is used to calculate the average pixel value of the text area of each character in each key area as the text color of each character.
[0116] The neighboring calculation unit is used to determine the neighboring area of each character and calculate the average pixel value of the neighboring area as the neighboring character color of each character.
[0117] The color verification unit is used to compare the color of each character with the color of its adjacent characters to perform color verification of the characters and obtain a verification result.
[0118] In some optional implementations of the present embodiment, the consumption voucher tampering detection device 300 may further include: a tampering processing module, which is used to return the consumption voucher when it is determined according to the tampering verification result that the consumption voucher has been tampered with, or to generate a review instruction according to the consumption voucher and the tampering verification result, so as to manually verify the consumption voucher according to the review instruction.
[0119] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0120] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital processors (DSPs), embedded devices, etc.
[0121] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0122] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the consumption voucher tampering detection method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0123] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the consumption credential tampering detection method.
[0124] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0125] The computer device provided in this embodiment can execute the above-mentioned consumption voucher tampering detection method. Here, the consumption voucher tampering detection method can be the consumption voucher tampering detection method of each of the above-mentioned embodiments.
[0126] In this embodiment, the key areas in the consumption voucher are efficiently identified and classified based on the area detection model; then, morphological processing is performed on each key area to enhance the coherence of the text area, accurately extract the text area of each character, and effectively deal with the interference of image noise and complex background; according to the position information and pixel information of each text area, the tampering traces in the consumption voucher are carefully detected from multiple preset verification dimensions, which can accurately detect tampering behavior, reduce the false alarm rate, and improve the accuracy of consumption voucher tampering detection.
[0127] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the consumption credential tampering detection method as described above.
[0128] In this embodiment, the key areas in the consumption voucher are efficiently identified and classified based on the area detection model; then, morphological processing is performed on each key area to enhance the coherence of the text area, accurately extract the text area of each character, and effectively deal with the interference of image noise and complex background; according to the position information and pixel information of each text area, the tampering traces in the consumption voucher are carefully detected from multiple preset verification dimensions, which can accurately detect tampering behavior, reduce the false alarm rate, and improve the accuracy of consumption voucher tampering detection.
[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0130] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A consumption voucher tampering detection method, characterized in that: The steps include: Obtain the consumption voucher to be tested; Input the consumption voucher into a region detection model to obtain key regions in the consumption voucher; Performing morphological processing on each of the key regions to obtain a text region of each character in each of the key regions; Based on the position information and pixel information of each text area, the consumption voucher is tamper-checked from a preset verification dimension to obtain a tamper-check result.
2. The consumption voucher tampering detection method according to claim 1, characterized in that: The step of performing morphological processing on each key area to obtain the text area of each character in each key area comprises: Adjusting the consumption voucher marked with the key areas to a preset size to obtain a first image; Performing binarization processing on each of the key areas in the first image to obtain a binarized image of each of the key areas; Performing a morphological closing operation on the binary images of the key regions to obtain closed operation images of the key regions; In the closed operation images of the key regions, the circumscribed matrix of each connected region is obtained to obtain the text region of each character in the key regions.
3. The consumption voucher tampering detection method according to claim 1, characterized in that: The step of performing tampering verification on the consumption voucher from a preset verification dimension based on the position information and pixel information of each text area to obtain a tampering verification result includes: Obtaining preset verification dimensions, wherein the verification dimensions include center alignment verification, text level verification, and text color verification; Based on the position information of each text area, the consumption voucher is subjected to a center alignment check to obtain a check sub-result; Based on the position information of each text area, the consumption voucher is verified horizontally to obtain a verification sub-result; Based on the pixel information of each text area, the text color of the consumption voucher is verified to obtain a verification sub-result; According to the obtained check sub result, a tampering check result of the consumption voucher is generated.
4. The consumption voucher tampering detection method according to claim 3, characterized in that: The step of performing center alignment verification on the consumption voucher based on the position information of each text area to obtain a verification sub-result comprises: Calculate the center point of each key area according to the character area of each character in each key area; The center points of the key areas are compared to perform a center alignment check to obtain a check result.
5. The consumption voucher tampering detection method according to claim 3, characterized in that: The step of performing text level verification on the consumption voucher based on the position information of each text area to obtain a verification sub-result comprises: For each key area, according to the text area of each text in the key area, calculate the center point of each line of text in the key area; Generate a center sequence according to the center point of each line of text, and calculate the variance of the center sequence; The variance is compared with a preset variance threshold to perform text level verification and obtain a verification result.
6. The consumption voucher tampering detection method according to claim 3, characterized in that: The step of performing text color verification on the consumption voucher based on the pixel information of each text area to obtain a verification sub-result comprises: For each key area, respectively calculating the average pixel value of the text area of each character in the key area as the text color of each character; Determine the neighboring areas of each character, and calculate the average pixel values of the neighboring areas respectively as the neighboring text colors of each character; The text color of each text and the color of its adjacent text are compared to perform text color verification and obtain a verification sub-result.
7. The consumption voucher tampering detection method according to claim 1, characterized in that: After the step of obtaining the tamper verification result, the method further includes: When it is determined according to the tampering verification result that the consumption voucher has been tampered with, the consumption voucher is returned, or a review instruction is generated according to the consumption voucher and the tampering verification result, so as to manually verify the consumption voucher according to the review instruction.
8. A consumption voucher tampering detection device, characterized in that: include: The voucher acquisition module is used to obtain the consumption voucher to be tested; A region detection module, used for inputting the consumption voucher into a region detection model to obtain key regions in the consumption voucher; A region identification module, used for performing morphological processing on each key region to obtain a text region of each character in each key region; The tampering verification module is used to perform tampering verification on the consumption voucher from a preset verification dimension based on the position information and pixel information of each text area to obtain a tampering verification result.
9. A computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the consumption credential tampering detection method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the consumption credential tampering detection method according to any one of claims 1 to 7.
