Index creation method and apparatus, storage medium, and electronic device

By clustering and indexing objects such as cameras and checkpoints, the problem of low query efficiency for distributed objects in the city is solved, enabling fast searching and efficient querying.

CN115185943BActive Publication Date: 2026-11-24ZHEJIANG DAHUA SYST ENG
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210768434.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-01
Publication Date
2026-11-24
Estimated Expiration
2042-07-01

AI Technical Summary

Technical Problem

Object retrieval efficiency is low for cameras and checkpoints distributed throughout the city, and existing technologies have not been able to effectively solve this problem.

Method used

By clustering the target object set, a target index is created, including clustering objects into clusters and constructing the clusters into root and child node indexes of a tree structure, thereby improving query efficiency.

Benefits of technology

It enables fast retrieval of target objects within a target object collection, improving query efficiency and solving the problem of low object query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185943B_ABST
    Figure CN115185943B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, storage medium, and electronic device for creating an index. The method includes: obtaining a target object set, comprising N objects, where N is greater than or equal to 1; performing clustering processing on the N objects in the target object set to obtain clustering results; and creating a target index for the target objects among the N objects based on the clustering results. This application solves the technical problem of low query efficiency for objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communications, and more specifically, to a method and apparatus for creating an index, a storage medium, and an electronic device. Background Technology

[0002] Spatial query technology is one of the most commonly used technologies in the field of Geographic Information Science (GIS) and is widely used in various industries.

[0003] For example, cameras and checkpoints are distributed throughout security scenarios, and maps are an excellent medium for storing this distribution data. The geographical locations of cameras and checkpoints need to be dynamically maintained (e.g., correcting the latitude and longitude of their locations). Currently, the total number of cameras and checkpoints distributed throughout cities is considerable, and filtering out suitable targets from a large number of objects (cameras or checkpoints) is complex and inefficient.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides an index creation method and apparatus, storage medium and electronic device to at least solve the technical problem of low object query efficiency.

[0006] According to one aspect of the embodiments of this application, a method for creating an index is provided, comprising: obtaining a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; performing clustering processing on the N objects in the target object set to obtain a clustering result; and creating a target index for the target objects among the N objects based on the clustering result.

[0007] Optionally, clustering the N objects in the target object set to obtain a clustering result includes: when N is less than or equal to M, clustering the N objects into a target cluster, where M is a preset threshold and M is greater than 0; determining the target cluster as the clustering result; and creating a target index for the target object among the N objects based on the clustering result includes: determining a target root node for the target object set, and determining each of the N objects as a child node of the target root node, thus obtaining N child nodes corresponding to the target root node; obtaining the target child node corresponding to the target object from the N child nodes; and determining the target index of the target object through the target root node and the target child nodes.

[0008] Optionally, clustering the N objects in the target object set to obtain clustering results includes: performing multiple clustering processes on the N objects when N is greater than M, until a preset condition is met, and then stopping the clustering process to obtain multiple clustering results; creating a target index for the target object among the N objects based on the clustering results includes: creating a target index for the target object among the N objects based on the multiple clustering results.

[0009] Optionally, when N is greater than M, multiple clustering processes are performed on the N objects until a preset condition is met, at which point the clustering process is stopped, resulting in multiple clustering results. This includes: in the (i-1)th clustering result, if the number of objects in the first cluster is greater than a preset threshold M, performing an i-th clustering process on the first cluster to obtain an i-th clustering result, where the (i-1)th clustering result is the clustering result obtained by performing the (i-1)th clustering process on the target object set, and i is greater than 1; if the number of objects in each cluster in the i-th clustering result is less than or equal to the preset threshold M, it is determined that the preset condition is met, and the clustering process is stopped, resulting in the multiple clustering results.

[0010] Optionally, performing the i-th clustering process on the first cluster to obtain the i-th clustering result includes: obtaining the coordinate position of each object in the first cluster, wherein the coordinate position includes longitude and latitude; and performing clustering on each object in the first cluster in the longitude and latitude directions respectively to obtain the i-th clustering result.

