Character-based image difference judgment method and device

By employing a multi-scale feature extraction and fusion mechanism, the robustness problem of traditional methods in character micromorphology recognition is solved, enabling high-precision difference judgment of character images. It adapts to complex environments and has adaptive capabilities, improving the accuracy and stability of authenticity identification.

CN121921801APending Publication Date: 2026-04-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
Filing Date
2026-01-19
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify and quantify the microscopic morphological differences of characters under complex imaging conditions, making it difficult to effectively distinguish between genuine and counterfeit product packaging. Traditional image matching methods are not robust, and conventional OCR focuses only on the semantic content of characters while ignoring visual morphological details.

Method used

A multi-scale feature extraction and fusion mechanism is adopted. Character images are extracted through the character detection module, multi-scale feature vectors are obtained through the feature extraction module, and similarity is calculated with the feature template library. Image differences are judged by combining preset thresholds, and a dynamic feature template library is constructed to adapt to changes in printing process.

Benefits of technology

It achieves high-precision and robust difference judgment of character images, and can accurately identify differences at the micro level such as strokes, edges, and textures in complex environments, thereby improving the accuracy and stability of authenticity identification and possessing adaptability and long-term effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121921801A_ABST
    Figure CN121921801A_ABST
Patent Text Reader

Abstract

The invention discloses a character-based image difference judgment method and device, and relates to the technical field of computer vision. A specific embodiment of the method comprises the steps of extracting a character image of each character from a to-be-detected image containing the characters and identifying a corresponding character category; extracting multi-scale features of the character image corresponding to each character category, and fusing the multi-scale features to obtain feature vectors corresponding to the character categories; calculating the similarity between each feature vector and a corresponding reference feature vector in a feature template library; and according to a comparison result of the similarity and a preset threshold value, judging whether the character and the corresponding reference character have a difference, and based on the difference between the character and the corresponding reference character, judging the difference between the to-be-detected image containing the character and the reference image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method and apparatus for character-based image difference judgment. Background Technology

[0002] In the fields of computer vision and image analysis, identifying differences in images containing characters is a challenging task. In some scenarios, it's not only necessary to accurately identify the semantic content of characters in an image, but more importantly, to precisely quantify and compare their visual morphological features. This ability to discern fine-grained differences in characters' microscopic shape, texture, and edge characteristics is a core requirement for many high-precision visual inspection applications, such as document authentication, anti-counterfeiting of high-value product packaging, and quality inspection of industrial printed materials.

[0003] As a concrete example, with the continuous rise in the market value of high-end consumer goods, counterfeiting techniques for some product packaging are becoming increasingly sophisticated. Counterfeit packaging often uses highly realistic font printing, closely resembling genuine products in overall appearance, text content, and conventional anti-counterfeiting labels, making it difficult to distinguish with the naked eye. To combat counterfeiting, the industry commonly employs anti-counterfeiting methods such as anti-counterfeiting code verification, QR code traceability, and laser engraving. However, with the upgrading of counterfeiting technology, counterfeiters are now able to partially replicate QR codes, blur inkjet printing, or tamper with printing batch information, thereby circumventing verification methods based on traditional labels, leading to a gradual decrease in the effectiveness of existing anti-counterfeiting measures.

[0004] Currently, the determination of differences in images containing characters mainly relies on two types of technical solutions: The first is traditional image matching algorithms, which locate and compare character regions through key point detection and description. However, these methods depend on manually designed features and are poorly robust to interference factors such as subtle deformations caused by differences in printing processes, uneven lighting, and image noise, making it difficult to reliably capture the differences in the microscopic morphology of characters. The second is conventional optical character recognition (OCR) technology, whose design goal is primarily to accurately extract the text content of characters, without focusing on the visual morphological details of the characters. Therefore, even if counterfeit fonts have quantifiable differences from genuine fonts at the microscopic level, such as stroke edges, line width, ink density, and dot matrix distribution, conventional OCR systems cannot effectively measure and distinguish these printing process features, thus failing to achieve authenticity determination based on font morphology.

[0005] Therefore, there is an urgent need for a method that can integrate character semantic information and morphological features to achieve high-precision and robust image difference judgment of characters, so as to achieve, for example, high-performance authenticity identification, thereby making up for the shortcomings of existing solutions. Summary of the Invention

