Update method, data processing system and computer program product

By partially updating the index shape diagram, the waste of storage space caused by the need for persistent storage index binary trees in the prior art is solved, and the effect of saving storage space and improving storage usage is achieved.

CN120086231AActive Publication Date: 2025-06-03INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510559482.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-06-03
Estimated Expiration
2045-04-29

AI Technical Summary

Technical Problem

When updating the index structure in the prior art, it is necessary to update the index binary tree first, and then update the index shape diagram based on the updated index binary tree, resulting in the need to persist in storing the index binary tree, resulting in wasting storage space.

Method used

By back-compressing and restoring the target shape nodes in the index shape diagram, a restore structure diagram is generated, and then using the target search data to construct the target vector processing and restore structure diagram, a process structure diagram containing the target shape nodes is obtained, and then the shape nodes in the path where the target shape nodes are located in the process structure diagram are updated to obtain the updated index shape diagram.

Benefits of technology

There is no need to persist storage index binary trees, which saves storage space, improves storage usage, and has low computation time complexity, and supports frequent update scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120086231A_ABST
    Figure CN120086231A_ABST
Patent Text Reader

Abstract

The invention provides an updating method, a data processing system and a computer program product, which can be applied to the technical field of data query. The updating method comprises the following steps: executing the following operations by utilizing the first computing unit: receiving an updating instruction from the first control unit; in response to the updating instruction, reading the index shape graph from the first storage unit, and performing inverse compression reduction on a target shape node in the index shape graph to generate a reduced structure graph; a target vector constructed by target retrieval data included in the updating instruction is utilized to process and restore the structure diagram, and a process structure diagram containing target shape nodes is obtained; and updating the shape node in the path of the target shape node in the process structure diagram to obtain an updated index shape diagram. According to the updating method, the index binary tree does not need to be stored persistently, so that the storage space is saved, and the storage utilization rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data query, and more particularly to an update method, a data processing system, and a computer program product. Background Art

[0002] In order to improve the efficiency of retrieving data from a retrieval library, an index structure is constructed for the data stored in the retrieval library. For example, an index binary tree can be constructed based on the data stored in the retrieval library, and then an index graph can be constructed based on the index binary tree. Through the index graph, data can be retrieved at a relatively fast speed. When the data in the retrieval library is updated, such as adding or deleting data in the retrieval library, the index graph needs to be updated accordingly.

[0003] In the process of implementing the concept of the present application, the inventors found that there are at least the following problems in the related art: due to the close dependence between the index graph and the index binary tree, it is usually necessary to first update the index binary tree and then update the index graph based on the updated index binary tree. This method requires persistent storage of the index binary tree, resulting in waste of storage space. Summary of the Invention

[0004] In view of the above problems, the present application provides an update method, a data processing system, and a computer program product.

[0005] According to a first aspect of the present application, an update method is provided, including using a first computing unit to perform the following operations: receiving an update instruction from a first control unit, where the update instruction indicates to update an index shape graph stored in a first storage unit, and the index shape graph represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape graph is generated by compressing nodes of an index binary tree, and one shape node in the index shape graph represents a plurality of tree nodes in the index binary tree having the same subtree shape; in response to the update instruction, reading the index shape graph from the first storage unit and decompressing and restoring a target shape node in the index shape graph to generate a restored structure graph; processing the restored structure graph with a target vector constructed by the target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; and updating the shape nodes in the path where the target shape node is located in the process structure graph to obtain an updated index shape graph.

[0006] The second aspect of the present application provides a data processing system, including: a first processor, including a first control unit, a first computing unit, and a first storage unit, where a first index shape map is stored in the first storage unit; wherein the first computing unit is configured to perform the following operations: receive an update instruction from the first control unit, where the update instruction indicates to update the index shape map stored in the first storage unit, and the index shape map represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape map is generated by compressing nodes of an index binary tree, and one shape node in the index shape map represents a plurality of tree nodes in the index binary tree having the same subtree shape; in response to the update instruction, read the index shape map from the first storage unit, and decompress and restore the target shape node in the index shape map to generate a restored structure map; process the restored structure map with a target vector constructed from the target retrieval data included in the update instruction to obtain a process structure map including the target shape node; update the shape nodes in the path where the target shape node is located in the process structure map to obtain an updated index shape map.

[0007] The third aspect of the present application further provides a computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the above method are implemented.

[0008] According to the embodiments of the present application, by decompressing and restoring the target shape node in the index shape map to generate a restored structure map, then processing the restored structure map with a target vector constructed from the target retrieval data included in the update instruction to obtain a process structure map including the target shape node, and then updating the shape nodes in the path where the target shape node is located in the process structure map to obtain an updated index shape map, the index shape map can be updated without an index binary tree. Compared with first updating the index binary tree and then updating the index shape map based on the updated index binary tree, it is possible to avoid persistent storage of the index binary tree, thereby saving storage space and improving storage utilization rate. Thus, at least partially solving the technical problem in the prior art that persistent storage of the index binary tree leads to waste of storage space, and achieving the technical effects of saving storage space and improving storage utilization rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Through the following description of the embodiments of the present application with reference to the drawings, the above content and other objects, features, and advantages of the present application will become clearer. In the drawings:

[0010] Figure 1 An application scenario diagram of an update method, a data processing system, and a computer program product according to an embodiment of the present application is shown.

[0011] Figure 2 A flowchart of an update method according to an embodiment of the present application is shown.

[0012] Figure 3 Shows the system schematic diagram of the update method according to an embodiment of the present application.

[0013] Figure 4 Shows a schematic diagram of the correspondence between the subtree shape and the shape encoding according to an embodiment of the present application.

[0014] Figure 5 Shows a schematic diagram of combining the reduction structure diagram and the simulation path to obtain the process structure diagram according to an embodiment of the present application.

[0015] Figure 6 Shows the system schematic diagram of querying the associated index vector according to an embodiment of the present application.

[0016] Figure 7 Shows the system structure diagram of the first processor according to an embodiment of the present application.

[0017] Figure 8 Shows the system structure diagram of the data processing system according to another embodiment of the present application.

[0018] Figure 9 Shows the block diagram of the electronic device suitable for implementing the update method according to an embodiment of the present application. Detailed implementation manners

[0019] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present application. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present application. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present application.

[0020] The terms used herein are merely for describing specific embodiments and are not intended to limit the present application. The terms "including", "comprising", etc. used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0021] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0022] In the case of using expressions such as "at least one of A, B, and C, etc.", generally, it should be interpreted according to the meaning that those skilled in the art usually understand this expression (for example, "a system having at least one of A, B, and C" should include but not be limited to a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).

[0023] To improve the efficiency of retrieving data from a retrieval library, an index structure is usually constructed for the data stored in the retrieval library. For example: multiple data in the retrieval library can be converted into multiple vector data, and then an index binary tree is constructed based on the multiple vector data, and then an index structure is constructed based on the index binary tree. Among them, vector data, as a mathematical expression form, can characterize an object or a data point through a set of ordered numerical values. Vector data includes, for example, one-dimensional arrays, and the elements in the array generally appear in numerical forms such as floating-point numbers. Through the numerical values, the position, characteristics, and attributes of the object or data point in the multi-dimensional space can be accurately reflected. The distribution of vector data usually shows an uneven trend. For example, there are high-density distribution areas and sparse distribution areas. This distribution characteristic may cause the retrieval performance to fluctuate greatly, which is not conducive to maintaining a stable and efficient retrieval state.

[0024] Methods for constructing an index structure include, for example, tree-based methods, hash-based methods, quantization-based methods, and graph-based methods, etc.

