Seal verification method, electronic equipment, storage medium and product

By automatically aligning seals and network comparison of depth measurement, the problems of low efficiency and low accuracy caused by manual verification in the prior art are solved, and efficient and accurate seal verification are achieved.

CN119672367APending Publication Date: 2025-03-21CHINA MERCHANTS BANK
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411561047.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, seal verification relies on manual corners, which leads to high labor consumption, high time cost and the effect depends on the experience and sense of responsibility of practitioners, resulting in instability and uncertainty of verification results.

Method used

By determining the seal to be verified and the target reserved seal, aligning it and inputting it into the preset depth measurement network, calculating the difference between the seals, and determining the authenticity of the seal based on the preset similarity threshold.

Benefits of technology

Automatic seal alignment and comparison is realized, which improves the efficiency and accuracy of seal verification, reduces the misjudgment rate and manual intervention, and reduces time costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119672367A_ABST
    Figure CN119672367A_ABST
Patent Text Reader

Abstract

The invention discloses a seal verification method, an electronic device, a storage medium and a product, and relates to the technical field of image recognition, and the method comprises the steps: determining a to-be-verified seal and a target reserved seal corresponding to the to-be-verified seal; aligning the to-be-verified seal with the target reserved seal, and inputting the aligned target reserved seal and the to-be-verified seal into a preset depth measurement network to determine the difference between the target reserved seal and the to-be-verified seal; and when the difference is smaller than a preset similarity threshold value, determining that the to-be-verified seal is a true seal. The technical problem that the seal verification effect is poor is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a seal verification method, device, electronic device, storage medium and computer program product. Background Art

[0002] In the current seal verification, seals are often verified by manually folding corners, which not only consumes a lot of human resources, but also increases the time cost of business processing. In addition, the effect of manual verification is highly dependent on the experience and responsibility of practitioners, which may lead to instability and uncertainty in the verification results. Therefore, there is a problem of poor seal verification effect in the current seal verification process. Summary of the invention

[0003] The main purpose of this application is to provide a seal verification method, device, electronic device, storage medium and computer program product, aiming to solve the technical problem of poor seal verification effect.

[0004] To achieve the above purpose, the present application proposes a seal verification method, which includes:

[0005] Determine the seal to be verified and the target reserved seal corresponding to the seal to be verified;

[0006] Aligning the seal to be verified with the target reserved seal, and inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified;

[0007] If the difference is less than a preset similarity threshold, the seal to be verified is determined to be a genuine seal.

[0008] In one embodiment, the step of determining the seal to be verified and the target reserved seal corresponding to the seal to be verified includes:

[0009] Performing seal image recognition on the bill to be verified, and matching each candidate seal in the seal database based on any recognized seal image;

[0010] If there is a candidate seal that matches the seal image, red pixels in the seal image are extracted to remove background text in the seal image to obtain the seal to be verified, and the candidate seal that matches is used as the target reserved seal corresponding to the seal to be verified.

[0011] In one embodiment, the step of aligning the seal to be verified with the target reserved seal includes:

[0012] Performing feature point detection on the seal to be verified and the target reserved seal to obtain each first feature point in the seal to be verified and each second feature point in the target reserved seal, and generating a feature descriptor of each feature point, wherein each feature point includes each first feature point and each second feature point;

[0013] Matching the feature descriptors of each first feature point with the feature descriptors of each second feature point to determine a matching point pair, wherein the matching point pair is a first feature point and a second feature point with the same feature descriptor;

[0014] A rotation matrix is ​​generated based on the matching point pair, and a perspective transformation is performed on the target reserved seal according to the rotation matrix, so that the target reserved seal is aligned with the seal to be verified.

[0015] In one embodiment, before the step of inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network, the step further includes:

[0016] Generate a pseudo seal data set for training a deep metric network, wherein the pseudo seal data set includes test seals of different types;

[0017] For any type of test seals in the different types of test seals, randomly select any one of the test seals and record it as an anchor sample, record the test seal of the type corresponding to the anchor sample as a positive sample, and record the remaining types of test seals in the test seals as negative samples, perform data enhancement on the anchor sample, the positive sample and the negative sample, and then input them into the initial depth metric network, and calculate the sample distances between the anchor sample and the positive sample and the negative sample respectively;

[0018] Substituting the sample distance into a preset triplet loss function, calculating the network loss of the initial depth metric network, and updating the network weights in the initial depth metric network based on the network loss;

[0019] After the initial depth metric network reaches a preset training condition, the preset depth metric network is obtained.

[0020] In one embodiment, the step of generating a pseudo seal dataset for training a depth metric network comprises:

[0021] Based on the arrangement and combination of each seal component element in the preset seal database, an initial seal set is generated;

[0022] The initial seal set is simulated, actual seal features are added, and the initial data set after simulation is recorded as a pseudo seal data set, wherein the actual seal features include anti-counterfeiting lines, edge gaps, uneven color distribution, a five-pointed star and horizontal lines on both sides.

[0023] In one embodiment, before the step of inputting the anchor point sample, the positive sample and the negative sample into the initial depth metric network, the step further includes:

[0024] Rotate the anchor point sample, the positive sample and the negative sample by a random angle with a preset probability, and flip the rotated anchor point sample, the positive sample and the negative sample horizontally or vertically to generate an enhanced anchor point sample, an enhanced positive sample and an enhanced negative sample respectively;

[0025] Applying random image transformation to the initial enhanced anchor point sample, the initial enhanced positive sample and the initial enhanced negative sample to generate a new enhanced anchor point sample, a new enhanced positive sample and a new enhanced negative sample;