[0006] In view of this, embodiments of the present invention provide a character-based image difference judgment method and apparatus, aiming to solve the problem that existing technologies struggle to simultaneously consider semantic and font-level feature recognition in image difference judgment involving characters, thus failing to comprehensively and effectively identify image differences. Embodiments of the present invention aim to achieve multi-dimensional feature analysis of images, while providing a character-based image difference judgment strategy to improve the accuracy and completeness of image difference detection involving characters.

[0007] In a first aspect, embodiments of the present invention provide a character-based image difference judgment method, the method comprising: extracting a character image of each character from a test image containing characters and identifying the corresponding character category; extracting multi-scale features of the character image corresponding to each character category and fusing the multi-scale features to obtain a feature vector corresponding to the character category; calculating the similarity between each feature vector and a corresponding reference feature vector in a feature template library; and determining whether there is a difference between the character and the corresponding reference character based on the comparison result of the similarity and a preset threshold, and determining the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character.

[0008] Optionally, extracting a character image of each character from a test image containing characters and identifying the corresponding character category includes: extracting a character region image of each character in the test image and identifying the corresponding character category; and scaling each character region image to a uniform size to obtain a character image of uniform size.

[0009] Optionally, the multi-scale features include feature maps at different levels, each indicating visual information at a different scale, including character texture information, character morphological information, and character semantic information.

[0010] Optionally, determining the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character includes: determining the similarity between the feature vectors of all characters in the test image and the corresponding reference feature vectors in the feature template library; and determining the difference between the test image and the reference image based on whether the proportion of the number of characters with similarity below the preset threshold to the total number of characters exceeds a set threshold.

[0011] Optionally, the feature template library is constructed according to the following operations: extracting a reference character image set for each reference character from the reference image set and identifying the corresponding character category; obtaining a reference feature vector set for the reference character image set corresponding to each character category; and calculating the center vector of the reference feature vector set for each character category, and storing the center vector as the feature template library. Optionally, the method further includes obtaining additional reference feature vectors for reference characters in additional reference images, calculating a new center vector for the corresponding character category based on the additional reference feature vectors and the existing center vectors, and updating the feature template library.

[0012] Secondly, embodiments of the present invention provide a character-based image difference judgment device, the device comprising: a character detection module, the character detection module being used to extract a character image of each character from a test image containing characters and identify the corresponding character category; a feature extraction module, used to extract multi-scale features of the character image corresponding to each character category and fuse the multi-scale features to obtain a feature vector corresponding to the character category; a similarity calculation module, the similarity calculation module being used to calculate the similarity between each feature vector and a corresponding reference feature vector in a feature template library; and a judgment module, the judgment module determining whether there is a difference between the character and the corresponding reference character based on the comparison result of the similarity and a preset threshold, and judging the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character.

[0013] Thirdly, embodiments of the present invention provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the above embodiments.

[0014] Fourthly, embodiments of the present invention provide a computer-readable medium having a computer program stored thereon that, when executed by a processor, implements the methods of any of the above embodiments.

[0015] Fifthly, embodiments of the present invention provide a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the method of any of the above embodiments.

[0016] One embodiment of the above invention has the following advantages or beneficial effects: By introducing multi-scale character feature extraction and a "morphological-texture-semantic" joint feature fusion mechanism, the present invention achieves high-precision discrimination of microscopic differences in character images, such as printed fonts. Simultaneously, embodiments of the present invention provide an image difference judgment strategy based on character differences in images, achieving high-accuracy discrimination of differences in images containing characters.

[0017] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0018] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein: Figure 1 This is an overall architecture diagram of a character-based image difference judgment system provided by an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the process of a character-based image difference judgment method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the process for constructing a feature template library according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a character-based image difference judgment device provided in an embodiment of the present invention; Figure 5 This is an architecture diagram of yet another exemplary system applicable thereto, according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0019] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0020] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of this invention comply with the relevant provisions of national laws and regulations.

[0021] In the fields of computer vision and image analysis, character-based image difference identification is a challenging task. This task requires not only accurately identifying the semantic content of characters (i.e., "what kind of character it is"), but more importantly, precisely quantifying and comparing their visual morphological features (i.e., "what the character looks like"). This ability to discern fine-grained differences in characters' microscopic shape, texture, and edge characteristics is a core requirement for many high-precision visual inspection applications, such as document authentication, anti-counterfeiting of high-value product packaging, and quality inspection of industrial printed materials.