[0025] Among them, the tree-based index method reduces the search space by tracking the branches of the nearest neighbor tree that is most likely to contain the query point. For example, it includes the KD-tree (K-Dimensional Tree, abbreviated as KD-Tree) method. The KD-tree is a data structure used to index data points in a K-dimensional space. The KD-tree recursively divides the data points into different subspaces. By continuously selecting a dimension and dividing the data points into left and right subtrees according to the numerical values on that dimension, the data points in each subtree have a certain order in a certain dimension. This structure enables the search efficiency to be improved by quickly excluding subspaces that cannot contain the target point during operations such as nearest neighbor search. It is suitable for the fast retrieval of low-dimensional vector data and has wide applications in fields such as image processing and computer vision. However, for the tree-based index method, since the number of tree nodes will rapidly expand as the dimension increases, greatly increasing the memory overhead of the index, this method is not suitable for the data retrieval of high-dimensional vectors.

[0026] The hash - based indexing method converts continuous real - valued data into discrete values through a hash function. During the conversion process, the similarity between vectors is used as a key metric to partition the vectors. Thus, each vector will be assigned to different hash buckets according to its similarity degree. When a search operation is carried out, after the query vector is processed by the hash function, it will also be assigned to the same hash bucket as the similar vectors, thereby greatly reducing the search scope. Hash - based indexing methods include, for example, the Locality - Sensitive Hashing (LSH) method. LSH is a hash function that maps high - dimensional vectors to a low - dimensional space, which can make vectors that are close in the original high - dimensional space have a high probability of being mapped to the same bucket in the hash space. By designing appropriate hash functions and hash - table structures, vectors similar to the query vector can be found quickly. However, the performance of hash - based indexing methods, such as LSH, depends on the design of the hash function, and hash collisions may occur, causing multiple groups of vectors with low similarity to be mapped to the same hash bucket, thus reducing the search efficiency. In addition, the selection and calculation of the hash function will bring a large computational overhead to index construction.

[0027] Quantization - based indexing methods include, for example, the Product Quantization (PQ) method. Product quantization is a vector quantization indexing method, and its core idea is segmentation and clustering. Segmentation includes, for example, dividing sub - spaces. The product quantization method decomposes the original vector into smaller blocks, such as sub - vectors, and then creates a representative code for each block to simplify the representation of each block, that is, performs quantization encoding, thereby reducing the potential range of values. PQ can significantly compress the memory usage of high - dimensional vectors and can speed up the nearest - neighbor search. Inverted Index Product Quantization (IVFPQ) is an accelerated version of PQ product quantization, which can further improve the search speed without affecting the accuracy. However, the recall rate of quantization - based indexing methods is relatively low.

[0028] Graph-based indexing methods include, for example, the Navigation Net method (abbreviated as NN-Net). The navigation net is a graph-based indexing structure that establishes navigation relationships between data points, enabling the rapid finding of target vectors along these navigation relationships during searches. Hierarchical Navigable Small World Graphs (abbreviated as HNSW) is a hierarchical navigation graph that uses a layered structure to layer edges according to characteristic radii, making the average degree of each vertex constant across all layers. However, graph-based indexing methods, such as the construction process of HNSW, are relatively slow and may not be applicable to large-scale datasets. Additionally, parameter tuning is difficult, increasing the difficulty of using HNSW.

[0029] When retrieving data, the data to be retrieved can first be converted into vector form, and then the vector distance between the converted vector and multiple vector data obtained by converting multiple data in the retrieval library can be calculated. The vector distance characterizes the similarity between vectors. Calculation methods for vector distance can include, for example, calculating Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance, cosine similarity and distance, haversine distance, Hamming distance, Jaccard index and distance, etc.

[0030] In the process of implementing the concept of this application, the inventors found that there are at least the following problems in the related art: When updating the index structure, related methods usually need to first update the index binary tree and then update the index structure based on the updated index binary tree. This method requires persistent storage of the index binary tree to ensure that the index binary tree can be read when the index structure needs to be updated. However, persistent storage of the index binary tree causes unnecessary resource waste. The reasons are as follows: On the one hand, when the number of data stored in the retrieval library is large, after extracting feature vectors from a large amount of data, a large number of high-dimensional index vectors will be obtained, and the index binary tree constructed based on a large number of high-dimensional index vectors usually occupies a large storage space. On the other hand, the index shape graph is usually used for retrieving data, and the index binary tree is not used. The index binary tree is generally only used when updating the index structure, so the utilization rate of the index binary tree is low. In this case, persistent storage of the index binary tree will cause waste of storage space.

[0031] In the process of implementing the concept of this application, the inventors also found that there are at least the following problems in the related art: The update and maintenance overhead of the index binary tree is large. When the data update frequency in the retrieval library is high, the index binary tree needs to be updated frequently, thus increasing the update and maintenance overhead of the index binary tree.

[0032] In view of this, an embodiment of the present application provides an update method, including performing the following operations by a first computing unit: receiving an update instruction from a first control unit, where the update instruction instructs to update an index shape graph stored in a first storage unit, and the index shape graph represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape graph is generated by compressing nodes of an index binary tree, and one shape node in the index shape graph represents a plurality of tree nodes in the index binary tree having the same subtree shape; in response to the update instruction, reading the index shape graph from the first storage unit, and decompressing and restoring a target shape node in the index shape graph to generate a restored structure graph; processing the restored structure graph with a target vector constructed by target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; updating shape nodes in the path where the target shape node is located in the process structure graph to obtain an updated index shape graph.

[0033] Figure 1 FIG. shows an application scenario diagram of an update method, a data processing system, and a computer program product according to an embodiment of the present application.

[0034] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first processor 101 and a second processor 102. Data interaction may be performed between the first processor 101 and the second processor 102 to execute the update method.

[0035] For example: The first processor 101 may receive an update instruction from the first control unit, and in response to the update instruction, read the index shape graph from the first storage unit, and decompress and restore the target shape node in the index shape graph to generate a restored structure graph; process the restored structure graph with a target vector constructed by target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; update shape nodes in the path where the target shape node is located in the process structure graph to obtain an updated index shape graph. During the process of updating the index shape graph, the first processor 101 may also send an update record to the second processor 102 so that the second processor 102 can update a copy of the index shape graph stored by the second processor 102 based on the update record.

[0036] Based on the scenario described below Figure 1 through Figures 2 to 5 a detailed description of the update method according to an embodiment of the present application will be given.

[0037] Figure 2 FIG. shows a flowchart of the update method according to an embodiment of the present application.

[0038] As Figure 2 shown, the update method of this embodiment includes operation S210 to operation S240.

[0039] In operation S210, an update instruction is received from a first control unit, where the update instruction indicates to update an index shape graph stored in a first storage unit, and the index shape graph represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape graph is generated by compressing nodes of an index binary tree, and one shape node in the index shape graph represents a plurality of tree nodes in the index binary tree having the same subtree shape.

[0040] In operation S220, in response to the update instruction, the index shape graph is read from the first storage unit, and the target shape node in the index shape graph is decompressed and restored to generate a restored structure graph.

[0041] In operation S230, the restored structure graph is processed by a target vector constructed from the target retrieval data included in the update instruction to obtain a process structure graph including the target shape node.

[0042] In operation S240, the shape nodes in the path where the target shape node is located in the process structure graph are updated to obtain an updated index shape graph.

[0043] A large amount of retrieval data is usually stored in a retrieval library, and an index structure can be constructed based on these retrieval data to improve the retrieval efficiency by using the index structure. The index structure can specifically be in the form of an index shape graph. Specifically, constructing an index structure for retrieval data can include: respectively performing feature extraction processing on a plurality of retrieval data to obtain retrieval vectors corresponding to the plurality of retrieval data; performing compression processing on the retrieval vectors to obtain a plurality of index vectors; constructing an index binary tree based on the plurality of index vectors; and performing node compression on the index binary tree to obtain an index shape graph. Among them, performing compression processing on the retrieval vectors includes, for example: performing dimensionality reduction processing, binarization processing, etc. on the retrieval vectors.

[0044] For example: in the field of autonomous driving, it may be necessary to retrieve a target image corresponding to a target vehicle from a large number of images to extract feature information of the target vehicle from the target image. The retrieval library can be a database containing 1 million images, and the retrieval data can be image data corresponding to the 1 million images. To improve the efficiency of retrieving the target image from the retrieval library, an index shape graph can be constructed for the 1 million images.