[0011] Optionally, creating a target index for the target object among the N objects based on the multiple clustering results includes: when the number of objects contained in each cluster in the i-th clustering result is less than or equal to the preset threshold M, determining the target object set as the target root node, the (i-1)-th clustering result as the (i-1)-th level child node, the i-th clustering result as the i-th level child node, and each object contained in each cluster in the i-th clustering result as the (i+1)-th level child node; determining the (i-1)-th level target child node corresponding to the target object in the (i-1)-th level child node, determining the i-th level target child node corresponding to the target object in the i-th level child node, and determining the (i+1)-th level target child node corresponding to the target object in the (i+1)-th level child node; and determining the target index of the target object through the target root node, the (i-1)-th level target child node, the i-th level target child node, and the (i+1)-th level target child node.

[0012] Optionally, after creating a target index for the target object among the N objects based on the clustering result, the method further includes: searching for the target object in the target object set based on the target index; and performing a modification or deletion operation on the target object if the target object is found.

[0013] Optionally, performing a modification operation on the target object includes: modifying the target coordinate position of the target object to obtain a modified target object; adding the modified target object to a virtual object set; and deleting the target object from the target object set.

[0014] Optionally, after adding the modified target object to the virtual object set and deleting the target object from the target object set, the method further includes: determining the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is the first child node of the target root node; and determining the index of the modified target object through the target root node and the first child node.

[0015] Optionally, the method further includes: adding the first object to a virtual object set when a new first object is added; determining the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is a second child node of the target root node; and determining the index of the first object through the target root node and the second child node.

[0016] According to another aspect of the embodiments of this application, an index creation apparatus is also provided, comprising: an acquisition module for acquiring a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; a processing module for performing clustering processing on the N objects in the target object set to obtain a clustering result; and a creation module for creating a target index for the target objects among the N objects based on the clustering result.

[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described index creation method at runtime.

[0018] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the index creation method as described above.

[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described index creation method through the computer program.

[0020] In this embodiment, N objects in the target object set are clustered to obtain clustering results, and a target index is created for the target objects among the N objects based on the clustering results. Thus, when searching for a target object in the target object set, the target object can be found through the target index, thereby improving the technical effect of object query efficiency and solving the technical problem of low object query efficiency. Attached Figure Description

[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic diagram of an application environment for an optional index creation method according to an embodiment of this application; Figure 2 This is a flowchart illustrating an optional index creation method according to an embodiment of this application; Figure 3 This is a schematic diagram of an optional multiple clustering method according to an embodiment of this application; Figure 4 This is a schematic diagram of an optional tree structure according to an embodiment of this application; Figure 5 This is a schematic diagram of another optional tree structure according to an embodiment of this application; Figure 6 This is a schematic diagram of an optional newly added object according to an embodiment of this application; Figure 7 This is a flowchart of another optional index creation method according to an embodiment of this application; Figure 8 This is a schematic diagram of an optional index creation apparatus according to an embodiment of this application. Detailed Implementation

[0022] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0024] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for an index creation method according to an embodiment of the present invention. For example... Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0025] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the ground point cloud determination method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0026] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0027] This embodiment provides a method for creating an index that runs on the aforementioned mobile terminal. Figure 2 This is a flowchart of an index creation method according to an embodiment of the present invention, such as... Figure 2As shown, the process includes the following steps: Step S202: Obtain a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; The objects in the target object set mentioned above can be spatial objects (e.g., cameras, snap-fit ​​channels), etc. The target object set can be C = {c1, c2, c3, ..., cn}, where ci (i = 1, 2, ..., n) is the i-th spatial object in the target object set. If a spatial cluster si contains only one spatial object ci, then si is a spatial cluster containing only one spatial object ci, ci.mbr = si.mbr (mbr is the minimum bounding box), and n is the number of spatial objects in the target object set C.