[0022] Taking anti-counterfeiting measures for product packaging as an example, as the market value of high-end consumer goods continues to rise, counterfeiting techniques for some product packaging are becoming increasingly sophisticated. Counterfeit packaging often uses highly realistic font printing, and its overall appearance, text content, and conventional anti-counterfeiting labels are extremely similar to genuine products, making it difficult to effectively distinguish with the naked eye. To combat counterfeiting, the industry commonly uses anti-counterfeiting code queries, QR code traceability, and laser engraving. However, with the upgrading of counterfeiting technology, counterfeiters are now able to partially imitate QR codes, blur inkjet codes, or tamper with printing batch information, thereby circumventing verification methods based on traditional labels, leading to a gradual decrease in the effectiveness of existing anti-counterfeiting measures.

[0023] In vision-based packaging authenticity verification, two main technical solutions are currently relied upon: The first is traditional image matching algorithms, such as SIFT (Scale-Invariant Feature Transform), ORB (Oriented Fast and Rotated BRIEF), and SURF (Speeded-Up Robust Features). These methods locate and compare character regions through keypoint detection and description. However, these methods rely on manually designed features and are less robust to interference factors such as subtle deformations of printed fonts due to manufacturing processes, uneven lighting, and image noise, making it difficult to reliably capture the differences in the microscopic morphology of characters. The second is conventional optical character recognition (OCR) technology, such as open-source or commercial OCR engines like Tesseract, PaddleOCR, and EasyOCR. Their design goal is primarily to accurately extract the text content of characters, without focusing on the visual morphological details of the characters. Therefore, even if counterfeit fonts have quantifiable differences from genuine fonts at the micro level, such as stroke edges, line width, ink density, and dot matrix distribution, conventional OCR systems cannot effectively measure and distinguish these printing process features, thus failing to achieve authenticity determination based on font shape.

[0024] In summary, existing technologies have the following limitations: traditional image matching methods have limited ability to identify font details under complex imaging conditions and are easily affected by counterfeit products; conventional OCR technology only focuses on the semantic content of characters and cannot capture and compare the physical printing features of characters; there is a lack of an integrated model that can simultaneously complete character content recognition and fine-grained character morphology analysis, making it difficult to meet the detection needs of image differences caused by microscopic differences in fonts in images such as highly realistic printed materials.

[0025] Figure 1 This is an overall architecture diagram of a character-based image difference judgment system 100 provided by an embodiment of the present invention.

[0026] like Figure 1 As shown, the character-based image difference judgment system according to an embodiment of the present invention includes an image acquisition and preprocessing module 110, a character detection module 120, a feature extraction and fusion module 130, a similarity measurement module 140, and a judgment result output module 150.

[0027] In one embodiment, the image acquisition and preprocessing module 110 is used to acquire images containing characters to be detected. For example, taking an image containing characters as an image of product packaging, the image acquisition and preprocessing module 110 may include a high-resolution camera for capturing images of the product packaging. The image acquisition and preprocessing module 110 may also include a mobile terminal for capturing images. As a specific example, when the image to be identified is an image on a wine bottle, the acquired image may include image areas containing characters such as "front label," "back label," and "bottle cap coding." The acquisition process may employ automatic white balance and exposure control algorithms to ensure consistent image brightness and color.

[0028] The image acquisition and preprocessing module 110 is also used to preprocess the captured images. Preprocessing steps may include denoising and enhancement. For example, Gaussian filtering and adaptive histogram equalization may be used to enhance contrast. Preprocessing steps may also include geometric correction. For example, Hough transform can be used to detect tilt angles and automatically correct rotation. Preprocessing steps may also include color normalization. For example, color normalization can map the colors of images acquired from different batches and different cameras to a unified color space. Preprocessing may also include other unlisted processing steps to obtain normalized image input, providing a consistent basis for subsequent character detection.

[0029] In one embodiment, the character detection module 120 is used to accurately locate text regions in an image containing characters and extract character ROIs. The character detection module 120 may include a character detection model trained to output the character region coordinates of each character in the image and the character's category. The model may also be trained to output the confidence level of the category label for each character. The character detection module 120 can extract a character image for each character based on the character region coordinates and scale the character image to a uniform size. The character detection module 120 can perform affine transformation correction on the scaled character image to prevent recognition errors caused by angular offsets.