[0045] Figure 3 The system schematic diagram of the update method according to an embodiment of the present application is shown.

[0046] Among them, Figure 3 The index vectors v1 to v8 shown in can be obtained based on a plurality of retrieval data. An index binary tree can be constructed based on the index vectors v1 to v8, and an index shape graph can be constructed based on the index binary tree.

[0047] The indexed binary tree may include multiple levels of tree nodes. For example, the root tree node is the first-level tree node, the tree nodes directly connected to the root tree node are the second-level tree nodes, the tree nodes directly connected to the second-level tree nodes are the third-level tree nodes, and so on.

[0048] The indexed binary tree may further include associated edges between the tree nodes. The associated edges may represent the N-dimensional values in the index vector. For example, the associated edge between the first-level tree node and the second-level tree node is used to represent the first-dimensional value, the associated edge between the second-level tree node and the third-level tree node is used to represent the second-dimensional value in the index vector, and so on.

[0049] As Figure 3 shown, for the indexed binary tree, the associated edge between the first-level tree node and the left second-level tree node represents that the first-dimensional value in the index vector is 0, and the associated edge between the first-level tree node and the right second-level tree node represents that the first-dimensional value in the index vector is 1. The associated edge between the left second-level tree node and the leftmost third-level tree node represents that the second-dimensional value in the index vector is 0, and the associated edge between the leftmost third-level tree node and the leftmost fourth-level tree node represents that the third-dimensional value in the index vector is 0. Thus, through the associated edge between the first-level tree node and the left second-level tree node, the associated edge between the left second-level tree node and the leftmost third-level tree node, and the associated edge between the leftmost third-level tree node and the leftmost fourth-level tree node, the index vector v1(0, 0, 0) can be represented. There are various subtree shapes in the indexed binary tree. To facilitate distinguishing the subtree shapes, the subtree shapes can be numbered to obtain shape codes corresponding to the subtree shapes.

[0050] Figure 4 FIG. shows a schematic diagram of the correspondence between the subtree shapes and the shape codes according to an embodiment of the present application.

[0051] As Figure 4 shown, different subtree shapes respectively correspond to different shape codes and are stored as shape mapping information in the first storage unit.

[0052] After determining the subtree shapes included in the indexed binary tree, the indexed binary tree can be node-compressed based on the subtree shapes to generate an index shape graph. Specifically, multiple tree nodes in the indexed binary tree may correspond to the same subtree shape. For example Figure 3Both the third-level tree node on the leftmost side and the third-level tree node on the rightmost side of the middle-index binary tree have sub-tree shapes with a shape code of 2. Multiple tree nodes corresponding to the same sub-tree shape can be merged into the same shape node in the index shape graph, that is, node compression is performed on the index binary tree. The number of the shape node obtained after node compression is the same as the shape code of the sub-tree shape. Therefore, through the number of the shape node, the shape of the sub-tree shape corresponding to the shape node can be determined. For example, if the number of a shape node is 6, it can be determined that the sub-tree shape corresponding to the shape node is the sub-tree shape with a shape code of 6 as shown in Figure 4 The shape shown.

[0053] For example: The third-level tree node on the leftmost side and the third-level tree node on the rightmost side of the middle-index binary tree in Figure 3 can be merged into the same shape node in the index shape graph, and the number of the shape node is the same as the shape code of the tree node. The merged shape node is Figure 3 The shape node numbered 2 in the index shape graph. And all the last-level tree nodes in the index binary tree can be merged into shape nodes, and the code of the shape node is 1.

[0054] By performing node compression on the index binary tree, an index shape graph that occupies only a relatively small storage space compared to the index binary tree can be generated.

[0055] The index shape graph includes multiple levels of shape nodes, and the shape nodes are connected by edges. The edges between the shape nodes can represent the N-dimensional values in the index vector. For example: Figure 3 The edges between the shape nodes numbered 6, 4, 3, and 1 in the index shape graph can represent that the first-dimensional value in the index vector is 0, the second-dimensional value is 1, and the third-dimensional value is 1 in sequence, thereby representing the index vector (0, 1, 1).

[0056] Furthermore, in operation S210, when the retrieval data in the retrieval library is updated, such as when retrieval data is added or deleted, an update instruction can be issued to indicate that the index shape graph needs to be updated through the update instruction.

[0057] Specifically, in operation S220, the index vector to be updated can be determined according to the update instruction. For example, it can be determined according to the update instruction that an index vector (1, 1, 1) needs to be added. Correspondingly, the index shape graph needs to be updated so that the updated index shape graph can represent the index vector (1, 1, 1).

[0058] Therefore, in response to an update instruction, the index shape graph can be read from the first storage unit first. The index shape graph can be stored in the first storage unit, which can include, for example, the storage unit of a Graphics Processing Unit (GPU) or the on-chip storage space of a Field-Programmable Gate Array (FPGA).

[0059] After reading the index shape graph, the target shape node in the index shape graph can be determined according to the index vector to be updated. For example, in the case of adding an index vector, the multi-dimensional values of multiple dimensions of the index vector can be matched with the multi-dimensional values represented by multiple edges of the index vector to be updated, and the shape node where the matching is interrupted can be used as the target shape node.

[0060] For example, for Figure 3 the index shape graph shown, when adding an index vector (1, 1, 1), the first-dimensional value of this index vector is 1, and the value represented by the edge between the shape nodes numbered 6 and 5 in the index shape graph is also 1, so the values match. Continuing to match the second-dimensional value 1 of the index vector, it is found that among the edges connected to the shape node numbered 5, there is no edge that can represent the second-dimensional value of 1. Therefore, the matching value is interrupted, and the shape node numbered 5 can be used as the target shape node.

[0061] After determining the target shape node, the subtree shape corresponding to the target shape node can be determined according to the number of the target shape node. Then, the target shape node can be decompressed and restored to obtain a restored structure diagram. The decompression and restoration include: representing the subtree shape corresponding to the target shape node in the index shape graph.

[0062] For example Figure 3 as shown, for the index shape graph: the edge numbered 1 represented between the shape nodes numbered 2 and 1 can be deleted, a shape node 1 is added, that is Figure 3 the shape node numbered 1 represented by the dotted line in the middle, and a directed edge between the shape node numbered 1 represented by the dotted line and the shape node 2 is added, that is Figure 3 the edge represented by the dotted line in the middle. Thus, through the restored structure diagram, the subtree shape corresponding to the target shape node can be intuitively represented.

[0063] Furthermore, in operation S230, the target retrieval data can include the retrieval data to be updated, such as the data to be added or deleted. The target retrieval data can be converted into the form of vector data, for example, by extracting features from the target retrieval data to obtain a target vector.

[0064] Processing the restored structure diagram using the target vector may include: adding edges that can represent the numerical values of multiple dimensions of the target vector and shape nodes for connecting the edges to the restored structure diagram to obtain a process structure diagram.

[0065] As Figure 3 shown, when adding a new index vector (1, 1, 1), in the restored structure diagram, the first-dimensional numerical value of the target vector is 1, which can be represented by the edge between the shape node numbered 6 (hereinafter simply referred to as shape node 6) and shape node 5. The second-dimensional numerical value of the target vector is 1. However, the second-dimensional numerical value represented by the edge connected to shape node 5 is 0 instead of 1. Therefore, an edge connected to shape node 5 that represents the second-dimensional numerical value of 1 can be added, and corresponding shape nodes can be added. Further, an edge that represents the third-dimensional numerical value of 1 and the corresponding shape nodes also need to be added. Thus, the shape node numbered 1 represented by a dashed line and the dashed-line represented edges in the process structure diagram are obtained.

[0066] Further, in operation S240, the path where the target shape node is located is: among the multiple paths connecting the root shape node and the last-level shape node, at least one path including the target shape node.

[0067] For example: The target shape node is shape node 5. In Figure 3 , the path where the target shape node is located may include, for example: shape node 6, shape node 5, the edge between shape node 6 and shape node 5, and the shape nodes numbered 1 and 3 represented by dashed lines and the dashed-line represented edges; the path where shape node 5 is located may also include, for example: shape node 6, shape node 5, the edge between shape node 6 and shape node 5, and shape node 2, shape node 1, and the edges between shape node 5 and shape node 2, and between shape node 2 and shape node 1.