[0028] Step S204: Perform clustering processing on the N objects in the target object set to obtain the clustering result; Clustering N objects can result in one or more clusters. A maximum threshold M can be set for the number of objects in a cluster. When N is less than or equal to M, N objects are clustered into one cluster. When N is greater than M, N objects can be clustered into multiple clusters. M and N can be set according to specific needs, such as 3, 5, 10, or 30.

[0029] Step S206: Create a target index for the target object among the N objects based on the clustering results.

[0030] An index can be constructed using root nodes and child nodes. If the root node is root and the target object ci is a child node of the root node root, then the index of the target object ci can be root-ci.

[0031] Through the above steps, N objects in the target object set are clustered to obtain clustering results, and a target index is created for the target objects among the N objects based on the clustering results. Thus, when searching for a target object in the target object set, the target object can be found through the target index, thereby improving the technical effect of object query efficiency and solving the technical problem of low object query efficiency.

[0032] Optionally, clustering the N objects in the target object set to obtain a clustering result includes: when N is less than or equal to M, clustering the N objects into a target cluster, where M is a preset threshold and M is greater than 0; determining the target cluster as the clustering result; and creating a target index for the target object among the N objects based on the clustering result includes: determining a target root node for the target object set, and determining each of the N objects as a child node of the target root node, thus obtaining N child nodes corresponding to the target root node; obtaining the target child node corresponding to the target object from the N child nodes; and determining the target index of the target object through the target root node and the target child nodes.

[0033] As an optional implementation, a threshold M is set (the value of M can be set according to the actual situation) to represent the maximum number of child nodes contained in a non-leaf node. That is, the maximum number of objects contained in a cluster is the threshold. γ = N / M, indicating that the target object set C needs to be divided into γ clusters. If n ≤ m, γ = 1, then the target object set C is clustered into a single target cluster.

[0034] The target object set C is clustered into a root node, and each object in the target object set becomes a child node of the root node. Since ci is a child node of the root, the index is constructed, and the target index for the target object ci can be constructed as root-ci. In this way, each object in the target object set can have a unique index, allowing for quick retrieval of each object.

[0035] As another optional implementation, taking a target object set containing N cameras as an example, the cameras can be clustered according to their location (latitude and longitude). When N is less than or equal to M, the N cameras can be clustered into a target cluster, with root as the root node and each camera as a child node of root. Taking the target object as camera ci as an example, an index of camera ci can be constructed through the root node root and child nodes ci (e.g., root-ci). In this way, camera ci can be quickly found among multiple cameras through the index, improving the search speed.

[0036] Optionally, clustering the N objects in the target object set to obtain clustering results includes: performing multiple clustering processes on the N objects when N is greater than M, until a preset condition is met, and then stopping the clustering process to obtain multiple clustering results; creating a target index for the target object among the N objects based on the clustering results includes: creating a target index for the target object among the N objects based on the multiple clustering results.

[0037] As an alternative implementation, if N > M, then γ > 1. (Setting) , representing the number of clusters divided along the longitude (x) and latitude (y) directions. The target object set C is sorted in ascending order along the x-direction by ci.mbr.minx, and then divided into ε clusters along the x-direction on an even basis. Then, each result is sorted along the y-direction by ci.mbr.miny and divided into ε clusters on an even basis. Assume that the two divisions generate K clusters, where k is greater than or equal to γ, i.e., γ ≤ k < N. The above preset condition can be that the number of objects in each of the K clusters is less than or equal to a preset threshold M. If the number of objects in a certain cluster of the K clusters exceeds the preset threshold M, clustering processing continues for that cluster until the number of objects in each of the divided clusters is less than or equal to the preset threshold M. In this way, each object in the target object set is indexed, allowing for quick retrieval of each object through the index.

