Knowledge graph-based stamp retrieval method and system, electronic device and medium
By constructing a multi-level tagging system and a stamp knowledge graph, the problem of low recognition accuracy of existing stamp retrieval methods in the case of damage or fading is solved, and efficient and accurate retrieval of damaged stamps is achieved.
Patent Information
- Application Number
- CN202510856792.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Existing stamp retrieval methods are highly dependent on the condition of the stamps. When stamps are severely damaged, creased, or faded, the accuracy of identification will be greatly affected.
By extracting entity and image information from stamp images, multi-level labels are constructed, and weights are assigned to labels at different levels. A key-value database and a stamp knowledge graph are built. Target labels are extracted from the query text, and the labels are expanded and merged to construct an incremental stamp set. Finally, the stamps are sorted according to their weights to retrieve the target stamps.
It improves the accuracy of stamp retrieval, enabling accurate retrieval of stamps even when they are severely damaged, creased, or faded, thus enhancing data query speed and precise search capabilities.
Smart Images

Figure CN120386887B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of stamp retrieval, in particular to a stamp retrieval method and system based on a knowledge graph, an electronic device and a medium. BACKGROUND
[0002] The existing stamp retrieval method is responsible for shooting an image containing a to-be-detected stamp by an image acquisition unit, then is responsible for positioning and extracting the stamp by a stamp positioning unit, and then is responsible for comparing the stamp with a database by a stamp retrieval unit to quickly determine the basic information of the stamp, and finally is responsible for outputting and displaying the basic information of the stamp such as the name, the number, the edition and the like by a result display unit.
[0003] The existing stamp retrieval method has a strong dependence on the state of the stamp, and when the stamp is seriously damaged, wrinkled, faded or the like, the recognition accuracy of the existing stamp retrieval method can be greatly affected. SUMMARY
[0004] The application aims to provide a stamp retrieval method and system based on a knowledge graph, an electronic device and a medium, which can improve the accuracy of stamp retrieval.
[0005] In a first aspect, an embodiment of the application provides a stamp retrieval method based on a knowledge graph, which comprises the following steps:
[0006] Extracting entity information and image information in a stamp image, wherein the entity information is text information related to the stamp, and the image information is image information on the stamp image;
[0007] According to the entity information and the image information, a multi-level label is constructed, and a first weight is assigned to labels of different levels;
[0008] Based on the stamp image, the multi-level label and the first weight, a KV database is constructed, and a stamp knowledge graph is constructed according to stamp entity data and label entity data in the KV database;
[0009] Extracting a plurality of target labels in a to-be-queried text, obtaining a plurality of candidate labels from the stamp knowledge graph according to the plurality of target labels, and obtaining a candidate label set;
[0010] If the candidate label set contains only one label, label expansion is performed on the label in the candidate label set to obtain an expanded label set;
[0011] The candidate label set and the expanded label set are merged to obtain a final label set;
[0012] Based on the final label set, an incremental stamp set containing a first stamp and a stamp weight is constructed;
[0013] According to the stamp weight, the first stamp in the incremental stamp set is sorted to obtain a stamp sorting result, so that a target stamp is retrieved according to the stamp sorting result.
[0014] Compared with the prior art, the first aspect of the present application has the following beneficial effects:
[0015] The method extracts entity information and image information in the stamp image, the entity information is text information related to the stamp, and the image information is image information on the stamp image; according to the entity information and the image information, a multi-level label is constructed, and a first weight is assigned to labels of different levels; based on the stamp image, the multi-level label and the first weight, a KV database is constructed, and according to stamp entity data and label entity data in the KV database, a stamp knowledge graph is constructed; a plurality of target labels in the to-be-queried text are extracted, a plurality of candidate labels are obtained from the stamp knowledge graph according to the plurality of target labels, and a candidate label set is obtained; if the candidate label set contains only one label, the label in the candidate label set is expanded to obtain an expanded label set; the candidate label set and the expanded label set are merged to obtain a final label set; based on the final label set, an incremental stamp set containing a first stamp and a stamp weight is constructed; according to the stamp weight, the first stamp in the incremental stamp set is sorted to obtain a stamp sorting result, so that a target stamp is retrieved according to the stamp sorting result. In this way, the multi-level label is first constructed to construct the KV database, and then the stamp knowledge graph is constructed based on the data in the KV database, which can improve the data query speed and lay a data foundation for later accurate finding of stamps by constructing a knowledge graph rich in stamp characteristics; the plurality of candidate labels related to the plurality of target labels in the to-be-queried text are obtained through the stamp knowledge graph, and in the case of containing only one label, the label is expanded to obtain a final label set, and then the target stamp is retrieved according to the final label set, which can retrieve the stamp according to the to-be-queried text input by the user when the stamp is seriously damaged, wrinkled, faded, etc., and can improve the accuracy of stamp retrieval.
[0016] In some embodiments, the constructing a multi-level label according to the entity information and the image information comprises:
[0017] The entity information is constructed as a first-level label;
[0018] The image information is constructed as a second-level label;
[0019] The query information is constructed in combination with the first-level label and the second-level label;
[0020] An information segment related to the query information is retrieved from an external knowledge source to generate a third-level label, and the external knowledge source is a channel for obtaining information data from the outside.
[0021] In some embodiments, the obtaining, from the stamp knowledge graph, a plurality of candidate labels according to the plurality of target labels to obtain a candidate label set comprises:
[0022] matching the plurality of target labels with labels in the KV database to obtain a plurality of first matching results;
[0023] obtaining a plurality of first candidate labels in the stamp knowledge graph through the plurality of first matching results to obtain an initial label set;
[0024] performing similar semantic expansion on each target label that is not matched in the plurality of target labels to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched;
[0025] matching the plurality of similar semantic expansion words with labels in the KV database to obtain a plurality of second matching results;
[0026] taking a similar semantic expansion word with the largest semantic similarity in the plurality of second matching results as a second candidate label corresponding to each target label that is not matched to obtain a second label set;
[0027] merging the initial label set and the second label set to obtain a candidate label set.
[0028] In some embodiments, the performing similar semantic expansion on each target label that is not matched in the plurality of target labels to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched comprises:
[0029] generating a candidate near-synonym set corresponding to each target label that is not matched in the plurality of target labels;
[0030] obtaining a first semantic primitive set of each target label that is not matched, and obtaining a second semantic primitive set of each candidate near-synonym in the candidate near-synonym set;
[0031] calculating the similarity between each semantic primitive in the first semantic primitive set and all semantic primitives in the second semantic primitive set to obtain a first similarity result;
[0032] calculating the global similarity between each target label that is not matched and the candidate near-synonym corresponding thereto according to the first similarity result to obtain a second similarity result;
[0033] correcting the second similarity result to obtain a third similarity result;
[0034] selecting a plurality of candidate near-synonyms as similar semantic expansions according to the third similarity result to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched.
[0035] In some embodiments, the calculating, according to the first similarity result, a global similarity between each target label in the unmatched target labels and its corresponding candidate near-synonym, to obtain a second similarity result, comprises:
[0036] ;
[0037] wherein, represents the second similarity result, represents an unmatched target label in the unmatched target labels, represents an i-th semantic primitive in a first semantic primitive set, represents a weight of the semantic primitive represents an i-th semantic primitive in a second semantic primitive set, represents a weight of the semantic primitive represents a candidate near-synonym , represents a second semantic primitive set of the candidate near-synonym , represents the first similarity result, represents finding a maximum similarity.
[0038] In some embodiments, the constructing, based on the final label set, an incremental stamp set comprising a first stamp and a stamp weight, comprises:
[0039] obtaining a label node of each label in the final label set ;
[0040] determining, in a knowledge graph, a label entity node or a stamp entity node corresponding to the label node of each label in the final label set;
[0041] constructing an adjacency list according to the label entity node and the stamp entity node;
[0042] obtaining a first stamp associated with each label in the final label set according to the adjacency list;
[0043] calculating a label weight between each label in the final label set and the first stamp associated therewith;
[0044] accumulating the label weight corresponding to the first stamp to obtain a stamp weight;
[0045] constructing an incremental stamp set according to the first stamp and the stamp weight.
[0046] In some embodiments, the calculating a label weight between each label in the final label set and the first stamp associated therewith comprises:
[0047] ;
[0048] wherein, denotes a label weight between the th label and its associated first stamp, denotes a similarity weight of the th label, denotes a weight value in an edge relation two-dimensional vector between the label and the first stamp , denotes a logarithm function, denotes a label rank in an edge relation two-dimensional vector between the label and the first stamp .
[0049] In a second aspect, the embodiments of the present application further provide a stamp retrieval system based on a knowledge graph, the system comprising:
[0050] a data extraction unit configured to extract entity information and image information in a stamp image, the entity information being text information related to the stamp, and the image information being image information on the stamp image;
[0051] a first construction unit configured to construct a multi-level label according to the entity information and the image information, and assign a first weight to labels of different levels;
[0052] a second construction unit configured to construct a KV database based on the stamp image, the multi-level label and the first weight, and construct a stamp knowledge graph according to stamp entity data and label entity data in the KV database;
[0053] a data acquisition unit configured to extract a plurality of target labels in a text to be queried, acquire a plurality of candidate labels from the stamp knowledge graph according to the plurality of target labels, and obtain a candidate label set;
[0054] a label expansion unit configured to, if the candidate label set contains only one label, expand the label in the candidate label set to obtain an expanded label set;
[0055] a data merging unit configured to merge the candidate label set and the expanded label set to obtain a final label set;
[0056] a third construction unit configured to construct an incremental stamp set containing a first stamp and a stamp weight based on the final label set;
[0057] The stamp searching unit is configured to sort the first stamps in the incremental stamp set according to the stamp weight, to obtain a stamp sorting result, and to search for a target stamp according to the stamp sorting result.
[0058] In a third aspect, the embodiments of the present application further provide an electronic device, including at least one control processor and a memory connected with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the stamp searching method based on a knowledge graph.
[0059] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions for enabling a computer to perform the stamp searching method based on a knowledge graph.
[0060] It can be understood that the beneficial effects of the second aspect to the fourth aspect compared with the related art are the same as the beneficial effects of the first aspect compared with the related art, and reference can be made to the related description in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0061] The above and / or additional aspects and advantages of the present application will become apparent and more readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
[0062] Figure 1 is a flowchart of an embodiment of the stamp searching method based on a knowledge graph provided by the present application;
[0063] Figure 2 is a flowchart of the overall method of the best embodiment of the stamp searching method based on a knowledge graph provided by the present application;
[0064] Figure 3 is a schematic diagram of the construction of the stamp knowledge graph in the best embodiment of the stamp searching method based on a knowledge graph provided by the present application;
[0065] Figure 4 is a schematic diagram of the acquisition and storage of the multi-level label in the best embodiment of the stamp searching method based on a knowledge graph provided by the present application;
[0066] Figure 5 is a schematic diagram of the stamp knowledge graph searching in the best embodiment of the stamp searching method based on a knowledge graph provided by the present application;
[0067] Figure 6is a structural schematic diagram of an embodiment of a knowledge graph-based stamp retrieval system provided in the present application;
[0068] Figure 7 is a structural schematic diagram of an embodiment of an electronic device provided in the present application. DETAILED DESCRIPTION
[0069] Embodiments of the present application are described in detail below with reference to the accompanying drawings, in which the same or similar notations used throughout the drawings and the specific embodiments described herein represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application and cannot be understood as limiting the present application.
[0070] In the description of the present application, if there is a description to first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the sequence of indicated technical features.
[0071] In the description of the present application, it should be understood that the orientation description, such as up, down, etc., indicates the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.
[0072] In the description of the present application, it should be noted that, unless otherwise explicitly limited, the words such as setting, installing, connecting, etc. should be broadly understood, and those skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical solution.
[0073] First, the terms involved in the present application are analyzed:
[0074] BM3D open source algorithm: an excellent image denoising open source algorithm, especially in preserving texture and edge.
[0075] Ordered set: a special set data structure that not only guarantees the uniqueness (no duplication) of elements in the set, but also maintains all elements sorted by an associated score. The core features are element uniqueness, element automatic sorting (usually from small to large), and support efficient query based on score range (such as getting ranking and interval elements).
[0076] Similarity Calculation Based on HowNet: A method that uses the concept primitives and semantic relationships in the HowNet knowledge base to measure the similarity between words or sentences. This method calculates the distance between them in the semantic space by analyzing the hierarchical structure of the primitives and their semantic associations, thereby evaluating their similarity.
[0077] Primitive: The most basic semantic unit in the HowNet knowledge base, used to describe the core conceptual features of a word. Primitives are organized in a hierarchical manner to construct a semantic network, expressing the abstract properties and specific meanings of words, providing fine-grained knowledge representation for semantic computation, and supporting word similarity calculation and semantic reasoning.
[0078] Lowest Common Subsumer (LCS): Refers to the deepest ancestor node shared by two nodes in a tree or hierarchical structure. It can be used to measure the similarity of words in the semantic hierarchy and calculate semantic distance.
[0079] HowNet Semantic Relationships: Refers to the types of relationships between words, such as hierarchical relationships, component relationships, and attribute relationships. These relationships form a rich semantic network, enabling computers to understand the logical connections between words and supporting semantic reasoning and knowledge graph construction.
[0080] Database Key-Value Location: A high-efficiency data retrieval method based on key-value pairs, which quickly locates the corresponding value through a unique key.
[0081] Text Cleaning Technology: Refers to the preprocessing of raw text to remove noise, correct errors, and unify formats. It includes removing special symbols, correcting spelling errors, and standardizing date formats, aiming to improve the quality of text data and make it more suitable for subsequent natural language processing tasks.
[0082] Inverted Index: A data structure used for fast document retrieval, which records the list of documents where each word appears, enabling reverse mapping from words to documents. It can significantly improve the efficiency of keyword queries and support fast matching of massive text.
[0083] Adjacency List: A data storage method used to represent graph structures, which maintains a list of adjacent nodes for each node to describe the connection relationship of the graph. In graph computing and network analysis, the adjacency list can efficiently store sparse graph data and support node traversal and path finding operations.
[0084] Parallel Computing Framework: A technology architecture that uses multiple processors or multi-machine clusters to simultaneously execute computing tasks, accelerating data processing and improving the efficiency of model training and inference.
[0085] Topic hierarchy reinforcement: a technique to enhance the distinguishability of topics in text modeling by adjusting the parameters of the topic model or introducing external knowledge, making the generated topics more representative and interpretable.
[0086] Bucket sort: an algorithm that distributes data into different "buckets" according to certain rules, and then sorts the data within each bucket. It can be used to efficiently process large-scale vocabulary statistics or feature selection tasks, reducing the time complexity of sorting calculations.
[0087] Since the existing stamp retrieval method is highly dependent on the state of the stamp, when the stamp is severely damaged, wrinkled, faded, etc., the recognition accuracy of the existing stamp retrieval method may be greatly affected.
[0088] To solve the problem of low recognition accuracy of the existing stamp retrieval method, the present application proposes a stamp retrieval method and system based on knowledge graph, electronic device and medium.
[0089] Referring to Figure 1 , the stamp retrieval method based on knowledge graph provided by the embodiments of the present application. The stamp retrieval method based on knowledge graph is applied to an electronic device, which can be a server or a mobile terminal, etc. As Figure 1 shown, the stamp retrieval method based on knowledge graph can include the following steps:
[0090] Step S100, extracting entity information and image information in the stamp image, the entity information being text information related to the stamp, and the image information being image information on the stamp image;
[0091] Step S200, constructing multi-level labels according to the entity information and the image information, and assigning first weights to labels of different levels;
[0092] Step S300, constructing a KV database based on the stamp image, the multi-level labels and the first weights, and constructing a stamp knowledge graph according to the stamp entity data and the label entity data in the KV database;
[0093] Step S400, extracting a plurality of target labels in the text to be queried, obtaining a plurality of candidate labels from the stamp knowledge graph according to the plurality of target labels, and obtaining a candidate label set;
[0094] Step S500, if the candidate label set contains only one label, performing label expansion on the label in the candidate label set to obtain an expanded label set;
[0095] Step S600, merging the candidate label set and the expanded label set to obtain a final label set;
[0096] Step S700, constructing an incremental stamp set containing the first stamp and the stamp weight based on the final label set;
[0097] Step S800, sorting the first stamp in the incremental stamp set according to the stamp weight to obtain a stamp sorting result, so as to retrieve the target stamp according to the stamp sorting result.
[0098] In this embodiment, entity information and image information in the stamp image are extracted, the entity information is text information related to the stamp, and the image information is image information on the stamp image; a multi-level label is constructed according to the entity information and the image information, and a first weight is assigned to labels of different levels; a KV database is constructed based on the stamp image, the multi-level label and the first weight, and a stamp knowledge graph is constructed according to stamp entity data and label entity data in the KV database; a plurality of target labels in the text to be queried are extracted, a plurality of candidate labels are obtained from the stamp knowledge graph according to the plurality of target labels, and a candidate label set is obtained; if the candidate label set contains only one label, the label in the candidate label set is expanded to obtain an expanded label set; the candidate label set and the expanded label set are merged to obtain a final label set; an incremental stamp set containing the first stamp and the stamp weight is constructed based on the final label set; the first stamp in the incremental stamp set is sorted according to the stamp weight to obtain a stamp sorting result, so as to retrieve the target stamp according to the stamp sorting result. In this way, the multi-level label is first constructed to construct the KV database, and then the stamp knowledge graph is constructed based on the data in the KV database, which can improve the data query speed and lay a data foundation for the later accurate search of the stamp by constructing the knowledge graph rich in stamp characteristics; the plurality of candidate labels related to the plurality of target labels in the text to be queried are obtained through the stamp knowledge graph, and the label expansion is performed in the case of containing only one label to obtain the final label set, and then the target stamp is retrieved according to the final label set, which can retrieve the stamp according to the text to be queried input by the user when the stamp is seriously damaged, wrinkled, faded, etc., and can improve the accuracy of the stamp retrieval.
[0099] The above extraction of entity information and image information in the stamp image can be extraction of entity information and image information in the stamp image by using the same large model, for example, Qwen2.5-vl, which is open source.
[0100] The above extraction of a plurality of target labels in the text to be queried can be extraction of a plurality of target labels in the text to be queried by using a word segmentation technology and a natural language processing technology (NLP).
[0101] In some embodiments, constructing a multi-level label according to the entity information and the image information comprises:
[0102] The entity information is constructed as a first-level label;
[0103] constructing query information by combining the first-level label and the second-level label;
[0104] constructing query information by combining the first-level label and the second-level label;
[0105] retrieving information segments related to the query information from an external knowledge source, generating a third-level label, the external knowledge source being a channel for obtaining information data from the outside.
[0106] In the embodiment, the entity information is constructed as the first-level label, the image information is constructed as the second-level label, the query information is constructed by combining the first-level label and the second-level label, and the third-level label is generated by retrieving information segments related to the query information from an external knowledge source. Thus, by constructing multiple levels of labels, a good data foundation is laid for later construction of a knowledge graph, and the problems of single label and missing semantic association in traditional retrieval methods are solved.
[0107] In some embodiments, a plurality of candidate labels are obtained from the stamp knowledge graph according to a plurality of target labels, to obtain a candidate label set, including:
[0108] matching the plurality of target labels with labels in the KV database to obtain a plurality of first matching results;
[0109] obtaining a plurality of first candidate labels in the stamp knowledge graph through the plurality of first matching results, to obtain an initial label set;
[0110] performing similar semantic expansion on each target label that is not matched in the plurality of target labels to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched;
[0111] matching the plurality of similar semantic expansion words with labels in the KV database to obtain a plurality of second matching results;
[0112] taking a similar semantic expansion word with the largest semantic similarity in the plurality of second matching results as a second candidate label corresponding to each target label that is not matched, to obtain a second label set;
[0113] merging the initial label set and the second label set to obtain the candidate label set.
[0114] In the embodiment, the plurality of target labels are matched with the labels in the KV database to obtain a plurality of first matching results; a plurality of first candidate labels in the stamp knowledge graph are obtained through the plurality of first matching results to obtain an initial label set; each target label that is not matched in the plurality of target labels is subjected to similar semantic expansion to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched; the plurality of similar semantic expansion words are matched with the labels in the KV database to obtain a plurality of second matching results; a similar semantic expansion word with the largest semantic similarity in the plurality of second matching results is selected as a second candidate label corresponding to each target label that is not matched to obtain a second label set; and the initial label set and the second label set are merged to obtain a candidate label set. In this way, the plurality of target labels are first matched with the labels in the KV database, and then the matching results are located to the relevant positions in the stamp knowledge graph, which can avoid large-scale traversal of the knowledge graph, thereby improving the data query speed. Then, each target label that is not matched in the plurality of target labels is subjected to similar semantic expansion, the user query intention (i.e., the plurality of target labels) is mapped to the label nodes in the knowledge graph, the plurality of target labels can be matched to appropriate semantic labels, and a good data foundation is provided for subsequent stamp retrieval.
[0115] In some embodiments, the similar semantic expansion is performed on each target label that is not matched in the plurality of target labels to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched, including:
[0116] A candidate synonym set corresponding to each target label that is not matched in the plurality of target labels is generated;
[0117] A first semantic primitive set of each target label that is not matched is obtained, and a second semantic primitive set of each candidate synonym in the candidate synonym set is obtained;
[0118] Similarities between each semantic primitive in the first semantic primitive set and all semantic primitives in the second semantic primitive set are calculated to obtain a first similarity result;
[0119] According to the first similarity result, a global similarity between each target label that is not matched and the candidate synonym corresponding thereto is calculated to obtain a second similarity result;
[0120] The second similarity result is corrected to obtain a third similarity result;
[0121] According to the third similarity result, a plurality of candidate synonyms are selected as similar semantic expansions to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched.
[0122] In this embodiment, by calculating semantic similarity, similar semantic expansion is performed for each unmatched target tag among multiple target tags, and a suitable semantic tag can be matched for each unmatched target tag, thereby providing a good data basis for subsequent stamp retrieval.
[0123] In some embodiments, based on the first similarity result, calculating the global similarity between each unmatched target tag and its corresponding candidate synonym to obtain a second similarity result includes:
[0124] ;
[0125] in, represents the second similarity result, Indicates unmatched target labels The first set of Indicates the first A sememe, is a positive integer, Sememe The weight of Indicates the first A sememe, Indicates candidate synonyms The second sememe set of represents the first similarity result, Indicates finding the maximum similarity.
[0126] In some implementations, constructing an incremental stamp set comprising a first stamp and a stamp weight based on the final label set includes:
[0127] Get the label node for each label in the final label set ;
[0128] Determine the label node for each label in the knowledge graph The corresponding label entity node or stamp entity node;
[0129] Construct an adjacency list based on the label entity node and the stamp entity node;
[0130] According to the adjacency list, obtain the first stamp associated with each label in the final label set;
[0131] Calculate the label weight between each label and its associated first stamp in the final label set;
[0132] Accumulate the label weight corresponding to the first stamp to obtain the stamp weight;
[0133] Construct an incremental stamp set based on the first stamp and stamp weight.
[0134] In this embodiment, by obtaining the label node of each label in the final label set ; Determine the label node for each label in the knowledge graph The corresponding label entity node or stamp entity node; construct an adjacency list based on the label entity node and the stamp entity node; obtain the first stamp associated with each label in the final label set based on the adjacency list; calculate the label weight between each label in the final label set and its associated first stamp; accumulate the label weight corresponding to the first stamp to obtain the stamp weight; construct an incremental stamp set based on the first stamp and the stamp weight. In this way, the label node of each label is determined in the knowledge graph. The corresponding tag entity nodes or stamp entity nodes can map the semantic tags in the final tag set to specific stamp instances through the association relationships in the knowledge graph to form a stamp set (i.e., an incremental stamp set). By efficiently traversing the stamp-tag association relationships in the knowledge graph, the accuracy and efficiency of subsequent stamp retrieval can be improved.
[0135] In some implementations, calculating a tag weight between each tag in the final tag set and its associated first stamp includes:
[0136] ;
[0137] in, Indicates the final label set Tags The first stamp associated with it The label weights between Indicates the The first stamp, is a positive integer, Indicates the The similarity weight of the tags, Representation Label With the first stamp The weight value in the two-dimensional vector of the edge relationship between represents the logarithmic function, Representation Label With the first stamp The edge relations between the label ranks in the 2D vector.
[0138] To facilitate understanding by those skilled in the art, a set of best embodiments is provided below:
[0139] Since the existing stamp retrieval method has strong dependence on the state of the stamp, when the stamp appears serious damage, wrinkles, fading and other conditions, the recognition accuracy of the existing stamp retrieval method may be greatly affected. At the same time, the database needs to be constantly maintained and updated, and the dynamic adjustment ability is weak, and it is not well combined with the issuance characteristics and actual significance of the stamp.
[0140] To solve the problems existing in the existing stamp retrieval method, with reference to Figure 2 The embodiment proposes a stamp retrieval scheme based on knowledge graph and similarity calculation. The scheme extracts the content of the stamp through a large model, and generates highly relevant connotation labels and assigns relevant weights by combining RAG technology. According to the relationship between the stamp and the label, the corresponding KV database and the stamp knowledge graph are constructed. Finally, based on similarity calculation, the stamp highly relevant to the user input is retrieved. Compared with the traditional stamp method, this embodiment starts from the stamp and the connotation, not only can quickly and accurately locate the stamp interested by the user, but also can deeply mine the cultural, historical and other connotation information behind the stamp, and provide more rich and comprehensive retrieval results for the user.
[0141] The technical scheme of the embodiment specifically includes the following contents:
[0142] I. Stamp knowledge graph construction scheme based on multi-level labels.
[0143] In order to comprehensively represent the stamp information and mine its potential connotation, the embodiment innovatively proposes a stamp knowledge graph construction scheme based on multi-level labels. The core is the large model and retrieval enhancement generation (RAG) technology. Through the large model technology, entity information is extracted, and the stamp image data is parsed to realize theme classification and image recognition, and then the RAG technology is combined to generate multi-level labels. Then, through the weight distribution algorithm combined with the KV database, the stamp data and multi-level labels are further processed to construct the KV database about the stamp and the label, and based on this KV database, the corresponding stamp knowledge graph is constructed. This scheme upgrades the traditional stamp retrieval to "visual-semantic-knowledge" triple driving through hierarchical technology stack, and has the advantages of high efficiency, high precision and interpretability. The stamp knowledge graph construction schematic diagram is as Figure 3 shown.
[0144] 1. Acquisition and storage of multi-level labels.
[0145] The multi-level label generation is the first step of the scheme. Through the layer-by-layer analysis from entity information to pixels to semantics, the stamp theme and visual content are combined and extended, and finally the structured knowledge unit is formed. The system constructs a "core theme-local element-derived knowledge" three-layer label architecture, providing data basis for subsequent construction of knowledge graph, and solving the problem of single label and missing semantic association in traditional retrieval method. The acquisition and storage of multi-level labels are shown in Figure 4 . The specific process is as follows:
[0146] (1) Data input: receiving stamp image data.
[0147] (2) Data preprocessing: using BM3D open source algorithm to eliminate noise and ink stain interference generated during scanning stamp image, and improving the clarity of stamp image data, so as to facilitate the processing and recognition of subsequent large model.
[0148] (3) Acquisition of first-level label and second-level label: first, the entity information of the stamp is classified by large model technology, including stamp name, stamp theme and issuance year, etc. These core theme information are identified as first-level labels. Then, the large model is used to detect the stamp image, and the local elements (such as bamboo, airplane, and rice stalks, etc.) appearing on the image are extracted, which are identified as second-level labels.
[0149] (4) Generation of third-level label: the generation of third-level label is based on first-level label and second-level label. Through RAG technology, combined with first-level label and second-level label, a related query (i.e. query information) is constructed, which aims to obtain the symbolic meaning, spiritual connotation and abstract concept of the label. Then, the database information fragments related to the query are retrieved from external knowledge sources. Finally, the large model is used to reason and induce these information fragments and labels, and output the derived labels (such as "toughness" can be derived from "bamboo") highly related to the stamp theme, which are identified as third-level labels. The external knowledge source can be various channels and resources for obtaining information, data and knowledge from outside, such as public publications and digital resources, etc.
[0150] (5) Distribution of label weight: according to the importance of the content represented by labels of different levels, the relevant weights of labels of different levels are distributed, and the specific formula is as follows:
[0151] 1) Suppose the weights of labels of each level are , and there are labels in each level.
[0152] 2) The weights satisfy .
[0153] 3) The weight distribution of labels of each level is: , , . wherein, , , are the weights of the first label, the second label, the third label and the fourth label respectively.
[0154] (6) Construction of KV (such as Redis) database: 1) data preparation, sorting the relationship between the stamps and the labels of each level and the corresponding weight relationship obtained in the above steps. 2) define the data types used by the database, which are Hash, Sorted Set and Set three types. Among them, Hash is used for the storage of stamp meta (i.e. stamp image and its title name). Sorted Set is used to store the weight, first label, second label and third label. Sorted Set is divided into three levels, which correspond to the first label, the second label and the third label respectively. Such setting facilitates the establishment of inverted index of label name to node, and the specific formula is:
[0155] ;
[0156] wherein, is the inverted index of label name to label node, is the text name of the label (such as "bamboo", "tough" and the like), is the unique identifier of the corresponding label node in the database, which can be quickly obtained by hash lookup. Then there is Set, which is used to store stamp ID.
[0157] The principle of fast positioning of KV database: the storage form of KV database is key-value mapping, which ensures that each key in the database is unique, and the value is one-to-one corresponding to the key. This can directly locate the data position by inputting the key and applying the hash function, and return the corresponding value. At the same time, the multiple labels of the stamp can also be stored efficiently through hash table and ordered set, and the label weight can be automatically sorted, so that the score range can be obtained directly during retrieval, avoiding the "traversal index" and "full table scan" steps in the traditional query mode.
[0158] 2. Construction of stamp knowledge graph.
[0159] Knowledge graph is a kind of knowledge base that organizes data in graph structure, which describes the things and their connections in the real world through three elements of entity (node), relationship (edge) and attribute. Based on the generated multi-level labels and stamp image data, the stamp knowledge graph can be constructed. The specific steps include:
[0160] (1) Data reception: Receive stamp entity data and multi-level label data (i.e., label entity data) from the KV database.
[0161] (2) Definition of entity nodes: Two types of knowledge graph nodes are established, one is the stamp entity node, and the other is the label entity node, including first-level labels, second-level labels and third-level labels.
[0162] (3) Definition of entity node attributes: Based on the data information received from the KV database, define structured attribute information for the stamp entity node and label entity node, such as stamp name, label level, etc.
[0163] (4) Definition of relationship edge: Based on the entity node type and its semantic association, the edge relationship two-dimensional vector is used Define the pointing logic and weight attributes of the relationship edge, where Indicates the label level, Represents the first-level label, second-level label and third-level label respectively. Indicates the weight. This knowledge graph has two types of relationships: stamp-label and label-label. For example, the final result is: "Chinese Bamboo Culture" stamp -> bamboo -> tenacity.
[0164] 2. Stamp knowledge graph retrieval scheme based on similarity calculation.
[0165] In order to achieve efficient and accurate stamp retrieval, this embodiment innovatively proposes a stamp knowledge graph retrieval solution based on similarity calculation. The solution includes strategies such as label set extraction, similarity calculation, label association expansion and instantiated retrieval. Its core is to use similarity calculation, NLP technology and database key value positioning to map user query intentions to label nodes in the knowledge graph, and finally implement instantiated stamp retrieval based on the relationship characteristics of stamps and labels, thereby improving the efficiency and accuracy of stamp retrieval. This solution not only significantly improves the accuracy and robustness of stamp retrieval in complex semantic environments, but also has a high degree of flexibility and scalability, and is suitable for retrieval needs of different degrees. The schematic diagram of stamp knowledge graph retrieval is shown below. Figure 5 shown.
[0166] 1. Introduction to label set extraction.
[0167] This is the first step of the solution. The core idea is to use the calculation based on HowNet similarity combined with database key-value positioning to convert the user's query (sentence or tag) into a set of weighted semantic tags, providing a data foundation for subsequent stamp retrieval. The specific process is as follows:
[0168] (1) Query input: Receive the user's natural language query text (i.e., the text to be queried).
[0169] (2) Query processing: using text cleaning technology to remove special symbols such as "@" and "#" in text content and filter some meaningless stop words such as "not like" and "rather than", so as to standardize the text data. Then use word segmentation technology and natural language processing technology (NLP) to extract and classify the core words (i.e. target labels) in the text data.
[0170] (3) Initial label set formation: efficient key-value matching of the extracted target labels with the constructed KV database, and storing the candidate labels that can be accurately matched with the label nodes in the knowledge graph into the initial label set , wherein, represents the stored candidate label, is the similarity weight, here is 1.0, indicating complete matching.
[0171] First, the extracted labels are matched with the labels stored in the KV database, for example, "tenacious" can only be matched with "tenacious" and cannot be matched with "strong", and the labels matched in the KV database can be efficiently located to the relevant label position in the knowledge graph. This can avoid large-scale traversal of the knowledge graph. Because the entire stamp knowledge graph may have hundreds of thousands of entity nodes and hundreds of thousands of edges, simply inputting the label "tenacious" into the stamp knowledge graph cannot directly locate the position of the "tenacious" label entity node, but rather it needs to traverse the entire stamp knowledge graph one by one, and this process needs to be performed for each label search, which is computationally intensive. By combining the KV database, the relevant position in the stamp knowledge graph can be efficiently located without the need to traverse the entire stamp knowledge graph one by one, improving the efficiency of data query.
[0172] (4) Similarity semantic expansion: using a large language model to generate a candidate synonym set for the unmatched target label t , and calculating the semantic similarity between each synonym and the target label based on the semantic similarity of HowNet. The specific method is as follows:
[0173] 1) Sememe definition: HowNet describes the smallest semantic unit of a word through sememe (Sememe). Each sememe has a hierarchical relationship. Let the sememe set of a word be , where is a sememe. Define the path of sememe as the hierarchical path from the sememe to the root node ROOT , , which represents other sememes between the sememe and the root node. The of sememe is the length of path . For example, the word "strong" may contain the sememe For the psychological state, its path is: [psychological state, psychological characteristics, abstract concept, ROOT], and its depth is .
[0174] 2) Sememe extraction: Obtain the unmatched target label from HowNet and the sememe set of each synonym is represented as and .
[0175] 3) Sememe similarity calculation: The similarity between sememes depends on their least common ancestor (LCS) and path difference. For each sememe of the target label , calculate its maximum similarity with all sememes of the target label (i.e. the first similarity result). The formula is:
[0176] ;
[0177] wherein is the least common ancestor of sememe and sememe , represents the path length difference, i.e. , is the attenuation coefficient (the default value is 0.2). The exponential term punishes the path difference, preventing the similarity from being distorted by the long path of deep sememes.
[0178] 4) Comprehensive word global similarity: The global similarity of the word pair (i.e. the second similarity result) can be calculated by weighted matching of the respective sememe similarities. The formula is:
[0179] ;
[0180] wherein is the weight of sememe , which can be obtained based on the frequency normalization of sememes in HowNet, indicates finding the maximum similarity of each sememe of the word in the sememe set of the word , is the sememe set of the word (i.e. the first sememe set), is the sememe set of the word (i.e. the second sememe set).
[0181] 5) Semantic relation correction: There are semantic relations (such as synonym, antonym, whole-part) between the meanings of the words in HowNet, which can further correct the similarity to obtain the third similarity result. The semantic relation correction formula is:
[0182] ;
[0183] wherein, is the correction factor, which can be adjusted according to the semantic relation: if it is a synonym relation, ; if it is an antonym relation, ; if it is a whole-part relation, .
[0184] 6) Result screening: Set a similarity threshold value that can be customized , and keep the synonyms .
[0185] (6) Formation of the overall label set: The synonyms corresponding to the target label that cannot be accurately matched are further queried in the KV database, and if there is a synonym that can be accurately matched, the largest synonym is stored in the label set , wherein . The overall label set is .
[0186] (7) Label node expansion: When the label set contains only one label, there may be a situation that the stamp retrieval is not accurate due to the lack of semantics. To solve this problem, the label expansion strategy can be adopted. The specific method is: select 2 to 3 labels with the highest association degree (the value of the two-dimensional vector representing the node relationship in the knowledge graph) with the label and store them in the set , wherein , is the similarity weight of the target label.
[0187] (8) Formation of the final label set: Normalize all label weights to form the final label set .
[0188] 2. Introduction of stamp instantiation retrieval.
[0189] The second step of the scheme is the stamp instantiation retrieval, the core idea of which is to map the semantic labels in the final label set to specific stamp instances through the association relationship of the knowledge graph to form a stamp set, and return the most relevant stamps based on weight calculation. This module ensures that the stamp retrieval results meet the user's query intention and fully utilize the semantic association of the stamp knowledge graph, thereby improving the accuracy, efficiency and coverage of stamp retrieval, by efficiently traversing the stamp-label association relationship in the knowledge graph and combining the semantic similarity weight.
[0190] 2.1 Stamp set acquisition.
[0191] Stamp set acquisition is the first step of the stamp instantiation retrieval scheme, the core idea of which is to map the semantic labels in the final label set to specific stamp instances using the association relationship of the knowledge graph, and construct a stamp set containing weight information to provide a data basis for subsequent Top-K sorting. The specific process is as follows:
[0192] (1) Data input: the system receives the final label set output result from the label set acquisition module: , where represents the i-th label in the final label set output result, represents the similarity weight of the i-th label, represents the total number of labels. (2) Inverted index acceleration positioning: according to the inverted index constructed by the KV database, the label node can be quickly obtained through the hash table, and the label node
[0193] set is obtained, denoted as . (3) Batch edge traversal: pre-construct the adjacency table , where
[0194] represents the label entity node obtained according to the label node , and represents the stamp entity node obtained according to the label node , and and are the and values of the two-dimensional vector in the knowledge graph edge relationship, respectively. According to this adjacency table, the stamps associated with the label (i.e., the first stamp) can be obtained in batches.
[0195] (4) Weight calculation optimization: using a parallel computing framework, the label weight is calculated by strengthening the theme level:
[0196] ;
[0197] wherein, denotes the label weight between a label and a stamp (i.e. a first stamp) , denotes the value in the edge relation two-dimensional vector between a label and a stamp , . denotes the value in the edge relation two-dimensional vector between a label and a stamp .The multi-label calculation can then aggregate the cumulative impact of all associated labels on a stamp . .
[0198] (5) Incremental stamp set construction: initialize an empty set , for each , the following processing strategy is adopted:
[0199] 1) if , .
[0200] 2) if , , wherein is the associated label set of a stamp , and is the total aggregation weight of a stamp (i.e. stamp weight).
[0201] 1) The stamp is specifically represented as: .
[0202] 2) Adjacency list structure: the adjacency list is a storage method of graph data structure, which maintains a list of adjacent nodes for each node. In this embodiment, it is a pre-constructed adjacency relation table of label node→[associated stamp] , wherein each associated record contains a three-tuple ( , theme level and weight ).
[0203] 3) Theme level reinforcement: theme level reinforcement is a key adjustment factor in the weight calculation model, which is specifically used to amplify the contribution degree of core labels (high theme level labels) in stamps. Its mathematical expression is:
[0204] ;
[0205] wherein, denotes the reinforcement factor, and the logarithmic function ensures that the reinforcement amplitude increases with Growth while smoothing decay.
[0206] 2.2 Stamp retrieval ranking optimization.
[0207] This module uses the Bucket Sort algorithm to achieve efficient Top-K stamp retrieval. The core idea is to pre-classify stamps into different buckets based on weight distribution characteristics, and then sort them with different algorithms to significantly reduce the sorting calculation amount. Compared with traditional full sorting algorithms, it can achieve 5-8 times performance improvement while ensuring result accuracy. The specific process is as follows:
[0208] (1) Introduction of bucket sorting: Bucket sorting is a non-comparison sorting algorithm. Its core idea follows the "divide and conquer-aggregation" paradigm, and the specific stages are as follows:
[0209] 1) Bucketing phase: Divide the data distribution interval into several ordered buckets (Bucket).
[0210] 2) Bucketing phase: Map elements to corresponding buckets according to their key values.
[0211] 3) In-bucket sorting: Local sorting of each non-empty bucket.
[0212] 4) Result merging: Concatenate all elements in order of buckets.
[0213] In the stamp weight scenario, the key value is the normalized (value range [0, 1]), which makes bucket sorting an ideal choice.
[0214] (2) Input data: Receive incremental stamp set from the stamp set acquisition module.
[0215] (3) Weight distribution analysis: Generate a weight distribution histogram based on the input data, with weight as the horizontal axis, divide the interval [0, 1] into 100 equal-width cells, count the number of stamps falling into each cell, identify high-density areas (such as the 0.3 to 0.5 interval contains 60% data) and sparse areas (such as high-weight stamps greater than 0.8 only account for 2%), and design non-uniform buckets based on the analysis results of the weight distribution histogram, such as narrow buckets (0.05 width) for high-density areas to improve sorting accuracy, and wide buckets (0.2 width) for sparse areas to reduce the probability of empty buckets.
[0216] (4) Dynamic bucketing: Based on the weight distribution, this embodiment divides stamps into different buckets, which can be divided into four buckets:
[0217] 1) High-value bucket: Stores high-weight stamps (such as rare stamps), with small quantity but highest priority.
[0218] 2) Median bucket: stores medium-weight stamps (e.g., popular theme stamps) with moderate data volume.
[0219] 3) Low-value bucket: stores low-weight stamps (e.g., regular stamps) with large data volume but the lowest priority.
[0220] 4) Discard bucket: directly filtered out and does not participate in sorting.
[0221] (5) Hierarchical sorting and result aggregation: this embodiment processes each bucket according to priority, specifically:
[0222] 1) High-value bucket: due to extremely small data volume, insertion sorting is used to ensure complete order and full retention of results.
[0223] 2) Median bucket: an optimized version of quicksort is used, recursively processing only partitions that may contain Top-K items to reduce computational load.
[0224] 3) Low-value bucket: only processed when the results of the first two buckets are insufficient for K, partial sorting (e.g., heap selection) is used to extract the top K items.
[0225] When merging results, this embodiment maintains a global Top-K list in real time. Once the cumulative number is greater than or equal to K, the maximum possible weight of the remaining buckets is checked. If it cannot surpass the current Kth place, processing is terminated early, significantly reducing computational load.
[0226] (6) After sorting, the formatted results are output, including stamp ID, name, picture, normalized weight, and core associated tags.
[0227] Among them:
[0228] 1) Insertion sorting: insertion sorting algorithm divides data into sorted and unsorted parts, and inserts unsorted elements into the correct position of the sorted part one by one, similar to the sorting method when arranging playing cards, suitable for efficient sorting of small sample sizes.
[0229] 2) Quick sort: quick sort is a high-efficiency divide-and-conquer sorting algorithm. Its core idea is to divide the sorted sequence into two parts by recursion: select a reference value, move elements less than the reference value to its left, and elements greater than the reference value to its right, forming two sub-sequences, and then repeat the process for the sub-sequences until they are sorted. Quick sort is particularly suitable for handling large-scale random data due to its in-place sorting and cache-friendly nature.
[0230] 3) Heap sorting: heap sorting is a comparison-based sorting algorithm based on binary heap data structure, which uses the maximum heap or minimum heap property for sorting. Heap sorting is suitable for large-scale data and does not require stability (e.g., priority queue, Top-K problem). Its core steps include:
[0231] (1) Build heap: adjust the unordered array into a heap structure (usually adjust from the last non-leaf node, ensure that the parent node is greater (or less) than the child node).
[0232] (2) Sort: repeatedly exchange the top of the heap (maximum or minimum value) with the last element of the heap, narrow the range of the heap and adjust the heap again, until the entire array is sorted.
[0233] Compared with the prior art, the method of the embodiment has the following advantages:
[0234] Through technologies such as large models, RAGs, and KV databases, multi-level labels are generated based on the characteristics of stamps to build a knowledge graph rich in stamp characteristics, providing basic data for realizing fast and accurate searching of stamp information. The user query intention is mapped to the label node in the knowledge graph, and according to the multi-dimensional relationship characteristics of stamps-labels in the knowledge graph, accurate and flexible instantiation of stamp retrieval is realized, so that the target stamp is obtained, and the accuracy of stamp retrieval is improved.
[0235] The embodiment successfully solves the problems of weak flexibility and high requirements for stamp data sets in the traditional scheme. The embodiment not only improves the flexibility of stamp retrieval, but also successfully mines the connotation information of stamp data. In addition, the representation of the knowledge graph improves the interpretability of the model, making the stamp and its label data content more transparent and intuitive, facilitating understanding and analysis, and having a wide application prospect.
[0236] Referring to Figure 6 , the embodiment of the application also provides a stamp retrieval system based on a knowledge graph, which comprises a data extraction unit 100, a first construction unit 200, a second construction unit 300, a data acquisition unit 400, a label expansion unit 500, a data merging unit 600, a third construction unit 700, and a stamp retrieval unit 800, wherein:
[0237] The data extraction unit 100 is used to extract entity information and image information in the stamp image, the entity information is text information related to the stamp, and the image information is image information on the stamp image;
[0238] The first construction unit 200 is used to construct multi-level labels according to the entity information and the image information, and assign a first weight to labels of different levels;
[0239] The second construction unit 300 is used to construct a KV database based on the stamp image, the multi-level labels, and the first weight, and construct a stamp knowledge graph according to stamp entity data and label entity data in the KV database;
[0240] The data acquisition unit 400 is configured to extract a plurality of target labels in the text to be queried, acquire a plurality of candidate labels from the stamp knowledge graph according to the plurality of target labels, and obtain a candidate label set;
[0241] The label expansion unit 500 is configured to perform label expansion on the label in the candidate label set if the candidate label set contains only one label, and obtain an expanded label set.
[0242] The data merging unit 600 is configured to merge the candidate label set and the expanded label set, and obtain a final label set.
[0243] The third construction unit 700 is configured to construct an incremental stamp set containing the first stamp and a stamp weight based on the final label set.
[0244] The stamp retrieval unit 800 is configured to sort the first stamp in the incremental stamp set according to the stamp weight, obtain a stamp sorting result, and retrieve the target stamp according to the stamp sorting result.
[0245] It should be noted that, since the stamp retrieval system based on the knowledge graph in the embodiment and the stamp retrieval method based on the knowledge graph described above are based on the same inventive concept, the corresponding content in the method embodiment is also applicable to the system embodiment, and will not be described in detail here.
[0246] With reference to Figure 7 The electronic device provided in the embodiment of the present application comprises:
[0247] at least one memory;
[0248] at least one processor;
[0249] at least one program;
[0250] The program is stored in the memory, and the processor executes the at least one program to implement the stamp retrieval method based on the knowledge graph described above.
[0251] The electronic device can be any intelligent terminal, such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a vehicle-mounted computer, etc.
[0252] The electronic device of the embodiment of the present application will be described in detail below.
[0253] The processor 1600 can be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute related programs to implement the technical solutions provided by the embodiments of the present disclosure.
[0254] The memory 1700 can be implemented by a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1700 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present disclosure are implemented by software or firmware, the related program codes are stored in the memory 1700 and are called and executed by the processor 1600 to implement the knowledge graph-based stamp retrieval method of the embodiments of the present disclosure.
[0255] The input / output interface 1800 is configured to implement information input and output.
[0256] The communication interface 1900 is configured to implement the communication interaction between the device and other devices. The communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0257] The bus 2000 is configured to transmit information between various components (for example, the processor 1600, the memory 1700, the input / output interface 1800, and the communication interface 1900) of the device.
[0258] The processor 1600, the memory 1700, the input / output interface 1800, and the communication interface 1900 are connected to each other by the bus 2000 to realize the communication connection between them in the device.
[0259] The embodiments of the present disclosure further provide a storage medium, which is a computer readable storage medium and stores computer executable instructions for causing a computer to execute the above knowledge graph-based stamp retrieval method.
[0260] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include a high-speed random access memory and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory that is remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0261] The embodiments described in the embodiments of the present disclosure are used to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Those skilled in the art can know that, as technology evolves and new application scenarios appear, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.
[0262] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present disclosure, and can include more or fewer steps than the figures shown, or combine certain steps, or different steps.
[0263] The device embodiments described above are only schematic, and units described as separate components can or can not be physically separate, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.
[0264] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functional modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0265] The terms "first", "second", "third", "fourth" and the like used in the specification of the present application and the above-described drawings (if any) are used to distinguish similar objects, and do not necessarily have to describe a particular order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0266] It should be understood that, in the application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B and A and B existing at the same time, wherein A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b and c can be single or multiple.
[0267] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0268] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0269] In addition, the functional units in each embodiment of the application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0270] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various program storage media. The above embodiments of the present application are described in detail in combination with the drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge range of ordinary skilled persons in the art without departing from the purpose of the present application.
[0271] The above embodiments of the present application are described in detail in combination with the drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge range of ordinary skilled persons in the art without departing from the purpose of the present application.
Claims
1. A stamp retrieval method based on a knowledge graph, characterized in that, The method comprises: extracting entity information and image information in the stamp image, the entity information being text information related to the stamp, and the image information being image information on the stamp image; constructing a multi-level label according to the entity information and the image information, and assigning a first weight to labels of different levels; constructing a KV database based on the stamp image, the multi-level label and the first weight, and constructing a stamp knowledge graph according to stamp entity data and label entity data in the KV database; extracting a plurality of target labels in a text to be queried, obtaining a plurality of candidate labels from the stamp knowledge graph according to the plurality of target labels, and obtaining a candidate label set; if the candidate label set contains only one label, performing label expansion on the label in the candidate label set to obtain an expanded label set; merging the candidate label set and the expanded label set to obtain a final label set; constructing an incremental stamp set containing a first stamp and a stamp weight based on the final label set; sorting the first stamp in the incremental stamp set according to the stamp weight to obtain a stamp sorting result, so as to retrieve a target stamp according to the stamp sorting result. 2.The knowledge graph-based stamp retrieval method according to claim 1, characterized in that, The method comprises: constructing a first-level label from the entity information; constructing a second-level label from the image information; constructing query information by combining the first-level label and the second-level label; retrieving information segments related to the query information from an external knowledge source to generate a third-level label, the external knowledge source being a channel for obtaining information data from the outside. 3.The knowledge graph-based stamp retrieval method according to claim 1, characterized in that, The method comprises: matching the plurality of target labels with labels in the KV database to obtain a plurality of first matching results; obtaining a plurality of first candidate labels in the stamp knowledge graph through the plurality of first matching results to obtain an initial label set; performing similar semantic expansion on each target label that is not matched in the plurality of target labels to obtain a plurality of similar semantic expansion words corresponding to each target label that is not matched; matching the plurality of similar semantic expansion words with labels in the KV database to obtain a plurality of second matching results; taking the similar semantic expansion word with the largest semantic similarity in the plurality of second matching results as a second candidate label corresponding to each target label that is not matched to obtain a second label set; merging the initial label set and the second label set to obtain a candidate label set. 4.The knowledge graph-based stamp retrieval method according to claim 3, characterized in that, The method comprises: generating a candidate near-synonym set corresponding to each target label that is not matched in the plurality of target labels; obtaining a first semantic primitive set of each target label that is not matched, and obtaining a second semantic primitive set of each candidate near-synonym in the candidate near-synonym set; Calculate the similarity between each element in the first set of elements and all elements in the second set of elements, to obtain a first similarity result; According to the first similarity result, calculate the global similarity between each target label and its corresponding candidate near-synonym, to obtain a second similarity result; According to the third similarity result, select multiple candidate near-synonyms as similar semantic extensions, to obtain multiple similar semantic extensions corresponding to each target label. According to the first similarity result, calculate the global similarity between each target label and its corresponding candidate near-synonym, to obtain a second similarity result, including: 5.The knowledge graph-based stamp retrieval method according to claim 4, characterized in that, Based on the final label set, an incremental stamp set containing first stamps and stamp weights is constructed, including: ; in, represents the second similarity result, Indicates unmatched target labels The first set of Indicates the first A sememe, Sememe The weight of Indicates the first A sememe, Indicates candidate synonyms The second sememe set of represents the first similarity result, Indicates finding the maximum similarity. 6.The knowledge graph-based stamp retrieval method according to claim 1, characterized in that, According to the label entity node and the stamp entity node, an adjacency list is constructed; acquiring a label node of each label in the final label set ; determining a label node for each label in a knowledge graph a corresponding label entity node or a stamp entity node; According to the adjacency list, the first stamp associated with each label in the final label set is obtained; Calculate the label weight between each label in the final label set and the first stamp associated with it; Accumulate the label weight corresponding to the first stamp to obtain the stamp weight; According to the first stamp and the stamp weight, an incremental stamp set is constructed. The calculation of the label weight between each label in the final label set and the first stamp associated with it includes: 7.The knowledge graph-based stamp retrieval method according to claim 6, characterized in that, The system includes: ; in, Indicates the final label set Tags The first stamp associated with it The label weights between Indicates the The similarity weight of the tags, Representation Label With the first stamp The weight value in the two-dimensional vector of the edge relationship between represents the logarithmic function, Representation Label With the first stamp The edge relations between the label ranks in the 2D vector. 8.A stamp retrieval system based on a knowledge graph, characterized in that, A data extraction unit is configured to extract entity information and image information from a stamp image, wherein the entity information is text information related to the stamp, and the image information is image information on the stamp image; A first construction unit is configured to construct a multi-level label based on the entity information and the image information, and assign a first weight to labels of different levels; A second construction unit is configured to construct a KV database based on the stamp image, the multi-level label and the first weight, and construct a stamp knowledge graph based on stamp entity data and label entity data in the KV database; A data acquisition unit is configured to extract a plurality of target labels from a text to be queried, and acquire a plurality of candidate labels from the stamp knowledge graph based on the plurality of target labels, to obtain a candidate label set; A label expansion unit is configured to perform label expansion on a label in the candidate label set if the candidate label set contains only one label, to obtain an expanded label set; A data merging unit is configured to merge the candidate label set and the expanded label set to obtain a final label set; A third construction unit is configured to construct an incremental stamp set containing first stamps and stamp weights based on the final label set; A stamp retrieval unit is configured to sort the first stamps in the incremental stamp set based on the stamp weight, to obtain a stamp sorting result, so as to retrieve a target stamp based on the stamp sorting result. 9. An electronic device, comprising: The system comprises at least one control processor and a memory connected in communication with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to perform the stamp retrieval method based on the knowledge graph according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions for causing a computer to perform the stamp retrieval method based on the knowledge graph according to any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-intention recognition method and device, storage medium and equipment
CN117744667A
Remote sensing satellite information recommendation method, system and device
WO2024065952A1