[0068] Specifically, since compared with the original restored structure diagram, the shape nodes and edges in the process structure diagram will change. For example Figure 3 in the process structure diagram, new shape nodes and edges represented by dashed lines are added. Therefore, the subtree shapes corresponding to the shape nodes will also be updated. For example: As Figure 4 shown, subtree shape 5 and subtree shape 6 no longer exist, and subtree shape 7 is newly added. Further, after updating the subtree shapes, the subtree shapes can be renumbered to obtain updated shape encodings. When inserting or deleting retrieval data, only local changes will occur to the shape of the index binary tree, and the affected subtree range is limited to the binary tree path corresponding to the inserted or deleted vector. Correspondingly, only local changes will occur to the index shape diagram and the shape encoding. For example, comparing Figure 3From the index shape diagram and the updated index shape diagram, it can be seen that shape nodes 5 and 6 no longer exist, and a new shape node numbered 7 is added. In the updated index shape diagram, the shape code corresponding to the root shape node changes from 6 to 7. It can be seen that this update method does not require updating all the data of the index shape diagram, thus enabling dynamic partial update or incremental update of the index shape diagram, avoiding maintaining two copies of index data like cold and hot backup mechanisms.

[0069] By decompressing and restoring the target shape node in the index shape diagram to generate a restored structure diagram, and then processing the restored structure diagram with the target vector constructed from the target retrieval data included in the update instruction to obtain a process structure diagram containing the target shape node, and then updating the shape nodes in the path where the target shape node is located in the process structure diagram to obtain an updated index shape diagram, the index shape diagram can be updated without an index binary tree. Compared with the method of first updating the index binary tree and then updating the index shape diagram based on the updated index binary tree, it is possible to avoid persistent storage of the index binary tree, thereby saving storage space and increasing storage utilization. And the computational time complexity is relatively low. For a D-dimensional target vector, the computational time complexity is only O(D), which means that when adding or deleting a D-dimensional target vector, only D computational operations need to be performed when updating the shape diagram. Due to the low computational time complexity, it can support scenarios with frequent updates.

[0070] Furthermore, the number of nodes in the index binary tree may be very large, and the corresponding memory overhead for storing the index binary tree is relatively large. To efficiently use the memory overhead, after constructing the index shape diagram, the index binary tree can be deleted, and only a smaller-scale auxiliary data is retained for updating the index shape diagram. The smaller-scale auxiliary data includes, for example, the parameters required to generate the index vector, such as the parameters required for dimensionality reduction processing and binarization processing, the correspondence between multiple paths in the index binary tree and the index vector, and the number corresponding to the root shape node. Among them, the root shape node can be used as the entry of the index shape diagram. For example, when constructing the index shape diagram, it starts from the root shape node.

[0071] According to an embodiment of the present application, the index shape diagram includes multiple shape nodes and the edges between the shape nodes. The multiple shape nodes are divided into N + 1 levels and form multiple paths corresponding to multiple index vectors respectively with the edges, where N is an integer greater than 1; the index vector includes N-dimensional index values, and the N-dimensional index values represent at least one of the following: image features, voice features, text features.

[0072] Specifically, the index shape diagram includes multiple levels of shape nodes. For example, the root shape node is the first-level shape node, the shape nodes connected to the root shape node are the second-level shape nodes, and the shape nodes connected to the second-level shape nodes are the third-level shape nodes. For example Figure 3In the updated index shape graph, the shape node numbered 7 is the first-level shape node, and the shape node numbered 4 is the second-level shape node.

[0073] The edges between shape nodes can represent the N-dimensional index values of the index vector. For example, the edge between the first-level shape node and the second-level shape node can represent the first-dimensional index value, and the edge between the second-level shape node and the third-level shape node can represent the second-dimensional index value. By traversing the edges between shape nodes, multiple edges for representing the index values of all dimensions of the index vector can be determined. For example Figure 3 As shown in the updated index shape graph, the edges for representing the index vector (0, 1, 1) include the edges sequentially connecting the shape nodes numbered 7, 4, 3, and 1. Correspondingly, the path corresponding to the index vector includes the shape nodes numbered 7, 4, 3, and 1, and the edges sequentially connecting the shape nodes numbered 7, 4, 3, and 1.

[0074] Specifically, the N-dimensional index values in the index vector can represent features of different modalities, such as representing at least one of the following: image features, voice features, text features.

[0075] According to the embodiments of the present application, the N-dimensional index values of the index vector can be features of multiple feature types.

[0076] For example, in the scenario of image retrieval, the N-dimensional index values include at least one of the following: image texture, image color, image brightness, the shape of the target object in the image, image depth, image grayscale. According to the input image of the user, a query can be performed in the index shape graph constructed by the index vectors generated from the picture data in the image library. After obtaining the target vector, the target image corresponding to the target vector can be found and returned to the user.

[0077] For example, in the scenario of intelligent question answering, the N-dimensional index values include at least one of the following: voice volume, voice rhythm, voice speech rate, voice intonation, voice timbre; or the N-dimensional index values include at least one of the following: text semantics, text length, text paragraph structure, word frequency of the target word in the text. According to the input voice or text of the user, a query can be performed in the index shape graph constructed by the index vectors generated from the voice data in the voice library. After obtaining the target vector, the target voice or target text corresponding to the target vector can be found and returned to the user.

[0078] The N-dimensional index values of the index vector can be briefly and accurately represented by the index shape graph. Through the index vector, the different modality feature information of the retrieved data can be accurately represented, thereby improving the retrieval accuracy and retrieval efficiency.

[0079] According to an embodiment of the present application, the shape node carries a shape code, and the shape code is used to represent the subtree shape category of multiple tree nodes with the same subtree shape; decompressing and restoring the target shape node in the index shape graph includes: reading shape mapping information from the first storage unit, where the shape mapping information is used to represent the mapping relationship between multiple subtree structures and subtree shape categories; decompressing and restoring the target shape node based on the shape mapping information and the shape code of the target shape node.

[0080] Specifically, the subtree shape category is used to distinguish different subtree shapes, and the index binary tree may include multiple subtree shapes. The subtree shapes corresponding to different tree nodes may be the same, and the same number may be set for the same subtree shape to obtain a shape code corresponding to the same subtree shape. Different shape codes can represent different subtree shapes. The shape mapping information can be stored in the first storage unit.

[0081] Furthermore, the subtree shape corresponding to the target shape node can be determined according to the shape mapping information, and decompressing and restoring, that is, restoring the subtree structure of the shape node, can be to represent the subtree shape corresponding to the target shape node in the index shape graph, thereby generating a restored structure diagram.

[0082] According to an embodiment of the present application, each of the multiple paths in the index shape graph includes N edges; the method for determining the target shape node can be: hierarchically matching the N-dimensional target values included in the target vector with the N edges of each of the multiple paths to determine a reference vector that completely or partially matches the target vector from multiple index vectors; determining the target shape node from the target path where the reference vector is located.

[0083] Specifically, in the index shape graph, the root shape node and the last-level shape node can be connected by multiple paths. For example, Figure 3 in the index shape graph shown, path 1 may include shape nodes 6, 4, 3, 1, and the edges between these shape nodes; path 2 may include shape nodes 6, 5, 2, 1, and the edges between these shape nodes.

[0084] In each path, the N edges included in the path can respectively represent N-dimensional numerical values. For example Figure 3The edge between shape node 6 and shape node 4 can represent that the first-dimensional value is 0. Matching the N-dimensional target values included in the target vector with the N edges of each of the multiple paths level by level can include: matching the N-dimensional target values included in the target vector with the N-dimensional values represented by the N edges respectively. The reference vector that completely matches the target vector can include: the N-dimensional values included in the reference vector are exactly the same as the N-dimensional target values included in the target vector. For example, if the target vector is (1, 1, 1), the reference vector is also (1, 1, 1). The reference vector that partially matches the target vector can include: the N-dimensional values included in the reference vector are partially the same as the N-dimensional target values included in the target vector. For example, if the target vector is (1, 1, 1), the reference vector is (1, 0, 0).