[0038] As an optional implementation, Figure 3 For example, suppose the preset condition is that the number of objects in each cluster is less than or equal to a preset threshold M, where M=4. As shown in the figure, in the first clustering operation, clusters R1, R2, and R3 are obtained. The number of objects in R1, R2, and R3 is greater than 4. Then, clustering is performed on clusters R1, R2, and R3 (the second clustering operation) to obtain clusters R4, R5, R6, R7, R8, R9, and R10. The number of objects in R4, R5, R6, R7, R8, R9, and R10 is less than or equal to 4, so the clustering process stops.

[0039] Optionally, when N is greater than M, multiple clustering processes are performed on the N objects until a preset condition is met, at which point the clustering process is stopped, resulting in multiple clustering results. This includes: in the (i-1)th clustering result, if the number of objects in the first cluster is greater than a preset threshold M, performing an i-th clustering process on the first cluster to obtain an i-th clustering result, where the (i-1)th clustering result is the clustering result obtained by performing the (i-1)th clustering process on the target object set, and i is greater than 1; if the number of objects in each cluster in the i-th clustering result is less than or equal to the preset threshold M, it is determined that the preset condition is met, and the clustering process is stopped, resulting in the multiple clustering results.

[0040] As an optional implementation, Figure 3 For example, the clustering result of the (i-1)th time mentioned above can be Figure 3The first clustering operation shown in the diagram yields clusters R1, R2, and R3. Since the number of objects in each of these clusters is greater than the preset threshold M=4, further clustering is performed on clusters R1, R2, and R3 (the second clustering operation corresponds to the i-th clustering operation), resulting in clusters R4, R5, R6, R7, R8, R9, and R10. If the number of objects in each of R4, R5, R6, R7, R8, R9, and R10 is less than or equal to the preset threshold M=4, then the clustering process is stopped.

[0041] Optionally, performing the i-th clustering process on the first cluster to obtain the i-th clustering result includes: obtaining the coordinate position of each object in the first cluster, wherein the coordinate position includes longitude and latitude; and performing clustering on each object in the first cluster in the longitude and latitude directions respectively to obtain the i-th clustering result.

[0042] As an alternative implementation, clustering can be performed on each object according to its coordinate position (longitude, latitude) in both the longitude and latitude directions to obtain the clustering results.

[0043] Optionally, creating a target index for the target object among the N objects based on the multiple clustering results includes: when the number of objects contained in each cluster in the i-th clustering result is less than or equal to the preset threshold M, determining the target object set as the target root node, the (i-1)-th clustering result as the (i-1)-th level child node, the i-th clustering result as the i-th level child node, and each object contained in each cluster in the i-th clustering result as the (i+1)-th level child node; determining the (i-1)-th level target child node corresponding to the target object in the (i-1)-th level child node, determining the i-th level target child node corresponding to the target object in the i-th level child node, and determining the (i+1)-th level target child node corresponding to the target object in the (i+1)-th level child node; and determining the target index of the target object through the target root node, the (i-1)-th level target child node, the i-th level target child node, and the (i+1)-th level target child node.

[0044] As an optional implementation, Figure 3 For example, constructing such Figure 4The tree structure shown has a root node (root), child nodes at level (i-1) including R1, R2, and R3, child nodes at level (i) including R4, R5, R6, R7, R8, R9, and R10, and child nodes at level (i+1) including nodes 1 through 20. Taking target object 1 as an example, its index is root - R4 - 1. Taking target object 3 as an example, its indices are root - R4 - 3 and root - R5 - 3. Thus, each object in the target object set has an index, allowing the target object to be found using this index.

[0045] Optionally, after creating a target index for the target object among the N objects based on the clustering result, the method further includes: searching for the target object in the target object set based on the target index; and performing a modification or deletion operation on the target object if the target object is found.

[0046] As an optional implementation, the above-mentioned target object is used as... Figure 4 Taking object 1 as an example, it can be found using root-R4-1, and then modified or deleted. Taking deletion as an example, after finding object 1 using root-R4-1, you can directly... Figure 4 The tree structure shown deletes object 1 from node R4. This improves object lookup speed due to the improved indexing, thus increasing object processing speed.