[0030] In one embodiment, the feature extraction and fusion module 130 may include a feature extraction model (or a character feature extraction model) that is trained to extract multi-layer feature maps (i.e., multi-scale feature maps) of a character image and fuse the multi-layer feature maps to output a high-dimensional feature embedding vector of the character image.

[0031] In one embodiment, the similarity measurement module 140 is used to measure the similarity between the feature vector of the character image and the corresponding reference feature vector in the feature template library. In this case, the system 100 may also include a feature template library construction module (not shown). The feature template library construction module is used to construct a feature template library composed of reference feature vectors of the reference character image.

[0032] In one embodiment, the judgment result output module 150 is used to determine whether there is a difference between a character and its corresponding reference character based on the comparison result of the similarity and the preset threshold. Further, based on the difference between the character and its corresponding reference character, the judgment result output module 150 can also determine the difference between the test image containing the character and the reference image, and output the judgment result of the image difference.

[0033] Figure 2 This is a schematic diagram of process 200 of a character-based image difference judgment method provided in an embodiment of the present invention.

[0034] Step 201: Extract the character images and identify the corresponding character categories.

[0035] This step specifically includes extracting a character image for each character from the test image containing characters and identifying the corresponding character category. Before extracting the character images, a step of acquiring the original image may also be included. For example, taking a product packaging image as an example, the original image of the region containing characters on the product packaging can be captured by an image acquisition module (e.g., image acquisition and preprocessing module 110). This original image can then be preprocessed to obtain a normalized image, providing a consistent basis for subsequent character detection. The steps for acquiring the original image and preprocessing are as described in the reference. Figure 1 The details mentioned above will not be repeated here.

[0036] In one embodiment, a character image for each character can be extracted from a preprocessed and normalized image, and the corresponding character category can be identified. This process can be performed via a character detection model. The character detection model can be trained to output a character region image and character category for each character in the input image.

[0037] Specifically, a character detection model can be built that outputs the coordinates, category, and confidence score of character regions containing characters. For example, this model can be built based on the YOLO (You Only Look Once) architecture. The YOLO architecture is a neural network architecture for object detection configured to simultaneously predict the probabilities of multiple bounding boxes and their categories directly from the input image during a single forward propagation. Specifically, the YOLO architecture includes a convolutional neural network as the backbone network, used to extract multi-level feature maps from the input image. This backbone network can be designed or improved based on existing feature extraction architectures, aiming to efficiently generate rich and representative features. The YOLO architecture also includes a feature aggregation module as the neck network, located between the backbone network and the prediction head. It typically employs a feature pyramid structure or path aggregation structure, aiming to fuse feature maps from different depths of the backbone network, thereby combining the high spatial resolution of shallow features with the high semantic information of deep features to improve the detection capability of objects at different scales. A prediction module consisting of one or more convolutional layers directly operates on the fused feature maps. The YOLO architecture also includes a detection head responsible for performing the final bounding box regression, confidence prediction, and category classification tasks.

[0038] In one embodiment, for a character detection model, multiple detection heads can be trained on images containing characters based on the YOLO architecture. For example, taking the aforementioned wine bottle as an example, multiple detection heads can be trained for areas such as the "front label," "back label," and "cap coding." Each detection head can use different anchor box sizes to accommodate differences in font size. As another example, when building a character detection model based on the YOLOv8 architecture, each detection head can use an anchor-free technique to acquire detection boxes to accommodate different font size differences.

[0039] The character detection model is built to output the coordinates (x, y, w, h) of the region containing each character, its category, and its confidence score. For regions with a confidence score below a certain threshold, such as below 0.6, a secondary detection mechanism can be automatically triggered to improve recall.

[0040] The character region can be extracted based on its coordinates and scaled to a uniform size, such as 128×128 pixels, as the ROI (or character image); affine transformation correction can be applied to the ROI to prevent recognition errors caused by angular offset.

[0041] Step 202: Obtain the feature vector of multi-scale feature fusion.

[0042] This step specifically involves extracting multi-scale features from the character image corresponding to each character category and fusing these multi-scale features to obtain a feature vector corresponding to the character category. This step can be performed by a feature extraction model. Specifically, the character image (e.g., the uniform-sized ROI mentioned above) can be input into the feature extraction model to obtain a feature vector corresponding to each character category. The feature extraction model is trained to extract and fuse the multi-scale features of the input character image.