[0085] The target path where the reference vector is located includes multiple edges for representing the reference vector, and the shape nodes connected by the multiple edges. The target shape node can be determined from the target path where the reference vector is located.

[0086] Specifically, by first matching the N-dimensional target values included in the target vector with the N edges of each of the multiple paths level by level to determine the reference vector that completely or partially matches the target vector, and then determining the target shape node from the target path where the reference vector is located, the target shape node can be determined efficiently and accurately.

[0087] According to the embodiments of the present application, in the case where the update instruction indicates a data insertion operation, the target shape node includes: the interruption node where the matching is interrupted in the target path where the reference vector that partially matches the target vector is located; in the case where the update instruction indicates a data deletion operation, the target shape node includes: the single-path node that is only connected to the adjacent shape node by one edge in the target path where the reference vector that completely matches the target vector is located.

[0088] For example: it is required to add the target vector (1, 1, 1), and the reference vector is (1, 0, 0). In Figure 3 the index shape graph shown, the interruption node where the matching is interrupted is shape node 5, so shape node 5 is the target shape node. Another example is that it is required to delete the target vector (0, 1, 1), and the reference vector is also (0, 1, 1). The target path where the reference vector is located includes shape node 6, shape node 4, shape node 3, and shape node 1. Among these shape nodes, only shape node 3 is the single-path node that is only connected to the adjacent shape node by one edge, so shape node 3 is the target shape node.

[0089] Specifically, in the case of adding a target vector, it is necessary to add a shape node under the interruption node, which will cause the shape codes corresponding to the interruption node and its upper-level shape nodes to change. In the case of deleting a target vector, since a shape node may be connected to multiple other shape nodes, a shape node may be included in multiple paths. Therefore, if all the shape nodes in the target path are directly deleted, it may affect other paths. Therefore, only the single-path nodes that are connected to adjacent shape nodes by only one edge can be deleted. After deleting the single-path nodes, the shape codes corresponding to the single-path nodes and their upper-level shape nodes also change.

[0090] Specifically, by using the interruption node where the matching is interrupted in the target path of the reference vector that partially matches the target vector, or the single-path node that is connected to the adjacent shape node by only one edge in the target path of the reference vector that completely matches the target vector as the target shape node, it is convenient to accurately and intuitively determine the shape nodes whose shape codes need to be changed, improving the update efficiency.

[0091] According to the embodiments of the present application, updating the shape nodes in the path where the target shape node is located in the process structure diagram includes: updating the shape code of the target shape node based on the shape mapping information; and hierarchically updating the shape codes of the shape nodes in the path where the target shape node is located based on the shape mapping information and the updated shape code of the target shape node.

[0092] Specifically, the shape code of the target shape node can be updated first.

[0093] See Figure 3 It can be seen that compared with the restoration structure diagram, the process structure diagram has added shape nodes and edges represented by dotted lines. Therefore, the subtree shape corresponding to the target shape node will change. Specifically, the target shape node is shape node 5, and the subtree shape originally corresponding to the target shape node is Figure 4 the subtree shape with the shape code of 5 in, after adding the shape nodes and edges represented by dotted lines, the subtree shape corresponding to the target shape node is no longer the subtree shape with the shape code of 5, but the subtree shape with the shape code of 4. Therefore, the shape code of the target shape node can be updated from 5 to 4.

[0094] After updating the shape code of the target shape node, hierarchically update the shape codes of the shape nodes in the path where the target shape node is located.

[0095] See Figure 3It can be seen that after adding shape nodes and edges represented by dashed lines to the process structure diagram, not only will the subtree shape corresponding to the target shape node change, but the subtree shapes corresponding to other shape nodes in the path where the target shape node is located may also change. For example, if the path where the target shape node is located includes shape node 6, which was originally the root shape node, that is, the subtree shape corresponding to shape node 6 was the subtree shape with shape code 6. However, after adding shape nodes and edges represented by dashed lines to the process structure diagram, the subtree shape corresponding to the root shape node becomes Figure 4 the subtree shape with shape code 7 in Figure 4 . Therefore, the shape code of the root shape node can be updated from 6 to 7.

[0096] Furthermore, since the subtree shapes corresponding to multiple shape nodes in the path where the target shape node is located may all change, to improve the update efficiency, the shape codes of the shape nodes in the path where the target shape node is located can be updated level by level. For example, the shape code of the root shape node can be updated first, and then the shape codes of the next-level shape nodes can be updated in sequence.

[0097] Furthermore, by first updating the shape code of the target shape node and then gradually updating the shape codes of other shape nodes in the path where the target shape node is located, the index shape diagram can be updated orderly and accurately.

[0098] According to the embodiments of the present application, since the target shape node is the source node that causes node changes in the index shape diagram, all possible change situations are related to the changes of this node. The method of the embodiments of the present application only needs to update the nodes in the path where this node is located, without full-scale update, greatly reducing the calculation amount.

[0099] According to the embodiments of the present application, using the target vector processed by the target retrieval data included in the update instruction to process the reduction structure diagram includes: according to the construction rules of the index binary tree, constructing the target vector into a simulated path; according to the operation type of the update operation indicated by the update instruction, combining the reduction structure diagram and the simulated path, or deleting the simulated path from the reduction structure diagram.

[0100] Specifically, when the update operation indicated by the update instruction is an insertion operation, the reduction structure diagram and the simulated path are combined; when the update operation indicated by the update instruction is a deletion operation, the simulated path (it can be only part of the path in the simulated path) is deleted from the reduction structure diagram.

[0101] In the case where the update operation indicated by the update instruction is an insert operation, according to the construction rules of the index binary tree, constructing the target vector as a simulation path can be: based on the L-th dimension target value to the N-th dimension target value of the target vector, construct a simulation path consisting of at least one simulation node, wherein a matching interruption occurs between the target vector and the reference vector in the L-th dimension, and L is less than N.

[0102] Figure 5 A schematic diagram of combining a reduction structure diagram and a simulation path to obtain a process structure diagram according to an embodiment of the present application is shown.

[0103] like Figure 5 As shown in , when the target vector (1,1,1) is inserted, by searching in the index shape graph, it is found that the target vector and the reference vector have a matching interruption at the second node. Then a simulation path from the second-level node to the last-level node is constructed. Figure 4 The dashed path in the path with the vector value (1,1,1) shown in FIG. Then, this simulation path is combined with the restored structure diagram to obtain the process structure diagram.

[0104] After obtaining the process structure diagram, the shape coding is updated. Specifically, the shape coding of the target shape node is first updated based on the shape mapping information, and then the shape coding of the shape nodes in the path where the target shape node is located is updated step by step based on the shape mapping information and the updated shape coding of the target shape node. In the case of adding a new target vector, it is necessary to add a new shape node under the interruption node, which will cause the shape coding corresponding to the interruption node and its upper-level shape node to change. Therefore, it is updated step by step upward based on the interruption node.

[0105] like Figure 5 As shown, the shape coding of the target shape node is updated based on the shape mapping information, such as updating the shape coding of the shape node with shape coding 5 where the matching interruption occurs to 4, and then updating it step by step upward until the root node, for example, updating the shape coding of the shape node with shape coding 6 to 7. At the same time, shape coding is added to the nodes in the simulation path, such as the nodes with shape coding 3 and 1 in the figure. Finally, the shape nodes with the same shape coding are merged to obtain the updated index shape graph.

[0106] When the operation type is to delete the target vector, the simulation path may be a path generated from the root node to the last level node for the target vector. The simulation path or part of the simulation path may be directly deleted from the restored structure diagram to obtain the process structure diagram.