[0047] Optionally, performing a modification operation on the target object includes: modifying the target coordinate position of the target object to obtain a modified target object; adding the modified target object to a virtual object set; and deleting the target object from the target object set.

[0048] As an optional implementation, the virtual object set can be a CV (Collection of Objects). The number of objects contained in the virtual object set can be set to a threshold v. The size of the threshold v can be determined according to the actual situation, such as 5, 10, 15, etc. Objects can be dynamically added, deleted, and modified in the virtual object set CV.

[0049] As an optional implementation, the above-mentioned target object is used as... Figure 4 Taking object 1 as an example, object 1, as a spatial object, has coordinate position information, which can be represented by latitude and longitude. The coordinate position of object 1 can be modified, for example, by changing the longitude and latitude. Assuming that object 1 is modified to obtain object Rv, then the target object in the target object set can be deleted, for example, by deleting... Figure 4 Object 1 under node R4 is modified and its resulting object Rv is added to the virtual object collection CV. Then, CV is aggregated into... Figure 4 At the root node, if CV contains only one object Rv, Rv can be directly aggregated. Figure 4 On the root node, get Figure 5 The tree structure shown.

[0050] Optionally, after adding the modified target object to the virtual object set and deleting the target object from the target object set, the method further includes: determining the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is the first child node of the target root node; and determining the index of the modified target object through the target root node and the first child node.

[0051] As an optional implementation, such as Figure 5 In the tree structure shown, Rv is the first child node of the target root node, and root-Rv is the index of the modified target object. The modified object can be found through this index.

[0052] Optionally, the method further includes: adding the first object to a virtual object set when a new first object is added; determining the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is a second child node of the target root node; and determining the index of the first object through the target root node and the second child node.

[0053] As an optional implementation, such as Figure 6 As shown, taking the addition of a new first object, Rv, as an example, Rv is added to the virtual object collection CV, and CV is made the second child node of the root node. The index of the newly added object Rv is root-CV-Rv. If CV contains only one object Rv, Rv can be directly aggregated to the root node, and the index of the newly added object Rv is root-Rv.

[0054] As an optional implementation, such as Figure 7As shown in the flowchart, in existing technologies, when new objects need to be inserted into an existing set of geometric objects to be constructed (the target object set), insufficient space in the leaf nodes necessitates splitting. This requires significant time to rebuild the relevant child node indexes, leading to lag during queries. This application addresses the issue of adding, modifying, and deleting geometric objects after the index construction is complete by simultaneously building an index on the objects in the target object set and pre-setting virtual objects. By constructing virtual objects, the added, modified, and deleted objects do not affect the constructed index and do not require splitting to insert into leaf nodes. They can be directly inserted into the virtual object set, enabling uninterrupted and efficient queries.

[0055] It should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0056] According to another aspect of the embodiments of this application, an index creation apparatus for implementing the above-described index creation method is also provided. For example... Figure 8 As shown, the device includes: an acquisition module 82, used to acquire a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; a processing module 84, used to perform clustering processing on the N objects in the target object set to obtain a clustering result; and a creation module 86, used to create a target index for the target objects among the N objects based on the clustering result.

[0057] Optionally, the above apparatus is further configured to: cluster the N objects into a target cluster when N is less than or equal to M, wherein M is a preset threshold and M is greater than 0; determine the target cluster as the clustering result; and create a target index for the target object among the N objects based on the clustering result, comprising: determining a target root node for the set of target objects, and determining each of the N objects as a child node of the target root node, thereby obtaining N child nodes corresponding to the target root node; obtaining the target child node corresponding to the target object from the N child nodes; and determining the target index of the target object through the target root node and the target child node.

[0058] Optionally, the above-described apparatus is further configured to: when N is greater than M, perform multiple clustering processes on the N objects until a preset condition is met, and then stop the clustering process to obtain multiple clustering results; the step of creating a target index for the target object among the N objects based on the clustering results includes: creating a target index for the target object among the N objects based on the multiple clustering results.