[0026] The anchor point sample is updated with the new enhanced anchor point sample, the positive sample is updated with the new enhanced positive sample, and the negative sample is updated with the new enhanced negative sample.

[0027] In one embodiment, after the step of aligning the seal to be verified with the target reserved seal, the method further includes:

[0028] Overlapping the seal to be verified with the target reserved seal, marking the overlapping part of the seal to be verified and the target reserved seal, the non-overlapping part of the seal to be verified and the non-overlapping part of the target reserved seal with three colors respectively, to generate a three-color overlapping seal;

[0029] A three-color comparison chart is output, wherein the three-color comparison chart includes the seal to be verified, the target reserved seal and the three-color overlapped seal located on the same horizontal line.

[0030] In addition, to achieve the above purpose, the present application also proposes a seal verification device, which includes:

[0031] A determination module, used for determining a seal to be verified and a target reserved seal corresponding to the seal to be verified;

[0032] An alignment module, used for aligning the seal to be verified with the target reserved seal, and inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified;

[0033] The verification module is used to determine that the seal to be verified is a genuine seal if the difference is less than a preset similarity threshold.

[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the seal verification method described above.

[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the seal verification method described above are implemented.

[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the seal verification method described above.

[0037] The present application provides a seal verification method, which includes: determining a seal to be verified and a target reserved seal corresponding to the seal to be verified; aligning the seal to be verified with the target reserved seal, and inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified; and determining that the seal to be verified is a genuine seal when the difference is less than a preset similarity threshold.

[0038] This application lays the foundation for subsequent comparison operations by accurately identifying and extracting the seal to be verified and the target reserved seal. By aligning the seal to be verified with the target reserved seal, the difference in angle between the seal to be verified and the target reserved seal is eliminated, making them visually closer, thereby improving the accuracy of the comparison. The deep measurement network is used to achieve accurate comparison of the seal, quantitatively evaluate the similarity between the seal to be verified and the target reserved seal, and accurately determine the authenticity of the seal by setting a reasonable similarity threshold. Compared with related solutions that verify seals by manually folding corners, this application significantly improves the efficiency of seal verification, reduces the misjudgment rate and data leakage risk, and reduces manual intervention and time-consuming operations through automated alignment, comparison and judgment operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flowchart of the first embodiment of the seal verification method of this application is provided;

[0042] Figure 2 This is the seal verification flow chart of the seal verification method for this application;

[0043] Figure 3 A schematic diagram of a scenario for removing text background in the seal verification method of this application;

[0044] Figure 4 A schematic diagram of the scenario of alignment and matching of the seal verification method for this application;

[0045] Figure 5 A flow chart of the second embodiment of the seal verification method of this application;

[0046] Figure 6 This is a diagram of the default depth measurement network architecture of the seal verification method for this application;

[0047] Figure 7 This is an example of a fake seal used in the seal verification method for this application;

[0048] Figure 8 This is a three-color diagram of an example of the seal verification method for this application;

[0049] Fig. 9 This is the overall flow chart of the seal verification method for this application;

[0050] Fig.10 This is a schematic diagram of the module structure of the seal verification device in the embodiment of the present application;

[0051] Fig.11 It is a schematic diagram of the device structure of the hardware operating environment involved in the seal verification method in the embodiment of the present application.

[0052] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0054] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0055] The main solution of the embodiment of the present application is: determine the seal to be verified and the target reserved seal corresponding to the seal to be verified; align the seal to be verified with the target reserved seal, and input the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified; when the difference is less than a preset similarity threshold, the seal to be verified is determined to be a genuine seal.

[0056] In this embodiment, for the convenience of description, the seal verification system is used as the execution entity for explanation below.

[0057] Since the existing technology verifies seals by manually folding corners, the verification time is long and labor-intensive, and the verification effect depends on the experience and responsibility of the practitioners, which may lead to low stability and accuracy of the verification results, resulting in poor verification results.

[0058] The present application provides a solution that combines a deep metric network and significantly improves the efficiency of seal verification through automated alignment and comparison operations, reduces manual intervention and time-consuming operations, and at the same time improves the accuracy of seal verification and reduces the misjudgment rate.

[0059] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a seal verification system, etc. The seal verification system is taken as an example to illustrate this embodiment and the following embodiments.

[0060] Based on this, the present application embodiment provides a seal verification method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the seal verification method of this application.

[0061] In this embodiment, the seal verification method includes steps S01 to S03:

[0062] Step S01, determining the seal to be verified and the target reserved seal corresponding to the seal to be verified;

[0063] It should be noted that the system first obtains the bill with seal submitted by the customer to the bank, extracts all the seals in the bill, and then matches the seals pre-reserved by the customer in the bank in the database, compares the detected seal with the pre-reserved seal, removes the text background in the successfully matched seal image, and uses it as the seal to be verified, and records the successfully matched pre-reserved seal as the target reserved seal.

[0064] It can be understood that since the existing scheme manually selects the seal to be verified and the target reserved seal, step S01 is performed to automatically and accurately select the seal to be verified from multiple seals to ensure the accuracy and consistency of the seal to be verified and the target reserved seal, thereby achieving efficient and accurate detection of seals and providing strong support for the subsequent determination of the seal to be verified.

[0065] Step S02, aligning the seal to be verified with the target reserved seal, and inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified;

[0066] It should be noted that the system realizes the alignment of the seal to be verified and the target reserved seal through the methods of key point matching and rotation matrix, ensures the consistency of the seal to be verified and the target reserved seal in position and direction, and inputs the aligned target reserved seal and the seal to be verified into the preset deep measurement network. The preset deep measurement network refers to a neural network model used to calculate the matching similarity between two images. Through the calculation of the deep measurement network, two corresponding embedding vectors are output. The embedding vector is used to convert complex data structures, such as text, images and sounds, into numerical representations that can be understood by machines, and the Euclidean distance between the two vectors is calculated. The Euclidean distance is used to calculate the straight-line distance between two points in Euclidean space, which is used to represent the difference between the target reserved seal and the seal to be verified.

[0067] It can be understood that since the existing scheme verifies the seal based on manual comparison or simple image processing technology, step S02 is performed to accurately align the seal to be verified with the target reserved seal, eliminating the influence of the rotation angle on the seal comparison and improving the accuracy and stability of the comparison. At the same time, the aligned image is input into the preset deep measurement network to further utilize the powerful capabilities of the deep learning algorithm to accurately evaluate the similarity of the seals.

[0068] Step S03: if the difference is less than a preset similarity threshold, the seal to be verified is determined to be authentic.

[0069] It should be noted that the preset similarity threshold is set based on experience or experiments, and is used to determine whether the seal to be verified is a genuine seal. A genuine seal refers to a seal that is highly consistent with the target reserved seal. The similarity difference obtained by the preset depth measurement network in step S02 is compared with the preset similarity threshold. If the similarity difference is less than the preset similarity threshold, the seal to be verified is considered to be a genuine seal; otherwise, the seal to be verified is considered to be a fake seal.

[0070] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 2 , Figure 2A seal verification flow chart is provided to obtain the seal Image intercepted from the bill and the corresponding target reserved seal Anchor, remove the text background in the seal Image to obtain the seal Image' to be verified, and prevent the seal from deforming and misjudgment due to key point matching errors during alignment. Then, the matching relationship of each key point between the seal Image' to be verified and the target reserved seal Anchor is calculated. This relationship can be represented by a rotation matrix, and the target reserved seal Anchor is rotated by the rotation matrix to align it with the seal Image' to be verified to obtain the aligned target Reserved seal Anchor', from the seal Image' to be verified after removing the background, it can be seen that the seal image will lose some key information such as the seal code, so finally the seal Image of the original image and the aligned target reserved seal Anchor' are normalized and input into the trained preset deep measurement network to obtain the output embedding vector, and the Euclidean distance between the two vectors (embedded vector 1 and embedded vector 2) is calculated to represent the similarity difference, and compared with the preset similarity threshold. If the Euclidean distance is less than the preset similarity threshold, the seal is considered to be a real seal, otherwise it is a fake seal.

[0071] It is understandable that since the existing scheme verifies the seal manually and lacks an objective basis for judgment, step S03 is performed. By setting a preset similarity threshold and comparing the difference between the target reserved seal and the seal to be verified with the threshold, an objective judgment of the authenticity of the seal is achieved. When the difference is less than the preset similarity threshold, it is considered that the seal to be verified is highly consistent with the target reserved seal and is determined to be a authentic seal. This judgment basis is not only objective and stable, but can also significantly improve the efficiency and accuracy of seal verification.

[0072] In a feasible implementation manner, in step S01, the step of determining the seal to be verified and the target reserved seal corresponding to the seal to be verified includes steps A01 to A02:

[0073] Step A01, performing seal image recognition on the bill to be verified, and matching each candidate seal in the seal database based on the seal image for any recognized seal image;

[0074] It should be noted that the bill to be verified refers to the bill with seal submitted by the customer to the bank, which is the input data for seal verification. The seal image refers to the seal part detected and extracted from the bill to be verified, which is the object of subsequent comparison and verification. The seal database stores the seal information of all customers reserved in the bank (in the form of candidate seals) for comparison with the seal to be verified. The candidate seal refers to the seal image stored in the seal database that corresponds to the seal reserved by the customer.

[0075] In addition, it should be noted that the yolov5 algorithm is used to scan and analyze the received bills to be verified, and all the seal images on the bills to be verified are identified and extracted. Yolov5 is a deep learning algorithm suitable for target detection tasks. It can accurately identify the position and shape of the seal in a complex background. The ViT (Vision Transformer) algorithm is used to compare each detected seal image with the candidate seals in the seal database one by one. The comparison process includes but is not limited to the steps of image feature extraction, similarity calculation, etc., to determine whether there is a candidate seal that matches the seal image. The ViT algorithm uses a self-attention mechanism to capture the global context information in the image, and uses a multi-layer perceptron for feature extraction and classification.

[0076] Step A02, if there is a candidate seal that matches the seal image, extract the red pixels in the seal image and remove the background text in the seal image to obtain the seal to be verified, and use the candidate seal that matches as the target reserved seal corresponding to the seal to be verified;

[0077] It should be noted that the red pixel refers to the red part of the seal image that represents the seal itself, and is the key feature for extracting the seal image. The background text refers to other text information in the seal image other than the seal itself, such as the text description on the bill, etc. Removing the background text can reduce interference factors in the comparison and verification process. According to the matching result of step A01, for the seal image with consistent matching, the red pixels in the seal image are extracted using image processing technology. Since most seals are red, extracting the red pixels can effectively separate the seal part to achieve the removal of the background text and other non-seal parts, and generate a clearer and purer image, that is, the seal to be verified. The candidate seal that matches the seal image is recorded as the target reserved seal.

[0078] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 3 , Figure 3A schematic diagram of the scene of text background removal is provided. The left side of the arrow is the seal image that matches the candidate seal, and the right side of the arrow is the seal to be verified with the text background removed. Removing the text background is essentially image segmentation, that is, deleting the useless part (i.e., the text in the background) and separating the shape to be retained (i.e., the seal). The existing scheme removes the text background through SAM (Segment Anything Model l, a promptable segmentation system that can accurately segment each object in the image). For geometric shapes such as five-pointed stars, SAM has a significant separation effect, but for seal text, the text in the background will always be extracted together. This is because SAM is suitable for the removal of natural shapes. It pays more attention to the outer contour of the separated object. Although the seal covers the background text, it does not completely replace the background pixels, but superimposes red pixels on the background pixels. For this reason, by taking advantage of the difference in color, the red pixels in the image can be extracted, and the background text can be separated to the greatest extent while retaining the various components of the seal, thereby achieving text background removal.

[0079] In this embodiment, through the automated and intelligent seal detection and matching process, manual intervention and error rates are greatly reduced, and the overall efficiency of seal verification is improved. By removing the text background in the seal image, the seal image is optimized, the complexity and time cost of the comparison process are reduced, and the efficiency of seal verification is further improved.

[0080] In a feasible implementation, in step S02, the step of aligning the seal to be verified with the target reserved seal includes steps A11 to A13:

[0081] Step A11, performing feature point detection on the seal to be verified and the target reserved seal, obtaining each first feature point in the seal to be verified and each second feature point in the target reserved seal, and generating a feature descriptor of each feature point, wherein each feature point includes each first feature point and each second feature point;

[0082] It should be noted that the system uses the AKAZE algorithm to perform feature point detection on the verification seal and the target reserved seal. Feature point detection refers to the identification of points with significant features (such as corner points, edge points, etc.) in the image. The AKAZE algorithm is a feature point detection and description method based on nonlinear scale space. It can effectively extract key feature points in the image under different lighting and viewing angle changes. After the feature point detection of the verification seal and the target reserved seal, the first feature points and the second feature points are generated respectively, and a corresponding feature descriptor is generated for each first feature point and each second feature point. The first feature point and the second feature point refer to local structural points in the image with significant distinction, such as edges, corner points, etc. The feature descriptor is a vector that can characterize the image information around the feature point, which is used for subsequent feature matching.

[0083] Step A12, matching the feature descriptor of each first feature point with the feature descriptor of each second feature point to determine a matching point pair, wherein the matching point pair is a first feature point and a second feature point having the same feature descriptor;

[0084] It should be noted that the feature descriptors of each first feature point in the seal to be verified are matched with the feature descriptors of each second feature point in the target reserved seal. The matching process is achieved by comparing the similarity of the feature descriptors. Feature points with the same feature descriptors are regarded as matching point pairs. In order to improve the matching accuracy, the system also uses approximate matching screening and random consistency algorithm (RANSAC) screening to eliminate mismatched point pairs. Approximate matching screening is used to remove matching point pairs with low similarity, while the RANSAC algorithm can further remove mismatched point pairs caused by noise or mismatching.

[0085] Step A13, generating a rotation matrix based on the matching point pairs, and performing perspective transformation on the target reserved seal according to the rotation matrix, so as to align the target reserved seal with the seal to be verified.

[0086] It should be noted that a rotation matrix is ​​generated based on the matching point pairs. The rotation matrix is ​​a homography matrix, which is used to describe the mapping relationship between the seal to be verified and the target reserved seal. This mapping maintains the collinearity of collinear points, that is, if the three points are collinear on the original plane, they will also remain collinear on the image plane after the homography transformation. According to the rotation matrix, the system performs a perspective transformation on the target reserved seal so that the target reserved seal is completely aligned with the seal to be verified on the image plane. Perspective transformation is an image transformation method that can maintain linearity and parallelism, and can map any quadrilateral area in one image to the corresponding area in another image.

[0087] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 4 , Figure 4 A schematic diagram of the alignment and matching scenario is provided. The target reserved seal and the seal to be verified on the left side of the arrow are matched through key points to determine the correspondence between each other, and are aligned through a rotation matrix. The target reserved seal and the seal to be verified after alignment are on the right side of the arrow.

[0088] In this embodiment, by accurately locating the key feature points in the seal and generating robust feature descriptors, the accuracy and stability of seal verification are significantly improved. Through the matching of feature descriptors and the generation of rotation matrices, the system can accurately calculate the rotation relationship between the seal to be verified and the target reserved seal, providing a basis for subsequent alignment operations. Through perspective transformation, the system can accurately align the target reserved seal with the seal to be verified on the image plane, thereby eliminating the influence of rotation and seal identification process, and significantly improving the accuracy and efficiency of seal verification.

[0089] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 In step S02, before the step of inputting the aligned target reserved seal and the seal to be verified into the preset depth measurement network, steps S11 to S14 are also included:

[0090] Step S11, generating a pseudo seal data set for training a depth metric network, wherein the pseudo seal data set includes different types of test seals;

[0091] It should be noted that during the training process of the preset deep metric network, a pseudo-seal dataset containing multiple types of test seals is generated. The pseudo-seal dataset is a dataset composed of multiple types of test seals, which is used to simulate the seal verification scenario in the real world.

[0092] Step S12, for any type of test seals in different types of test seals, randomly select any one of the test seals and record it as an anchor sample, record the test seal of the type corresponding to the anchor sample as a positive sample, and record the remaining types of test seals in each test seal as negative samples, perform data enhancement on the anchor sample, the positive sample and the negative sample, and then input them into the initial depth metric network, and calculate the sample distances between the anchor sample and the positive sample and the negative sample respectively;

[0093] It should be noted that during the training process, a batch sampling method is used. The training set sampler takes "n_labels" categories, and each category takes "n_instances" instances to form a batch. At this time, the batch size is the product of n_instances and n_labels. The validation set sampler reads sequentially, and the size of each batch is a preset number (for example, 4). For the initial deep metric network, the ViT-Triplet architecture in deep metric learning is used to determine the similarity between the test seal to be verified and the reserved test seal. The ViT-Triplet architecture is a deep learning model specifically for image matching, and its backbone network ViT is fine-tuned for image retrieval tasks. The optimization function uses AdamW, which is an optimization algorithm used to speed up the training speed of the model and improve the performance of the model. The loss function uses a preset triplet loss function (Triplet The triplet loss function guides the neural network learning by defining an anchor sample (Anchor), a positive sample (Positive) and a negative sample (Negative), so that the distance between the anchor sample and the positive sample in the feature space is smaller than the distance between the anchor sample and the negative sample.

[0094] Anchor samples refer to samples to be classified or query samples in the triplet loss function. Positive samples refer to samples that belong to the same class as the anchor samples in the triplet loss function. Negative samples refer to samples that do not belong to the same class as the query seal in the triplet loss function. For any type of test seal in the pseudo-seal dataset, a test seal is randomly selected from it and recorded as an anchor sample. The test seals of the corresponding type are regarded as positive samples, and the test seals of other types are regarded as negative samples. Then, the anchor samples, corresponding positive samples and negative samples are data enhanced and input into the initial deep metric network. Data enhancement transforms existing data without substantially increasing the size of the dataset to generate new data points, thereby increasing the diversity and quantity of data. The sample distance between the reserved test seal and the positive and negative samples is calculated in the initial deep metric network. The initial deep metric network refers to an untrained deep metric network model. Sample distance refers to the distance metric representing the similarity between two seals in the deep metric network.

[0095] Step S13, substituting the sample distance into a preset triplet loss function, calculating the network loss of the initial depth metric network, and updating the network weights in the initial depth metric network based on the network loss;

[0096] It should be noted that the calculated sample distance is substituted into the preset triplet loss function (Triplet loss), and the formula of the triplet loss function is:

[0097] L(q,p,n)=max(0,d(q,p)-d(q,n)+m)

[0098] Among them, q is the reserved test seal, p is the positive sample, which means the seal belongs to the same category or has similar characteristics as the reserved test seal (q), n is the negative sample, which means the seal does not belong to the same category or has similar characteristics as the reserved test seal (q), and m is a preset threshold used to control the distance difference between positive and negative samples. Based on this loss function, the network loss of the initial depth metric network can be calculated, the network loss is back-propagated, the network gradient corresponding to each network weight is calculated, and the optimization function AdamW is used to update the network weight according to the network gradient.

[0099] Step S14, after the initial depth metric network reaches the preset training condition, a preset depth metric network is obtained.

[0100] It should be noted that after the initial depth measurement network reaches the preset training conditions (such as the number of training rounds, network loss convergence, etc.), a fully trained preset depth measurement network is obtained, which can accurately calculate the sample distance between seal images and perform seal verification based on this.

[0101] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 6 , Figure 6 A preset deep metric network architecture diagram is provided. The anchor samples and positive samples are input into the initial deep metric network after data enhancement. After being processed by the initial deep metric network, two corresponding embedding vectors (embedding vector 1 and embedding vector 2) are generated, and the distance between the two embedding vectors is calculated for the subsequent calculation of the triplet loss function.

[0102] In this embodiment, by constructing a pseudo-seal dataset that contains diversity and variability and simulating the seal verification scenario in the real world, a more robust deep metric network is trained, the recognition ability of the deep metric network in complex scenarios is improved, and rich data support is provided for subsequent training. By defining positive samples and negative samples, the objects that the deep metric network needs to distinguish are clarified, and then the distinguishing ability of the deep metric network is evaluated by calculating the sample distance. By minimizing the triplet loss function, the feature representation learned by the deep metric network increases the difference between different types of seals while maintaining the similarity of the same type of seals, thereby improving the seal verification ability of the deep metric network, enabling the deep metric network to more accurately identify the difference between real seals and forged seals, improving the accuracy and efficiency of seal verification, and providing strong support for practical applications.

[0103] In a feasible implementation, in step S11, the step of generating a pseudo-seal data set for training a depth metric network includes steps B01 to B02:

[0104] Step B01, generating an initial seal set by arranging and combining the seal components in the preset seal database;

[0105] It should be noted that the preset seal database contains a database of various basic elements and templates that constitute the seal, which is used to generate the initial seal pattern. The seal component elements refer to the basic units that constitute the seal pattern, such as text, borders, patterns, etc. The initial seal set refers to the preliminary seal pattern set generated by arranging and combining the elements in the preset seal database.

[0106] In addition, it should be noted that the OpenCV and Pillow libraries are used to extract the components of each seal from the preset seal database, and through programming logic, the components of each seal are arranged and combined, including the layout of the text, the selection and arrangement of the borders, the addition location of the pattern elements, etc., thereby generating a variety of possible seal pattern combinations.

[0107] Step B02, simulate the initial seal set, add actual seal features, and record the initial data set after simulation as a fake seal data set, wherein the actual seal features include anti-counterfeiting lines, edge gaps, uneven color distribution, five-pointed stars and horizontal lines on both sides.

[0108] It should be noted that in order to simulate the various features of real seals, a series of simulation processing steps are designed to make the generated seal pattern closer to the appearance and texture of the real seal, including adding anti-counterfeiting lines to the seal pattern, simulating edge wear or notches that may occur during the use of the seal, simulating the color unevenness that may occur in the printing process of the real seal by adjusting the color distribution, adding five-pointed stars and horizontal lines on both sides of the seal pattern, etc. The above simulation processing steps are applied to each seal pattern in the initial seal set to generate a simulated seal pattern with actual seal features. The actual seal features refer to the features that are commonly found in real seals, which are used to enhance the authenticity and complexity of the simulated seal. The simulated seal patterns are combined to form a pseudo-seal data set.

[0109] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 7 , Figure 7An example picture of a fake seal is provided, which shows four common seals: name seal (label 0), oval seal (label 1), square seal (label 2), and round seal (label 3). Taking the seal in label 0 as an example, the left side is a seal that has not been simulated, corresponding to the reserved seal in actual application. The middle and right sides are fake seals that have been simulated (edge ​​gaps, uneven color distribution), corresponding to the seals to be verified in actual application. The seals corresponding to the other labels are similar to those in label 0. You can refer to the above introduction and will not be repeated later.

[0110] In this implementation, by extracting and combining the components of each seal from a preset seal database to generate a variety of initial seal patterns, the time cost of manual design is greatly saved, and the generation efficiency and diversity of seal patterns are significantly improved. Through the simulation processing algorithm based on OpenCV and Pillow library, actual seal features such as anti-counterfeiting lines and edge gaps are intelligently added to the initial seal pattern, and effects such as uneven color distribution are simulated. The seal pattern after simulation processing is visually closer to the real seal, which provides rich training materials for the deep metric learning network, and can better learn the characteristics and change laws of the real seal. It not only improves the accuracy of the deep metric learning network in the seal verification task, but also enhances its generalization ability, thereby effectively improving the efficiency of seal verification.

[0111] In a feasible implementation, in step S12, inputting the anchor samples, positive samples and negative samples into the initial depth metric network further includes steps B11 to B13:

[0112] Step B11, rotating the anchor point samples, positive samples and negative samples by random angles with a preset probability, and flipping the rotated anchor point samples, positive samples and negative samples horizontally or vertically to generate enhanced anchor point samples, enhanced positive samples and enhanced negative samples respectively;

[0113] It should be noted that the anchor samples, positive samples and negative samples are rotated at random angles with a preset probability (for example, 0.5). The rotation angle here is random, covering the full range of 1-359 degrees, to ensure that the seal image has rich morphological changes. The rotated anchor samples, positive samples and negative samples are flipped horizontally or vertically to further increase the diversity of the images. The generated images are recorded as enhanced anchor samples, enhanced positive samples and enhanced negative samples, respectively.

[0114] Step B12, applying random image transformation to the initial enhanced anchor point samples, the initial enhanced positive samples and the initial enhanced negative samples to generate new enhanced anchor point samples, new enhanced positive samples and new enhanced negative samples;

[0115] It should be noted that, based on step B11, random image transformation is further performed on the enhanced anchor point samples, enhanced positive samples and enhanced negative samples. Random image transformation refers to a series of random, reversible operations on the image that do not change the essential content of the image. These operations include but are not limited to rotation, scaling, cropping, color adjustment, etc. Through random image transformation, a large number of different image samples can be generated. Each random image transformation will generate corresponding new enhanced anchor point samples, new enhanced positive samples and new enhanced negative samples, thereby increasing the diversity of the data set.

[0116] Step B13, update the anchor point samples with the new enhanced anchor point samples, update the positive samples with the new enhanced positive samples, and update the negative samples with the new enhanced negative samples.

[0117] It should be noted that the new enhanced anchor samples, new enhanced positive samples and new enhanced negative samples generated in step B11 are used to update the original anchor samples, positive samples and negative samples. In the subsequent training process, the network will use these enhanced samples to calculate the loss and update the weights.

[0118] In this embodiment, by randomly rotating and flipping the anchor point samples, positive samples and negative samples, the diversity of the test data set is increased, so that the model can learn the characteristics of seals in different directions, and the model's adaptability to rotation invariance is improved, so that in practical applications, seal images in various directions can be more accurately verified. By applying random image transformations, a large number of new enhanced anchor point samples, new enhanced positive samples and new enhanced negative samples are generated. These test seals have certain differences in morphology, color, texture, etc., thereby increasing the diversity of the data set. By constructing a set of positive and negative samples containing multiple images with different morphologies, more training samples are provided for the model, which helps to improve the recognition accuracy of the model.

[0119] In a feasible implementation manner, in step S02, after the step of aligning the seal to be verified with the target reserved seal, steps B21 to B22 are also included:

[0120] Step B21, overlapping the seal to be verified with the target reserved seal, marking the overlapping part of the seal to be verified and the target reserved seal, the non-overlapping part of the seal to be verified and the non-overlapping part of the target reserved seal with three colors, and generating a three-color overlapping seal;

[0121] It should be noted that the seal to be verified is aligned with the target reserved seal to ensure that the two are consistent in space and scale. In the aligned image, three different colors are used to mark the overlapping parts and non-overlapping parts. By way of example, green is used to mark the parts where the seal to be verified and the target reserved seal completely overlap, indicating that these areas are consistent in the two seals. Yellow is used to mark the parts that are in the target reserved seal but not in the seal to be verified, indicating that the seal to be verified lacks certain key features (such as anti-counterfeiting patterns, specific characters, etc.). Red is used to mark the parts that are in the seal to be verified but not in the target reserved seal, indicating that the seal to be verified contains additional, unreal features. The three-color marking results are merged into one image, namely the three-color overlapping seal. This image intuitively shows the differences and similarities between the two seals.

[0122] Step B22, outputting a three-color comparison chart, which includes the seal to be verified, the target reserved seal and the three-color overlapped seal located on the same horizontal line to assist manual review.

[0123] It should be noted that the registered target reserved seal, the seal to be verified and the three-color overlapping seal are arranged in horizontal lines to form a three-color comparison chart, which is then output to a display device or printed out to assist auditors in reviewing.

[0124] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 8 , Figure 8 An example three-color image is provided. The left side is the target reserved seal after alignment, the middle is the seal to be verified, and the right side is the three-color overlapped seal after overlap. The green part of the three-color overlapped seal is the overlapped part of the seal to be verified and the target reserved seal, the yellow part is the part where the target reserved seal exists but the seal to be verified does not exist, and the red part is the part where the seal to be verified exists but the target reserved seal does not exist. Figure 8 It can be seen that the target reserved seal has anti-counterfeiting patterns but the seal to be verified does not, and there are problems such as different small codes and fonts, so it can be judged that the seal to be verified is a fake seal.

[0125] In this embodiment, through precise alignment and difference visualization, the difference between the seal to be verified and the target reserved seal can be accurately identified, and the difference between the two seals can be presented in an intuitive way through three-color marking. The three-color comparison chart enables the auditor to quickly locate the difference area and see the differences and similarities between the two seals at a glance, making it easier to make accurate judgments, shortening the audit time and improving verification efficiency.

[0126] For example, to help understand the technical concept or technical principle of this application, please refer to Fig. 9 , Fig. 9An overall flow chart of the seal verification method is provided. The system first obtains the bill to be verified, performs seal detection on the bill to be verified, determines the seal to be verified and the target reserved seal and performs seal registration so that the seal to be verified and the target reserved seal are at the same angle, performs seal authentication on the registered seal to be verified and the target reserved seal to determine whether the seal to be verified is consistent with the target reserved seal. If the verification passes, the seal to be verified is determined to be a genuine seal, otherwise it is a fake seal.

[0127] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the seal verification method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0128] This application also provides a seal verification device, please refer to Fig.10 , the seal verification device includes:

[0129] A determination module 10 is used to determine the seal to be verified and the target reserved seal corresponding to the seal to be verified;

[0130] An alignment module 20 is used to align the seal to be verified with the target reserved seal, and input the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified;

[0131] The verification module 30 is used to determine that the seal to be verified is authentic if the difference is less than a preset similarity threshold.

[0132] Optionally, the determination module 10 is further configured to:

[0133] Perform seal image recognition on the bill to be verified, and for any recognized seal image, match each candidate seal in the seal database based on the seal image;

[0134] If there is a candidate seal that matches the seal image, the red pixels in the seal image are extracted to remove the background text in the seal image to obtain the seal to be verified, and the candidate seal that matches is used as the target reserved seal corresponding to the seal to be verified.

[0135] Optionally, the alignment module 20 is further used for:

[0136] Perform feature point detection on the seal to be verified and the target reserved seal to obtain each first feature point in the seal to be verified and each second feature point in the target reserved seal, and generate a feature descriptor of each feature point, wherein each feature point includes each first feature point and each second feature point;

[0137] Matching the feature descriptor of each first feature point with the feature descriptor of each second feature point to determine a matching point pair, wherein the matching point pair is a first feature point and a second feature point having the same feature descriptor;

[0138] A rotation matrix is ​​generated based on the matching point pairs, and a perspective transformation is performed on the target reserved seal according to the rotation matrix so that the target reserved seal is aligned with the seal to be verified.

[0139] Optionally, the seal verification device further includes a training module 40, and the training module 40 is further used for:

[0140] Generate a pseudo seal data set for training a deep metric network, wherein the pseudo seal data set includes different types of test seals;

[0141] For any type of test seals in different types of test seals, randomly select any test seal in the test seals and record it as an anchor sample, record the test seal of the type corresponding to the anchor sample as a positive sample, and record the remaining types of test seals in each test seal as negative samples. After data enhancement, the anchor sample, positive sample and negative sample are input into the initial deep metric network, and the sample distances between the anchor sample and the positive sample and the negative sample are calculated respectively;

[0142] Substitute the sample distance into the preset triplet loss function, calculate the network loss of the initial depth metric network, and update the network weights in the initial depth metric network based on the network loss;

[0143] After the initial depth metric network reaches the preset training condition, a preset depth metric network is obtained.

[0144] Optionally, the training module 40 is further configured to:

[0145] Based on the arrangement and combination of each seal component element in the preset seal database, an initial seal set is generated;

[0146] The initial seal set is simulated and actual seal features are added. The initial data set after simulation is recorded as a pseudo seal data set, where the actual seal features include anti-counterfeiting lines, edge gaps, uneven color distribution, five-pointed stars and horizontal lines on both sides.

[0147] Optionally, the training module 40 is further configured to:

[0148] The anchor samples, positive samples and negative samples are rotated at random angles with a preset probability, and the rotated anchor samples, positive samples and negative samples are flipped horizontally or vertically to generate enhanced anchor samples, enhanced positive samples and enhanced negative samples respectively;

[0149] Apply random image transformation to the initial enhanced anchor point samples, the initial enhanced positive samples and the initial enhanced negative samples to generate new enhanced anchor point samples, new enhanced positive samples and new enhanced negative samples;

[0150] Update the anchor samples with new enhanced anchor samples, update the positive samples with new enhanced positive samples, and update the negative samples with new enhanced negative samples.

[0151] Optionally, the seal verification device further includes an output module 50, and the output module 50 is further used for:

[0152] Overlap the seal to be verified and the target reserved seal, and mark the overlapping part of the seal to be verified and the target reserved seal, the non-overlapping part of the seal to be verified and the non-overlapping part of the target reserved seal with three colors respectively, to generate a three-color overlapping seal;

[0153] Output a three-color comparison chart, which includes the seal to be verified, the target reserved seal and the three-color overlapped seal located on the same horizontal line.

[0154] The seal verification device provided by the present application adopts the seal verification method in the above embodiment, which can solve the technical problem of poor seal verification effect. Compared with the prior art, the beneficial effects of the seal verification device provided by the present application are the same as the beneficial effects of the seal verification method provided by the above embodiment, and other technical features in the seal verification device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0155] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the seal verification method in the above-mentioned embodiment one.