[0107] It should be noted that in the case of deleting the target vector, since a shape node may be connected to multiple other shape nodes, a shape node may be included in multiple paths. Therefore, if all shape nodes in the target path are directly deleted, it may affect other paths. Therefore, only the single-path nodes that are connected to adjacent shape nodes by only one edge can be deleted. After deleting the single-path nodes, the shape codes corresponding to the single-path nodes and their superior shape nodes also change. Therefore, it is necessary to update the shape codes step by step upward based on the parent node of the single-path node.

[0108] According to an embodiment of the present application, multiple retrieval data are distributed in multiple data sets, and multiple data sets are respectively associated with multiple paths. At least one retrieval data included in the same data set corresponds to an index vector; the query method further includes: when the update instruction indicates to perform a data insertion operation and there is a target path in the index shape graph that exactly matches the target vector, the index shape graph is not updated; the target retrieval data is added to the target data set associated with the target path.

[0109] Specifically, the retrieval library may include multiple identical retrieval data, and multiple identical retrieval data can generate multiple identical index vectors. A data set may include one retrieval data or multiple identical retrieval data. The retrieval data included in different data sets is different. For example: data set 1 includes retrieval data 1, and the retrieval data corresponds to index vector 1; data set 2 includes retrieval data 2, and the retrieval data corresponds to index vector 2. One index vector can correspond to one path in the index shape graph. Since a data set includes at least one retrieval data, one retrieval data corresponds to one index vector, and one index vector corresponds to one path in the index shape graph, therefore, a data set can be associated with one path. For example, the target data set is the data set associated with the target path.

[0110] Specifically, the data insertion operation may be to add retrieval data to the original retrieval library, and the target retrieval data corresponds to the target vector. When there is a target path in the index shape graph that exactly matches the target vector, it means that the index shape graph itself already includes the target vector. Therefore, there is no need to update the index shape graph, but the retrieval library needs to be updated, and the target retrieval data can be directly stored in the target data set associated with the target path.

[0111] In one embodiment, when a new retrieval data is added, a target vector corresponding to the added retrieval data is first generated. The number of the root shape node of the index shape graph can be read, and the N-dimensional numerical values represented by multiple edges in the index shape graph are matched with the N-dimensional index values of the target vector. All the shape node numbers in the passed path are pushed into a pre-created stack until the path reaches the last-level shape node or an interruption node. When jumping to the last-level shape node (i.e., there is no case of jumping to an interruption node), it indicates that the index shape graph can already represent the index vector corresponding to the added retrieval data. Under this condition, there is no need to update the shape graph, and only the added retrieval data needs to be added to the retrieval data set associated with the last-level tree node.

[0112] In one embodiment, when jumping to an interruption node, the index shape graph is updated, and the shape mapping information used to represent the mapping relationship between multiple subtree structures and subtree shape categories is updated.

[0113] According to an embodiment of the present application, the query method further includes: when an update instruction indicates a data deletion operation, there is a target path in the index shape graph that exactly matches the target vector, and the number of retrieval data in the target data set associated with the target path is greater than a predetermined threshold (for example, greater than 1), the index shape graph is not updated; the target retrieval data is deleted from the target data set associated with the target path.

[0114] Specifically, a data set may only include the target retrieval data, so the path associated with this data set only corresponds to the target vector. In this case, if the target retrieval data needs to be deleted, the index shape graph needs to be updated, and there is no longer a path corresponding to the target vector in the updated index shape graph. However, a data set may include other retrieval data in addition to the target retrieval data (that is, the number of retrieval data in the target data set is greater than 1), then the path where the target vector is located is shared by other data, and this path cannot be deleted. In this case, the index shape graph is not updated, but the retrieval library needs to be updated, that is, only the target retrieval data needs to be deleted from the target data set.

[0115] According to an embodiment of the present application, the method of the embodiment of the present application further includes, while using the first calculation unit to perform the update of the index shape graph, using the second calculation unit to perform the operation of data query. Specifically, the second calculation unit performs the following operations: in response to receiving a query instruction from the second control unit, querying the associated index vector from the copy of the index shape graph in the second storage unit.

[0116] Figure 6 The system schematic diagram for querying the associated index vector according to an embodiment of the present application is shown.

[0117] As Figure 6As shown, in the case of adding or deleting data, the first computing unit in the first processor can correspondingly update the index shape graph, shape mapping information, and leaf node array. Correspondingly, the second computing unit in the second processor performs the operation of data query. In response to receiving a query instruction from the second control unit in the second processor, an associated index vector is queried from a copy of the index shape graph in the second storage unit of the second processor.

[0118] Among them, the first processor can include, for example, a Central Processing Unit (abbreviated as CPU), or can also include a Graphics Processing Unit (abbreviated as GPU).

[0119] The second processor includes, for example, an FPGA or a GPU. Among them, a copy of the index shape graph can be stored in the second storage unit of the second processor. The second storage unit can include, for example, the on-chip storage space of the FPGA. The on-chip storage space of the FPGA includes, for example, the Static Random Access Memory (abbreviated as SRAM) of the FPGA. The second processor can include an external off-chip memory. The off-chip memory can be used to store shape mapping information. The off-chip memory of the FPGA includes, for example, the Dynamic Random Access Memory (abbreviated as DRAM). When updating the shape graph, the latest shape mapping information can be downloaded from the first storage unit.

[0120] A copy of the index shape graph also represents multiple index vectors constructed based on multiple retrieval data. It can be that multiple retrieval data correspond to one index vector. After querying an associated index vector from the copy of the index shape graph, the original retrieval data corresponding to the associated index vector needs to be returned to the user. It can be based on the pre-constructed association relationship between the index vector and the retrieval data to find the corresponding retrieval data.

[0121] Multiple retrieval data are distributed in multiple data sets. The multiple data sets are respectively associated with the index shape graph and multiple index vectors in the index binary tree in a one-to-one correspondence. At least one retrieval data included in the same data set corresponds to one index vector.

[0122] The association relationship between the index vector and the data set of the retrieval data can be reflected in: associating multiple paths (or multiple last-level leaf nodes) in the index binary tree with multiple data sets in a one-to-one correspondence. After querying an associated index vector that matches the query data in the query instruction, the path or the last-level leaf node corresponding to the associated index vector in the index binary tree can be found, so that the data set associated with the associated index vector can be further found.

[0123] The position information of the last - level leaf nodes in the index binary tree can be stored in an ordered leaf node array, and the leaf node array stores: the IDs of the last - level leaf nodes in the index binary tree arranged in order. After querying the associated index vector that matches the query data in the query instruction, the corresponding last - level leaf node of the associated index vector in the index binary tree can be located from this leaf node array.

[0124] To determine which last - level leaf node the associated index vector corresponds to, it can be achieved by carrying offset information in the shape node. The offset information is, for example Figure 3 as shown by the numerical value in the parentheses of the shape node. The offset information represents the number of last - level leaf nodes in the left subtree of the tree node corresponding to the shape node in the index binary tree. For example, Figure 3 the offset information carried by the shape node with shape code 6 in can be expressed as (3). Correspondingly, in the index binary tree, the number of last - level leaf nodes in the left subtree of the tree node corresponding to the shape node with shape code 6 is 3.

[0125] During the process of querying the associated index vector, the offset information carried by the shape node can be obtained, and based on the offset information, the target leaf node can be determined from multiple last - level leaf nodes; specifically, the offset information carried by the respective upper - level shape nodes corresponding to multiple edges with the numerical value of the first value (for example, "1") in the path where the associated index vector is located can be summed to obtain the total offset. This total offset characterizes the position offset of the leaf node corresponding to this associated index vector in the horizontal direction relative to the first leaf node in the corresponding index binary tree. Therefore, the target leaf node can be determined from K leaf nodes according to this total offset, that is, starting from the first leaf node, offset to the right by the position corresponding to the total offset to locate the target leaf node.

[0126] After the index shape graph is updated, correspondingly, in order to achieve accurate query, the leaf node array related to the query operation also needs to be updated.

[0127] The update method of the leaf node array is different in the scenarios of data insertion update and data deletion update.