[0043] In one embodiment, the feature extraction model can also be built based on the YOLO architecture. The backbone network of this model can be implemented using a convolutional neural network, for example, using ResNet50 (Residual Network with 50 layers), but this invention is not limited to this. The backbone network of this model can use, for example, CNN-based convolutional neural networks such as VGGNet or the Inception series, or a Transformer-based backbone network to obtain multi-scale features; this invention does not specifically limit this approach.

[0044] As an example, ResNet50 is a model consisting of 50 layers of deep convolutional neural networks used for fast extraction of shallow features and dimensionality reduction. Specifically, multiple feature maps within ResNet50 can be extracted. Low-level features, such as edges, textures, and colors, can be extracted from the front end (shallow layers); mid-level features, such as components and patterns, can be extracted from the middle part (middle layers); and high-level semantic features, such as overall object information and category information, can be extracted from the end end (deep layers). In other words, in embodiments of the present invention, the input to the network can be, for example, a single character image (128×128×3), and the output can be multiple feature maps (e.g., 1 / 4, 1 / 8, 1 / 16, and 1 / 32 downsampling layers). Each feature map focuses on visual information at different scales: the low layer focuses on stroke edge details; the middle layer focuses on stroke combination structure; and the high layer focuses on overall character layout and printing style. Simultaneously, the deepest feature map (1 / 32 resolution) can be flattened into a sequence and embedded with positional encoding, then input into a Transformer encoder to model long-range spatial dependencies between character strokes.

[0045] Furthermore, feature extraction models can fuse multi-layer feature maps. For example, feature maps from different levels can be fused using a Feature Pyramid Network (FPN). The FPN fuses feature maps from different levels through a top-down path and lateral connections, constructing a multi-scale feature representation that combines high semantic information with precise spatial details. Specifically, the FPN first gradually expands the spatial size of deep, highly semantic features along a top-down path using upsampling (such as nearest neighbor interpolation) to align them with the size of shallower feature maps. Subsequently, through lateral connections, the upsampled deep features are fused element-wise with the shallow features from the corresponding layers of the backbone network. This ultimately generates a series of fused feature maps with decreasing spatial resolution but continuously enhanced semantic information. These fused feature layers can leverage the rich semantics of deep features to enhance recognition capabilities while retaining the precise localization information of shallow features, thus significantly improving the model's performance when processing multi-scale targets.

[0046] In one embodiment, the feature extraction model may also employ other architectures to integrate deep semantics with shallow details, such as PANet (Path Aggregation Network) which can provide higher accuracy, BiFPN (Weighted Bi-directional Feature Pyramid Network) which focuses on efficiency, and ASFF (Adaptively Spatial Feature Fusion), etc., which are not limited in this invention.

[0047] In one embodiment, a channel attention module (SE block) can be introduced to automatically enhance the response of key areas such as stroke endpoints and turning points; a spatial attention module (SAM) can be used to suppress background interference, thereby achieving feature enhancement.

[0048] Subsequently, the fused feature map can be input into a fully connected layer to obtain a high-dimensional feature embedding vector. For example, in this embodiment, a 128-dimensional feature embedding vector can be obtained. All character samples are mapped to the same high-dimensional feature space at this stage.

[0049] Step 203: Calculate the similarity between the feature vector and the reference feature vector.

[0050] Based on the feature vector of the character image obtained in step 202, the similarity with the corresponding reference feature vector in the feature template library can be calculated.

[0051] The process of building a feature template library (300 steps) Figure 3As shown. The feature template library can be constructed based on a set of reference images. For example, reference image 310 can be an image of the character area of ​​a known genuine product. Taking the aforementioned wine bottle packaging as an example, the reference image can include images of areas such as the "front label," "back label," and "cap coding" of a known genuine wine bottle. Specifically, original reference images can be acquired and preprocessed. The preprocessing steps are as described in the reference... Figure 1 The preprocessed reference image can be input into a character detection model for character detection 302 to obtain the character region image and character category for each character. The character detection model can be constructed based on a model similar to that described in step 201. The obtained character image is input into a feature extraction model for feature extraction 303 to obtain a reference feature vector 304 for each character category. Here, the feature extraction model can be constructed based on a model similar to that described in step 202. A set of reference images including batch reference images can be input into the above two models to obtain a set of reference feature vectors corresponding to the character category. For the set of reference feature vectors of the same character category, its feature center vector 305 is calculated, which represents the average feature distribution of the genuine product of that category in the embedding space.