[0156] Reference below Fig.11 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, notebook computers, PADs (Portable Application Description: tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0157] like Fig.11As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0158] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0159] The electronic device provided by the present application adopts the seal verification method in the above embodiment, which can solve the technical problem of poor seal verification effect. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the seal verification method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0160] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0161] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0162] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the seal verification method in the above-mentioned embodiment.

[0163] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0164] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0165] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the seal verification device: determines the seal to be verified and the target reserved seal corresponding to the seal to be verified; aligns the seal to be verified with the target reserved seal, and inputs the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified; when the difference is less than a preset similarity threshold, the seal to be verified is determined to be a genuine seal.

[0166] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0167] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0168] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0169] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned seal verification method, and can solve the technical problem of poor seal verification effect. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the seal verification method provided by the above-mentioned embodiment, and will not be repeated here.

[0170] The present application also provides a computer program product, including a computer program, which implements the steps of the seal verification method as described above when the computer program is executed by a processor.

[0171] The computer program product provided by this application can solve the technical problem of poor seal verification effect. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the seal verification method provided by the above embodiment, which will not be repeated here.

[0172] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A seal verification method, characterized in that: The seal verification method comprises: Determine the seal to be verified and the target reserved seal corresponding to the seal to be verified; Aligning the seal to be verified with the target reserved seal, and inputting the aligned target reserved seal and the seal to be verified into a preset depth measurement network to determine the difference between the target reserved seal and the seal to be verified; If the difference is less than a preset similarity threshold, the seal to be verified is determined to be a genuine seal.