[0128] In the case of data insertion update to the index shape graph, assuming that when jumping to the interrupt node where the match is interrupted, the offset information corresponding to this interrupt node is p, and the number of leaf nodes of this interrupt node is e, the update of the leaf node array is divided into the following two cases: The first case: When the numerical value corresponding to the edge from the interrupt node to the empty node is '0', then all array elements in the interval from position p to the end of the leaf node array are shifted one position backward, and a newly added leaf node is inserted into position p of the leaf node array.

[0129] The second case: When the edge corresponding value is '1' when jumping from an interrupted node to an empty node, all array elements in the range from position p+e to the end of the leaf node array are shifted one position backward, and a newly added leaf node is inserted into the position p+e of the leaf node array.

[0130] In the case of data insertion and update of the index shape graph, when the index shape graph is updated, the adjustment process of the leaf node array is as follows: Assume that when jumping to the last-level shape node, the offset information of the relevant shape nodes in this path is calculated as p. Then, the leaf node at position p is deleted from the leaf node array, and all array elements in the range from p+1 to the end of the array are shifted one position forward. Since the index vector is constructed based on at least one retrieval data, at least one retrieval data that constructs the same index vector can be used as a retrieval data set.

[0131] This application also provides a data processing system. Figure 7 The system structure diagram of the first processor according to an embodiment of this application is shown.

[0132] As Figure 7 shown, the first processor includes a first storage unit, a first control unit, and a first calculation unit. A first index shape graph is stored in the first storage unit. The first control unit can send an update instruction to the first calculation unit so that the first calculation unit performs an update based on the received update instruction to obtain an updated index shape graph.

[0133] Among them, a first index shape graph is stored in the first storage unit; the first calculation unit is used to perform the following operations: Receive an update instruction from the first control unit, where the update instruction indicates to update the index shape graph stored in the first storage unit, and the index shape graph represents multiple index vectors constructed based on multiple retrieval data; the index shape graph is generated by compressing nodes of an index binary tree, and a shape node in the index shape graph represents multiple tree nodes in the index binary tree with the same subtree shape; In response to the update instruction, read the index shape graph from the first storage unit, decompress and restore the target shape node in the index shape graph to generate a restored structure graph; Process the restored structure graph with a target vector constructed by the target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; Update the shape nodes in the path where the target shape node is located in the process structure graph to obtain an updated index shape graph. For the operation of the first calculation unit to update the index shape graph, reference can be made to the descriptions of operations S210 to S240 in the foregoing embodiments, which will not be elaborated here.

[0134] Figure 8 The system structure diagram of a data processing system according to another embodiment of this application is shown.

[0135] As shown Figure 8 in the figure, the data processing system further includes: a second processor, the second processor includes a second control unit, a second computing unit, and a second storage unit, and a second index shape map is stored in the second storage unit; wherein the second computing unit is configured to perform the following operations: in response to a query instruction issued by the second control unit, query predetermined data from the second index shape map, wherein the second index shape map is a backup of the first index shape map.

[0136] Specifically, the first processor can execute the update task, and the second processor can execute the query task. Specifically, the second processor can read the first index shape map from the first storage unit of the first processor, generate a backup of the first index shape map, and store the backup of the first index shape map in the second storage unit. After the second control unit issues a query instruction, the backup of the first index shape map, that is, the second index shape map, can be read from the second storage unit, so as to query the predetermined data corresponding to the query instruction based on the second index shape map.

[0137] The first processor and the second processor can respectively execute the operations of updating the index shape map and data query, so the update and query can be synchronized and do not affect each other. Specifically, the update of the index shape map does not affect the data query operation.

[0138] Specifically, in order to enable the update and query to be synchronized and not affect each other, it can be set that other programs cannot read it before the update of the shape mapping information is completed. For example, when updating the shape mapping information in the off-chip memory, only the shape node data in the shape mapping information needs to be updated in ascending order of the shape node numbers. Since the shape mapping information data will not be read by the first computing unit of the first processor, the update of the shape mapping information will not affect the query operation of the first computing unit. The updated shape mapping information will only be downloaded by the first processor when the index shape map update program is loaded next time.

[0139] Furthermore, when updating the index shape map, first write the newly added shape nodes, then modify the number of the root shape node in the index shape map, and finally, after the query operation performed by the first computing unit according to the unupdated index shape map is completed, delete the shape nodes with a reuse count of 0. Thus, the first computing unit can work normally during the update process of the index shape map without interruption or waiting, achieving seamless dynamic update, and moreover, the query result can be determined based on the updated index shape map.

[0140] According to an embodiment of the present application, the first computing unit is further configured to: generate an update record and send the update record to the second processor, where the update record includes: node path information of newly added shape nodes and / or deleted shape nodes during the update of the first index shape graph; the second computing unit is further configured to: after the query operation of the predetermined data is completed, update the second index shape graph based on the update record.

[0141] Specifically, when inserting or deleting retrieval data, only local changes occur to the shape of the index binary tree, and the range of the affected subtree is limited to the binary tree path corresponding to the inserted or deleted vector. Correspondingly, only local changes occur to the data in the index shape graph. Therefore, the second processor does not need to fully copy all the data of the updated index shape graph, but only needs to update the changed data, such as only updating the node path information of the newly added shape nodes and / or deleted shape nodes. During the process of updating the index shape graph, the changed data can be recorded, such as recording the node path information of the newly added shape nodes and / or deleted shape nodes, to generate an update record.

[0142] To ensure that the second index shape graph stored in the second storage unit is consistent with the first index shape graph, after the query operation of the predetermined data is completed, the second index shape graph can be updated based on the update record. Thus, the query operation can be performed based on the updated index shape graph.

[0143] As Figure 8 shown, in the first processor, feature extraction processing can be performed on the newly added or deleted data to generate a retrieval vector, which is in the form of a high-dimensional feature vector. Then, dimensionality reduction processing is performed on the retrieval vector to obtain a dimensionality-reduced vector. Next, binarization processing is performed on the dimensionality-reduced vector to obtain a target vector. Further, the index shape graph is updated to obtain an updated index shape graph and shape mapping information. In addition, an update record can be generated so that the second processor can update and store the second index shape graph accordingly.

[0144] When updating the data in the second processor, different from the conventional data backup method, local updates are performed based on the update record of the data change, without full copying, which greatly improves the update efficiency.

[0145] Further, when updating the second index shape graph, the newly added shape nodes can be written first, then the information of the entry shape nodes can be modified, and finally, after the query operation ends, the invalid shape nodes (i.e., the deleted shape nodes) can be deleted. Since the newly added shape nodes do not affect the current query, the writing can be performed first. The entry shape nodes, as the entry for the query, can be executed after the operation of writing the newly added shape nodes. The invalid shape nodes may be related to the current query, and the invalid shape nodes need to be deleted after the query operation ends, so as to ensure that the update process does not affect the query process.

[0146] Further, the data related to the index shape graph can be written into a solid-state storage space, and the solid-state storage space includes, for example, a hard disk. Thus, when the system fails or restarts, these data can be read from the solid-state storage space, and based on these data, the index shape graph can be restored. The data related to the index shape graph includes, for example, dimensionality reduction parameters and quantization coding parameters, shape mapping information, index shape graph, data set, the number of the root shape node, etc.

[0147] Figure 9 The block diagram of an electronic device suitable for implementing the update method according to an embodiment of the present application is shown.