[0059] Optionally, the above-described apparatus is further configured to: in the multiple clusters of the (i-1)th clustering result, if the number of objects contained in the first cluster is greater than a preset threshold M, perform the i-th clustering process on the first cluster to obtain the i-th clustering result, wherein the (i-1)th clustering result is the clustering result obtained by performing the (i-1)th clustering process on the target object set, and i is greater than 1; if the number of objects contained in each cluster of the i-th clustering result is less than or equal to the preset threshold M, determine that the preset condition is met, and stop the clustering process to obtain the multiple clustering results.

[0060] Optionally, the above-described apparatus is further configured to: obtain the coordinate position of each object in the first cluster, wherein the coordinate position includes longitude and latitude; and cluster each object in the first cluster in the longitude and latitude directions respectively to obtain the i-th clustering result.

[0061] Optionally, the above apparatus is further configured to: when the number of objects contained in each cluster in the i-th clustering result is less than or equal to the preset threshold M, determine the target object set as the target root node, the (i-1)-th clustering result as the (i-1)-th level child node, the i-th clustering result as the i-th level child node, and each object contained in each cluster in the i-th clustering result as the (i+1)-th level child node; determine the (i-1)-th level target child node corresponding to the target object in the (i-1)-th level child node, determine the i-th level target child node corresponding to the target object in the i-th level child node, and determine the (i+1)-th level target child node corresponding to the target object in the (i+1)-th level child node; and determine the target index of the target object through the target root node, the (i-1)-th level target child node, the i-th level target child node, and the (i+1)-th level target child node.

[0062] Optionally, the above apparatus is further configured to: after creating a target index for the target object among the N objects based on the clustering result, search for the target object in the target object set according to the target index; and if the target object is found, perform a modification or deletion operation on the target object.

[0063] Optionally, the above-described apparatus is further configured to: modify the target coordinate position of the target object to obtain a modified target object; add the modified target object to a virtual object set, and delete the target object from the target object set.

[0064] Optionally, the above apparatus is further configured to: after adding the modified target object to the virtual object set and deleting the target object from the target object set, determine the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is the first child node of the target root node; and determine the index of the modified target object through the target root node and the first child node.

[0065] Optionally, the above apparatus is further configured to: add the first object to a virtual object set when a new first object is added; determine the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is a second child node of the target root node; and determine the index of the first object through the target root node and the second child node.

[0066] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0067] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.

[0068] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps: S1, Obtain a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; S2, perform clustering processing on the N objects in the target object set to obtain the clustering result; S3, create a target index for the target object among the N objects based on the clustering results.

[0069] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0070] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0071] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0072] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program: S1, Obtain a target object set, wherein the target object set includes N objects, and N is greater than or equal to 1; S2, perform clustering processing on the N objects in the target object set to obtain the clustering result; S3, create a target index for the target object among the N objects based on the clustering results.

[0073] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0074] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0075] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for creating an index, characterized in that, include: Obtain a target object set, wherein the target object set includes N objects, where N is greater than or equal to 1, and the N objects include spatial objects, which include objects whose geographical locations need to be dynamically maintained; Clustering is performed on the N objects in the target object set to obtain the clustering result; Based on the clustering results, a target index is created for the target object among the N objects; After creating a target index for the target object among the N objects based on the clustering result, the method further includes: searching for the target object in the target object set according to the target index; and performing a modification or deletion operation on the target object if the target object is found. Performing a modification operation on the target object includes: modifying the target coordinate position of the target object to obtain a modified target object; adding the modified target object to a virtual object set and deleting the target object from the target object set, wherein the virtual object set is constructed at the same time as the target index is created; After adding the modified target object to the virtual object set and deleting the target object from the target object set, the method further includes: determining the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is the first child node of the target root node; and determining the index of the modified target object through the target root node and the first child node.