2. The seal verification method according to claim 1, characterized in that: The step of determining the seal to be verified and the target reserved seal corresponding to the seal to be verified comprises: Performing seal image recognition on the bill to be verified, and matching each candidate seal in the seal database based on any recognized seal image; If there is a candidate seal that matches the seal image, red pixels in the seal image are extracted to remove background text in the seal image to obtain the seal to be verified, and the candidate seal that matches is used as the target reserved seal corresponding to the seal to be verified.

3. The seal verification method according to claim 1, characterized in that: The step of aligning the seal to be verified with the target reserved seal comprises: Performing feature point detection on the seal to be verified and the target reserved seal to obtain each first feature point in the seal to be verified and each second feature point in the target reserved seal, and generating a feature descriptor of each feature point, wherein each feature point includes each first feature point and each second feature point; Matching the feature descriptors of each first feature point with the feature descriptors of each second feature point to determine a matching point pair, wherein the matching point pair is a first feature point and a second feature point with the same feature descriptor; A rotation matrix is ​​generated based on the matching point pair, and a perspective transformation is performed on the target reserved seal according to the rotation matrix, so that the target reserved seal is aligned with the seal to be verified.

4. The seal verification method according to claim 1, characterized in that: Before the step of inputting the aligned target reserved seal and the seal to be verified into the preset depth measurement network, the step further includes: Generate a pseudo seal data set for training a deep metric network, wherein the pseudo seal data set includes test seals of different types; For any type of test seals in the different types of test seals, randomly select any one of the test seals and record it as an anchor sample, record the test seal of the type corresponding to the anchor sample as a positive sample, and record the remaining types of test seals in the test seals as negative samples, perform data enhancement on the anchor sample, the positive sample and the negative sample, and then input them into the initial depth metric network, and calculate the sample distances between the anchor sample and the positive sample and the negative sample respectively; Substituting the sample distance into a preset triplet loss function, calculating the network loss of the initial depth metric network, and updating the network weights in the initial depth metric network based on the network loss; After the initial depth metric network reaches a preset training condition, the preset depth metric network is obtained.