[0148] As Figure 9 shown, the electronic device 900 according to an embodiment of the present application includes a processor 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage section 908 into the random access memory (RAM) 903. The processor 901 can include, for example, a general microprocessor (e.g., CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (e.g., an application specific integrated circuit (ASIC)), etc. The processor 901 can also include on-board memory for caching purposes. The processor 901 can include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present application.

[0149] In the RAM 903, various programs and data required for the operation of the electronic device 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. The processor 901 performs various operations of the method flow according to an embodiment of the present application by executing the programs in the ROM 902 and / or the RAM 903. It should be noted that the programs can also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 can also perform various operations of the method flow according to an embodiment of the present application by executing the programs stored in one or more memories.

[0150] According to an embodiment of the present application, the electronic device 900 may further include an input / output (I / O) interface 905, and the input / output (I / O) interface 905 is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the input / output (I / O) interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. The driver 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the driver 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.

[0151] The present application also provides a computer-readable storage medium, which may be included in the device / device / system described in the above embodiments; or may exist alone without being assembled into the device / device / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiments of the present application is implemented.

[0152] According to an embodiment of the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, device, or device. For example, according to an embodiment of the present application, the computer-readable storage medium may include the above-described ROM 902 and / or RAM 903 and / or one or more memories other than ROM 902 and RAM 903.

[0153] An embodiment of the present application further includes a computer program product, which includes a computer program, and the computer program includes program codes for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program codes are used to cause the computer system to implement the method provided by the embodiments of the present application.

[0154] When the computer program is executed by the processor 901, the above functions defined in the system / apparatus of the embodiments of the present application are executed. According to the embodiments of the present application, the above-described systems, apparatuses, modules, units, etc. can be implemented by computer program modules.

[0155] In one embodiment, the computer program can rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program can also be transmitted and distributed in the form of signals on a network medium, and be downloaded and installed through the communication part 909, and / or be installed from the removable medium 911. The program code included in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0156] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or be installed from the removable medium 911. When the computer program is executed by the processor 901, the above functions defined in the system of the embodiments of the present application are executed. According to the embodiments of the present application, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.

[0157] According to the embodiments of the present application, the program code for executing the computer program provided in the embodiments of the present application can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include but are not limited to, such as Java, C++, python, the "C" language, or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by using an Internet service provider to connect through the Internet).

[0158] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code, and the above-mentioned module, segment of a program, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0159] Those skilled in the art can understand that the features described in the various embodiments of the present application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments of the present application can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present application.

[0160] The embodiments of the present application have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present application. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Without departing from the scope of the present application, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present application.

Claims

1. An updating method, characterized in that: The method comprises performing the following operations using a first computing unit: Receive an update instruction from a first control unit, wherein the update instruction indicates to update an index shape graph stored in the first storage unit, the index shape graph represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape graph is generated based on node compression of an index binary tree, and a shape node in the index shape graph represents a plurality of tree nodes having the same subtree shape in the index binary tree; In response to the update instruction, the index shape graph is read from the first storage unit, and the target shape node in the index shape graph is decompressed and restored to generate a restored structure graph; Processing the restored structure graph using a target vector constructed by target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; The shape nodes in the path where the target shape node in the process structure graph is located are updated to obtain an updated index shape graph.

2. The method according to claim 1, characterized in that: The index shape graph includes a plurality of shape nodes and edges between the shape nodes, the plurality of shape nodes are divided into N+1 levels, and form a plurality of paths corresponding to the plurality of index vectors respectively with the edges, where N is an integer greater than 1; The index vector includes an N-dimensional index value, and the N-dimensional index value represents at least one of the following: an image feature, a voice feature, and a text feature.

3. The method according to claim 1 or 2, characterized in that: The shape node carries a shape code, and the shape code is used to characterize the subtree shape category of the plurality of tree nodes having the same subtree shape; Decompressing and restoring the target shape node in the index shape graph includes: Reading shape mapping information from the first storage unit, wherein the shape mapping information is used to represent a mapping relationship between multiple subtree structures and subtree shape categories; Based on the shape mapping information and the shape encoding of the target shape node, the target shape node is decompressed and restored.

4. The method according to claim 3, characterized in that Updating the shape nodes in the path where the target shape node in the process structure diagram is located includes: updating the shape encoding of the target shape node based on the shape mapping information; Based on the shape mapping information and the updated shape code of the target shape node, the shape codes of the shape nodes in the path where the target shape node is located are updated step by step.

5. The method according to claim 1 or 2, characterized in that: Processing the restored structure graph using the target vector constructed by the target retrieval data included in the update instruction includes: According to the construction rule of the index binary tree, construct the target vector into a simulation path; According to the operation type of the update operation indicated by the update instruction, the restoration structure graph and the simulation path are combined, or the simulation path is deleted from the restoration structure graph.

6. The method according to claim 2, characterized in that The plurality of paths in the indexed shape graph each include N edges; The method further comprises: Matching the N-dimensional target value included in the target vector with the N edges of the multiple paths step by step to determine a reference vector that fully matches or partially matches the target vector from the multiple index vectors; The target shape node is determined from the target path where the reference vector is located.

7. The method according to claim 6, characterized in that: In the case where the update instruction indicates to perform a data insertion operation, the target shape node includes: an interruption node where a matching interruption occurs in the target path where the reference vector partially matches the target vector; In the case where the update instruction indicates to perform a data deletion operation, the target shape node includes: a single path node in the target path where the reference vector that completely matches the target vector is located, and which is connected to an adjacent shape node by only one edge.

8. The method according to claim 6, characterized in that The multiple search data are distributed in multiple data sets, the multiple data sets are respectively associated with the multiple paths, and at least one search data included in the same data set corresponds to one index vector; The method further comprises: when the update instruction indicates to perform a data insertion operation and there is a target path in the index shape graph that completely matches the target vector, The index shape map is not updated; The target search data is added to the target data set associated with the target path.

9. The method according to claim 8, characterized in that The method further comprises: when the update instruction indicates to perform a data deletion operation, there is a target path in the index shape graph that completely matches the target vector, and the number of retrieved data in the target data set associated with the target path is greater than a predetermined threshold, The index shape map is not updated; The target retrieval data is deleted from the target data set associated with the target path.

10. The method according to claim 2, characterized in that The N-dimensional index value includes at least one of the following: image texture, image color, image brightness, shape of a target object in the image, image depth, image grayscale; or The N-dimensional index value includes at least one of the following: voice volume, voice prosody, voice speed, voice intonation, and voice timbre; or The N-dimensional index value includes at least one of the following: text semantics, text length, text paragraph structure, and word frequency of the target word in the text.

11. The method according to claim 1, characterized in that The method further includes, using the second computing unit, performing the following operations: In response to receiving a query instruction from the second control unit, the associated index vector is queried from the copy of the index shape map stored in the second storage unit.

12. A data processing system, characterized in that: The system comprises: The first processor includes a first control unit, a first calculation unit, and a first storage unit, wherein the first storage unit stores a first index shape graph; wherein: The first computing unit is used to perform the following operations: receiving an update instruction from the first control unit, wherein the update instruction indicates to update an index shape graph stored in the first storage unit, the index shape graph represents a plurality of index vectors constructed based on a plurality of retrieval data; the index shape graph is generated based on node compression of an index binary tree, and a shape node in the index shape graph represents a plurality of tree nodes having the same subtree shape in the index binary tree; In response to the update instruction, the index shape graph is read from the first storage unit, and the target shape node in the index shape graph is decompressed and restored to generate a restored structure graph; Processing the restored structure graph using a target vector constructed by target retrieval data included in the update instruction to obtain a process structure graph including the target shape node; The shape nodes in the path where the target shape node in the process structure graph is located are updated to obtain an updated index shape graph.

13. The system according to claim 12, characterized in that The system further comprises: The second processor includes a second control unit, a second calculation unit, and a second storage unit, wherein the second storage unit stores a second index shape graph; The second computing unit is used to perform the following operations: In response to the query instruction issued by the second control unit, predetermined data is queried from the second index shape map, wherein the second index shape map is a backup of the first index shape map.

14. The system according to claim 12, characterized in that: The first computing unit is further used to: generate an update record, and send the update record to the second processor, wherein the update record includes: node path information of newly added shape nodes and / or deleted shape nodes during the update process of the first index shape graph; The second calculation unit is further used for updating the second index shape graph based on the update record after the query operation of the predetermined data is completed.

15. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Database index management method and device and electronic equipment

    CN111488341A

  • Data processing method and device and storage medium

    CN111723246A

  • Index establishment method and device, equipment, storage medium and computer program product

    CN113312360A

  • Learning type index model based on distribution transformation model and lazy memory cleaning strategy

    CN116561126A

  • Method and system for implementing fast incremental backups

    US20130246362A1

Cited By

  • Color database management system based on active display

    CN120994664A