2. The method according to claim 1, characterized in that, Clustering the N objects in the target object set to obtain a clustering result includes: when N is less than or equal to M, clustering the N objects into a target cluster, where M is a preset threshold and M is greater than 0; and determining the target cluster as the clustering result. The step of creating a target index for a target object among N objects based on the clustering result includes: determining a target root node for the set of target objects, and determining each of the N objects as a child node of the target root node to obtain N child nodes corresponding to the target root node; obtaining the target child node corresponding to the target object from the N child nodes; and determining the target index of the target object through the target root node and the target child nodes.

3. The method according to claim 1, characterized in that, Clustering the N objects in the target object set to obtain clustering results includes: when N is greater than M, performing multiple clustering processes on the N objects until a preset condition is met, then stopping the clustering process to obtain multiple clustering results; Creating a target index for a target object among N objects based on the clustering results includes: creating a target index for the target object among the N objects based on the multiple clustering results.

4. The method according to claim 3, characterized in that, When N is greater than M, the N objects are subjected to multiple clustering processes until a preset condition is met, at which point the clustering process stops, resulting in multiple clustering results, including: In the multiple clusters of the i-1th clustering result, if the number of objects contained in the first cluster is greater than a preset threshold M, the first cluster is subjected to the i-th clustering process to obtain the i-th clustering result. The i-1th clustering result is the clustering result obtained by performing the i-1th clustering process on the target object set, where i is greater than 1. If the number of objects in each cluster in the i-th clustering result is less than or equal to the preset threshold M, the preset condition is satisfied, and the clustering process is stopped to obtain the multiple clustering results.

5. The method according to claim 4, characterized in that, Perform the i-th clustering process on the first cluster to obtain the i-th clustering result, including: Obtain the coordinate position of each object in the first cluster, wherein the coordinate position includes longitude and latitude; Clustering is performed on each object in the first cluster along both the longitude and latitude directions to obtain the i-th clustering result.

6. The method according to claim 4, characterized in that, The step of creating a target index for the target object among the N objects based on the multiple clustering results includes: If the number of objects contained in each cluster in the i-th clustering result is less than or equal to the preset threshold M, then the target object set is determined as the target root node, the (i-1)-th clustering result is determined as the (i-1)-th level child node, the i-th clustering result is determined as the i-th level child node, and each object contained in each cluster in the i-th clustering result is determined as the (i+1)-th level child node. In the (i-1)th level child node, the target child node corresponding to the target object is determined; in the i-th level child node, the target child node corresponding to the target object is determined; and in the (i+1)th level child node, the target child node corresponding to the target object is determined. The target index of the target object is determined by the target root node, the (i-1)th level target child node, the i-th level target child node, and the (i+1)th level target child node.

7. The method according to claim 1, characterized in that, The method further includes: If a first object is added, the first object is added to the virtual object collection; The virtual object set and the target object set are respectively determined as child nodes of the target root node, wherein the virtual object set is the second child node of the target root node; The index of the first object is determined by the target root node and the second child node.

8. An index creation apparatus, characterized in that, include: The acquisition module is used to acquire a set of target objects, wherein the set of target objects includes N objects, where N is greater than or equal to 1, and the N objects include spatial objects, which include objects whose geographical locations need to be dynamically maintained. The processing module is used to perform clustering processing on the N objects in the target object set to obtain the clustering result; A creation module is used to create a target index for the target object among the N objects based on the clustering results; The apparatus is further configured to: after creating a target index for a target object among N objects based on the clustering result, search for the target object in the target object set based on the target index; and if the target object is found, perform a modification or deletion operation on the target object; The device is further configured to: modify the target coordinate position of the target object to obtain a modified target object; add the modified target object to a virtual object set and delete the target object from the target object set, wherein the virtual object set is constructed at the same time as the target index is created; The apparatus is further configured to: after adding the modified target object to the virtual object set and deleting the target object from the target object set, determine the virtual object set and the target object set as child nodes of the target root node, wherein the virtual object set is the first child node of the target root node; and determine the index of the modified target object through the target root node and the first child node.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or computer at runtime as described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1 to 7.

11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Space object indexing and querying method under multi-objective optimization

    CN110580252A