5. The seal verification method according to claim 4, characterized in that: The step of generating a pseudo seal data set for training a deep metric network comprises: Based on the arrangement and combination of each seal component element in the preset seal database, an initial seal set is generated; The initial seal set is simulated, actual seal features are added, and the initial data set after simulation is recorded as a pseudo seal data set, wherein the actual seal features include anti-counterfeiting lines, edge gaps, uneven color distribution, a five-pointed star and horizontal lines on both sides.

6. The seal verification method according to claim 4, characterized in that: The step of performing data enhancement on the anchor point samples, the positive samples and the negative samples comprises: Rotate the anchor point sample, the positive sample and the negative sample by a random angle with a preset probability, and flip the rotated anchor point sample, the positive sample and the negative sample horizontally or vertically to generate an enhanced anchor point sample, an enhanced positive sample and an enhanced negative sample respectively; Applying random image transformation to the enhanced anchor point samples, the enhanced positive samples and the enhanced negative samples to generate new enhanced anchor point samples, new enhanced positive samples and new enhanced negative samples; The anchor point sample is updated with the new enhanced anchor point sample, the positive sample is updated with the new enhanced positive sample, and the negative sample is updated with the new enhanced negative sample.

7. The seal verification method according to claim 1, characterized in that: After the step of aligning the seal to be verified with the target reserved seal, the following steps are further included: Overlapping the seal to be verified with the target reserved seal, marking the overlapping part of the seal to be verified and the target reserved seal, the non-overlapping part of the seal to be verified and the non-overlapping part of the target reserved seal with three colors respectively, to generate a three-color overlapping seal; A three-color comparison chart is output, wherein the three-color comparison chart includes the seal to be verified, the target reserved seal and the three-color overlapped seal located on the same horizontal line.

8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the seal verification method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the seal verification method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the seal verification method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Pig verification seal detection method

    CN120299048A