[0052] As an example, a preprocessed sample of genuine character images (reference image) can be used to obtain a normalized high-dimensional feature vector through a deep feature extraction network (e.g., a feature extraction model): [Equation 1] in, Indicates sample High-dimensional feature vectors, network This refers to the feature extraction model described in step 202, used to extract character stroke texture, geometric structure, and overall morphological information. For a set of genuine character samples of the same category, the system calculates their feature center vectors: [Equation 2] in, c For the current character category, N c It is a category c The number of samples. The categories can be calculated using Equation 2. c Average eigenvector μ c This is the center vector. Here, the center vector represents the average feature distribution of genuine products in this category within the embedding space.

[0053] The center vector can also be obtained through methods other than averaging vectors. For example, it can be obtained through weighted average, median, or K-means, and this invention does not limit this method.

[0054] The center vectors obtained for each character category can be stored in a database to form a searchable feature template library 306.

[0055] In one embodiment, the constructed feature template library can be dynamically updated. This is possible when new high-confidence genuine product samples are collected. z new At that time, the center vector can be dynamically updated using, for example, an exponentially weighted average: [Equation 3] Where γ is the update rate. Norm(.) This indicates a normalization operation. This represents the existing center vectors in the current feature template library. This represents the updated center vector. This operation enables the model to have self-learning capabilities over long-term operation, allowing it to adapt to changes in, for example, product packaging production batches and printing processes, thus achieving continuous template evolution.

[0056] Returning to step 203, specifically, the feature vector z can be... Center vectors of each category in the genuine template library μ c Perform similarity calculations. For example, similarity can be calculated using cosine similarity: [Equation 4] in, S c [-1,1] indicates the difference between the input sample and the genuine product category. c The similarity.

[0057] Step 204: Output the judgment result based on similarity.

[0058] This step specifically includes determining whether there is a difference between the character and the corresponding reference character based on the comparison result of similarity and preset threshold, and determining the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character.

[0059] Specifically, the similarity obtained in step 203 can be selected. S c Maximum similarity S max This serves as the basis for judgment. For example, a threshold can be set to T, which can be determined by the validation set. As an example, T can be 0.85, 0.8, 0.75, etc., and this invention does not specifically limit it. When S max When T ≥ T, the character sample can be determined to be genuine; when S maxAt time <T>, it can be determined as "suspected counterfeit", that is, it does not match any genuine template in the feature template library.

[0060] Based on the determination of character differences, the difference at the image level can be judged. Specifically, according to whether the proportion of the number of characters corresponding to the similarity lower than the preset threshold in the total number of characters exceeds the set threshold, the difference between the待测 image and the reference image is judged.

[0061] For example, taking the wine bottle packaging image as an example, when identifying the authenticity of a wine bottle, it is necessary to judge the difference between the overall image of the wine bottle and the genuine image. In the whole-bottle level detection, comprehensive statistics can be carried out on multiple character regions to calculate the proportion of characters with low similarity: [Equation 5] Where M is the number of categories, r low is the proportion of categories lower than the threshold T. When r low ≥ R, the conclusion that the wine bottle is "suspected of being forged" can be output, where R can be 30%, 20%, 10%, and the present invention does not make specific limitations on this. Through this judgment method, the influence of accidental misjudgment of single characters can be effectively reduced, and the accuracy and stability of the difference identification of the overall image can be improved.

[0062] Figure 4 is a schematic structural diagram of a character-based image difference judgment device 400 provided by an embodiment of the present invention. As Figure 4 shown, the device includes: A character detection module 401, configured to extract the character image of each character from the待测 image containing characters and identify the corresponding character category; A feature extraction module 402, configured to extract multi-scale features of the character image corresponding to each character category and fuse the multi-scale features to obtain a feature vector corresponding to the character category; A similarity calculation module 403, configured to calculate the similarity between each of the feature vectors and the corresponding reference feature vectors in the feature template library; and A judgment module 404, configured to judge whether there is a difference between the character and the corresponding reference character according to the comparison result of the similarity with the preset threshold, and judge the difference between the待测 image containing the character and the reference image based on the difference between the character and the corresponding reference character.

[0063] The embodiment of the present invention provides an electronic device, including: One or more processors; A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the methods of any of the above embodiments.

[0064] This invention provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the above embodiments.

[0065] The embodiments of this invention construct a multi-branch deep learning network that integrates the morphological, textural, and semantic features of characters. This solves the problems of traditional OCR's inability to measure printing processes and the poor robustness of traditional image matching to font details. It achieves accurate recognition of character differences at the microscopic level, such as strokes, edges, and textures, thereby enabling character-based image difference identification. Specifically, this invention constructs a compact feature space based on the center vector of genuine samples and combines it with a multi-character statistical judgment strategy, significantly improving the system's discrimination stability and accuracy in complex imaging environments. Particularly noteworthy is the invention's built-in feature template library dynamic update and self-learning mechanism, which endows the system with online evolution capabilities. This allows it to adapt to subtle adjustments in production processes and resist new counterfeiting technologies, ensuring the long-term effectiveness and forward-looking nature of the anti-counterfeiting system.

[0066] Figure 5 An exemplary system architecture 500 is shown in which the character-based image difference determination method of embodiments of the present invention can be applied.

[0067] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0068] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0069] Terminal devices 501, 502, and 503 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0070] Server 505 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 501, 502, and 503 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as product information - for example only) to the terminal devices.

[0071] It should be noted that the character-based image difference judgment method provided in this embodiment of the invention is generally executed by server 505, and correspondingly, the character-based image difference judgment system is generally set in server 505.

[0072] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0073] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device of the present invention. Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0074] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0075] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0076] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.

[0077] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0078] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0079] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be located in a processor, and for example, can be described as: a character detection module, a feature extraction module, a similarity calculation module, and a judgment module. The names of these modules do not necessarily limit the module itself; for example, the character detection module can also be described as a "location module".

[0080] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to implement the methods described in the embodiments of the present invention.

[0081] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A character-based image difference determination method, the method comprising: Extract the character image of each character from the test image containing characters and identify the corresponding character category; Extract multi-scale features of the character image corresponding to each character category, and fuse the multi-scale features to obtain a feature vector corresponding to the character category; Calculate the similarity between each feature vector and the corresponding reference feature vector in the feature template library; as well as Based on the comparison result of the similarity and the preset threshold, it is determined whether there is a difference between the character and the corresponding reference character, and based on the difference between the character and the corresponding reference character, the difference between the test image containing the character and the reference image is determined.

2. The method according to claim 1, wherein, Extract the character image of each character from the test image containing characters and identify the corresponding character category, including: Extract the character region image of each character in the image to be tested and identify the corresponding character category; and Each character region image is scaled to a uniform size to obtain a character image of uniform size.

3. The method according to claim 1, wherein, The multi-scale features include feature maps at different levels, each indicating visual information at a different scale, including character texture information, character morphological information, and character semantic information.

4. The method according to claim 1, wherein determining the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character includes: Determine the similarity between the feature vectors of all characters in the image to be tested and the corresponding reference feature vectors in the feature template library; as well as The difference between the image to be tested and the reference image is determined based on whether the proportion of the number of characters corresponding to similarity below the preset threshold to the total number of characters exceeds the set threshold.

5. The method according to claim 1, wherein, The feature template library is constructed according to the following operations: Extract the reference character image set for each reference character from the reference image set and identify the corresponding character category; Obtain the reference feature vector set of the reference character image set corresponding to each character category; as well as Calculate the center vector of the reference feature vector set for each character category, and store the center vector as the feature template library.

6. The method according to claim 5, further comprising obtaining additional reference feature vectors of reference characters of an additional reference image, calculating new center vectors for corresponding character categories based on the additional reference feature vectors and existing center vectors, and updating the feature template library.

7. A character-based image difference determination device, the device comprising: The character detection module is used to extract the character image of each character from the test image containing characters and identify the corresponding character category; The feature extraction module is used to extract multi-scale features of the character image corresponding to each character category, and fuse the multi-scale features to obtain a feature vector corresponding to the character category. The similarity calculation module is used to calculate the similarity between each feature vector and the corresponding reference feature vector in the feature template library; as well as The judgment module is used to determine whether there is a difference between the character and the corresponding reference character based on the comparison result of the similarity and the preset threshold, and to determine the difference between the test image containing the character and the reference image based on the difference between the character and the corresponding reference character.

8. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.

9. A computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of claims 1-6.

10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.