Picture retrieval method and device, storage medium and electronic device
Patent Information
- Application Number
- CN202211015767.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-08-23
AI Technical Summary
[0031]This application provides an image retrieval method. First, at least one target image feature point is extracted from a target image. Then, feature point quantization encoding is performed on each target image feature point based on a feature point code table to obtain the target quantization value of each feature point. Next, based on each target quantization value and a shared image index, the retrieval result corresponding to the target image is determined. By pre-quantizing and encoding the sample image feature points in each sample image according to the feature point code table, and constructing a shared image index based on the sample quantization values of each sample image feature point, after extracting the target image feature points of the target image, the same method can be used to quantize and encode each target image feature point according to the feature point code table to obtain the target quantization value. Then, the sample image corresponding to the target quantization value is searched in the shared image index, thus obtaining the retrieval result corresponding to the target image. Since the computational cost of quantization encoding is much less than the computational cost of directly comparing feature points in sample images and target images, the computational cost when retrieving similar images can be reduced, effectively improving the retrieval speed when retrieving similar images.
Smart Images

Figure CN117668270B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image retrieval method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the development of science and technology, people's need for various images is increasing. One important scenario is that users need to find similar images or related information about an existing image. This requires finding images that are similar (visually identical) to an existing image in a preset image set based on the image provided by the user, and then returning the found images or related information to the user. Therefore, it is necessary to propose an image retrieval method to meet people's needs for image processing. Summary of the Invention
[0003] This application provides an image retrieval method, apparatus, storage medium, and electronic device, which can reduce the computational load when retrieving similar images and effectively improve the retrieval speed when retrieving similar images.
[0004] In a first aspect, embodiments of this application provide an image retrieval method, the method comprising:
[0005] At least one target image feature point is extracted from the target image. Feature point quantization encoding is performed on each target image feature point based on a feature point code table to obtain the target quantization value of each target image feature point. Based on each target quantization value and a common image index, the retrieval result corresponding to the target image is determined. The common image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by feature point quantization encoding based on the feature point code table.
[0006] Optionally, before extracting at least one target image feature point from the target image, the method further includes: acquiring at least one sample image and extracting sample image feature points from each sample image; quantizing and encoding each sample image feature point based on a feature point code table to obtain sample quantization values for each sample image feature point; and constructing a common graph index based on each sample quantization value and the number of the sample image corresponding to each sample quantization value.
[0007] Optionally, before quantizing and encoding the feature points of each sample image based on the feature point code table, the method further includes: clustering the feature points of each sample image to obtain at least one cluster set; calculating the cluster center point of each cluster set based on the sample image feature points included in each cluster set; and constructing a feature point code table based on the relationship between the cluster center points and the number of each cluster center point.
[0008] Optionally, the step of quantizing and encoding the feature points of each sample image based on the feature point code table to obtain the sample quantization value of each sample image feature point includes: finding the target cluster center point that matches the feature points of each sample image among the cluster center points included in the feature point code table; and quantizing and encoding the feature points of each sample image according to the number corresponding to each target cluster center point to obtain the sample quantization value of each sample image feature point.
[0009] Optionally, the step of constructing a common graph index based on the quantization values of each sample and the number of the sample image corresponding to each quantization value includes: constructing inverted keywords based on the quantization values of each sample, and constructing an inverted list based on the number of the sample image to which the feature points of the sample image corresponding to each quantization value belong; constructing an inverted index structure based on each inverted keyword and the inverted list corresponding to each inverted keyword, and obtaining a common graph index based on the inverted index structure.
[0010] Optionally, the step of clustering the feature points of each sample image to obtain at least one cluster set includes: performing hierarchical clustering on the feature points of each sample image to obtain a first preset number of clustering layers, each clustering layer including at least one cluster set; wherein, the top clustering layer includes a second preset number of cluster sets, and when clustering from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster set in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
[0011] Optionally, the step of finding the target cluster center point that matches the feature points of each sample image among the cluster center points included in the feature point code table includes: searching for cluster center points that match the feature points of each sample image from top to bottom according to the relationship between the cluster center points of each sample image code table; and taking the cluster center point that matches the feature points of each sample image and is located at the bottom layer as the target cluster center point that matches the feature points of each sample image.
[0012] Optionally, determining the retrieval result corresponding to the target image based on each target quantization value and the same graph index includes: searching for the target sample quantization value that is the same as each target quantization value in the same graph index; obtaining the number of the target sample image corresponding to each target sample quantization value; and determining the retrieval result corresponding to the target image based on the number of times the number of each target sample image is hit.
[0013] Optionally, determining the search result corresponding to the target image based on the number of hits of each target sample image number includes: comparing the number of hits of each target sample image number with a preset number of hits, and taking the target sample image with a number of hits greater than or equal to the preset number of hits as the search result corresponding to the target image.
[0014] Optionally, the number of sample image feature points in each sample image is a third preset number.
[0015] Secondly, embodiments of this application provide an image retrieval device, the device comprising:
[0016] The feature quantization module is used to extract at least one feature point of the target image, and to perform feature point quantization encoding on each feature point of the target image based on the feature point code table to obtain the target quantization value of each feature point of the target image.
[0017] The index retrieval module is used to determine the retrieval results corresponding to the target image based on each target quantization value and the same image index;
[0018] The identical image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by feature point quantization encoding based on the feature point code table.
[0019] Optionally, the apparatus further includes: a sample feature point acquisition module, used to acquire at least one sample image and extract sample image feature points from each sample image; a sample feature point quantization module, used to quantize and encode the feature points of each sample image based on a feature point code table to obtain sample quantization values of each sample image feature point; and an index construction module, used to construct a common image index based on each sample quantization value and the number of the sample image corresponding to each sample quantization value.
[0020] Optionally, the apparatus further includes: a sample clustering module for clustering feature points of each sample image to obtain at least one cluster set; a cluster center calculation module for calculating the cluster center point of each cluster set based on the sample image feature points included in each cluster set; and a cluster code table construction module for constructing a feature point code table based on the relationship between each cluster center point and the number of each cluster center point.
[0021] Optionally, the sample feature point quantization module is further configured to search for the target cluster center point that matches the feature points of each sample image in the cluster center points included in the feature point code table; and to quantize and encode the feature points of each sample image according to the number corresponding to each target cluster center point to obtain the sample quantization value of each sample image feature point.
[0022] Optionally, the index building module is further configured to build inverted keywords based on the quantization values of each sample, and to build an inverted list based on the number of the sample image to which the feature points of the sample image corresponding to each quantization value belong; to build an inverted index structure based on each inverted keyword and the inverted list corresponding to each inverted keyword, and to obtain the same graph index based on the inverted index structure.
[0023] Optionally, the sample clustering module is further configured to perform hierarchical clustering on the feature points of each sample image to obtain a first preset number of clustering layers, each clustering layer including at least one cluster set; wherein, the top clustering layer includes a second preset number of cluster sets, and when clustering is performed from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster set in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
[0024] Optionally, the sample feature point quantization module is further configured to search for cluster centers that match the feature points of each sample image from top to bottom according to the relationship between the cluster centers of each cluster in the feature point code table; and to use the cluster centers that match the feature points of each sample image and are located at the bottom layer as the target cluster centers for matching the feature points of each sample image.
[0025] Optionally, the index retrieval module is further configured to search for target sample quantization values that are the same as each target quantization value in the same graph index; obtain the number of the target sample image corresponding to each target sample quantization value; and determine the retrieval result corresponding to the target image based on the number of times the number of each target sample image is hit.
[0026] Optionally, it is also used to compare the number of times each target sample image's number is hit with a preset number of hits, and to take the target sample image with a number of hits greater than or equal to the preset number of hits as the retrieval result corresponding to the target image.
[0027] Optionally, the number of sample image feature points in each sample image is a third preset number.
[0028] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of the method described above.
[0029] Fourthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described above.
[0030] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following:
[0031] This application provides an image retrieval method. First, at least one target image feature point is extracted from a target image. Then, feature point quantization encoding is performed on each target image feature point based on a feature point code table to obtain the target quantization value of each feature point. Next, based on each target quantization value and a shared image index, the retrieval result corresponding to the target image is determined. By pre-quantizing and encoding the sample image feature points in each sample image according to the feature point code table, and constructing a shared image index based on the sample quantization values of each sample image feature point, after extracting the target image feature points of the target image, the same method can be used to quantize and encode each target image feature point according to the feature point code table to obtain the target quantization value. Then, the sample image corresponding to the target quantization value is searched in the shared image index, thus obtaining the retrieval result corresponding to the target image. Since the computational cost of quantization encoding is much less than the computational cost of directly comparing feature points in sample images and target images, the computational cost when retrieving similar images can be reduced, effectively improving the retrieval speed when retrieving similar images. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 An exemplary system architecture diagram of an image retrieval method provided in this application embodiment;
[0034] Figure 2 A flowchart illustrating an image retrieval method according to another embodiment of this application;
[0035] Figure 3 A flowchart illustrating an image retrieval method according to another embodiment of this application;
[0036] Figure 4 A schematic diagram of hierarchical clustering provided for another embodiment of this application;
[0037] Figure 5 This application provides a schematic diagram illustrating the construction of a similar graph index according to another embodiment of the present application.
[0038] Figure 6 This application provides a schematic diagram of a similar image retrieval method according to another embodiment of the present application.
[0039] Figure 7 A schematic diagram of the structure of an image retrieval device provided in another embodiment of this application;
[0040] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0041] To make the features and advantages of the embodiments of this application more apparent and understandable, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the embodiments of this application.
[0042] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0043] In image search services, a crucial scenario is when a user searches for information about an existing image. This scenario, after technical breakdown, becomes a problem of finding identical images. Specifically, based on the image provided by the user, the system finds images in the image set that are identical (visually similar) and returns the relevant information of those identical images to the user, thus satisfying their needs.
[0044] Commonly used methods for retrieving identical graphs include the perceptual hash algorithm, the histogram method, and keypoint matching algorithms.
[0045] Perceptual hashing algorithms, such as pHash, aHash, and dHash, calculate image similarity by downsampling, transforming, and binarizing images into fixed-length hash codes, and then calculating the Hamming distance between the hash codes of the images. Their applicability is limited to determining the similarity of images at different scaling ratios. However, they cannot determine if an image after rotation or translation is the same as the image before the transformation, thus failing to meet the requirement of identifying identical images.
[0046] Histogram-based statistical algorithms convert images to grayscale, count the number of grayscale values within different ranges, normalize them, and then calculate the distance. However, this process loses spatial location information of the image, resulting in insufficient precision in image similarity assessments and failing to meet the requirement of identifying identical images.
[0047] Keypoint matching algorithms search for keypoints (feature points) across different scales. Based on these feature points, the process of finding identical images can be transformed into a feature point matching process. When the number of matching feature points between two images reaches a certain threshold, the two images can be considered identical. However, because keypoint matching algorithms need to compare each image in the image set with all images individually, the algorithm complexity is high, resulting in a time-consuming image retrieval process, making it impractical for large-scale image search applications.
[0048] To address the aforementioned technical issues, this application provides an image retrieval method. This method pre-quantizes and encodes the feature points of each sample image according to a feature point code table, and constructs a shared image index based on the quantized values of the feature points of each sample image. After extracting the target image feature points from the target image, the method can also quantize and encode the target image feature points according to the feature point code table to obtain the target quantization value. Then, it searches for the sample image corresponding to the target quantization value in the shared image index, thus obtaining the retrieval result for the target image. Since the computational cost of quantization encoding is much less than that of directly comparing the feature points in the sample and target images, this method reduces the computational cost when retrieving similar images and effectively improves the retrieval speed.
[0049] Figure 1 This is an exemplary system architecture diagram of an image retrieval method provided in an embodiment of this application.
[0050] like Figure 1 As shown, the system architecture may include user 101, electronic device 102, network 103, and server 104. Network 103 serves as the medium for providing a communication link between electronic device 102 and server 104. Network 103 may include various types of wired or wireless communication links, such as wired communication links including fiber optic cables, twisted-pair cables, or coaxial cables, and wireless communication links including Wireless-Fidelity (Wi-Fi) communication links or microwave communication links.
[0051] Electronic device 102 can interact with server 104 via network 103 to receive messages from server 104 or send messages to server 104. Electronic device 102 can be hardware or software. When electronic device 102 is hardware, it can be various electronic devices, including but not limited to smartwatches, smartphones, tablets, laptops, and desktop computers. When electronic device 102 is software, it can be installed in the electronic devices listed above, and it can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module; no specific limitation is made here.
[0052] In this embodiment, the electronic device 102 can first extract at least one target image feature point from the target image, and then perform feature point quantization encoding on each target image feature point based on the feature point code table to obtain the target quantization value of each target image feature point; then, based on each target quantization value and the same image index, determine the retrieval result corresponding to the target image; wherein, the same image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value, and each sample quantization value is obtained by feature point quantization encoding based on the feature point code table.
[0053] Server 104 can be a business server providing various services. It should be noted that server 104 can be either hardware or software. When server 104 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 104 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module; no specific limitations are made here.
[0054] It should be understood that Figure 1 The number of users, electronic devices, networks, and servers shown is only illustrative and can be any number of users, electronic devices, networks, and servers depending on the implementation needs.
[0055] Please see Figure 2 , Figure 2 This is a flowchart illustrating an image retrieval method according to another embodiment of this application. It is understood that the execution entity in this embodiment can be a terminal or a processor within the terminal. The following describes the specific implementation process of the image retrieval method using a processor as the execution entity as an example. Figure 2 As shown, the method includes:
[0056] S201. Extract at least one target image feature point from the target image, and perform feature point quantization encoding on each target image feature point based on the feature point code table to obtain the target quantization value of each target image feature point.
[0057] In this embodiment, a feature point code table can be pre-constructed. The feature point code table is constructed based on the feature points in the sample images. The feature point code table includes the feature points in the sample images and the number of each sample feature point. When the processor obtains the target image for which similar image retrieval is required, it can first extract at least one target image feature point. The target image feature point can be a key point of the target image at different scale spaces. These points (such as corner points, edge points, bright spots in dark areas and dark spots in bright areas) will not change due to factors such as illumination, affine transformation and noise.
[0058] Optionally, the method for extracting feature points from the target image is not limited. One feasible implementation is to extract the position, scale, and rotation invariants of the target image as SIFT feature points based on the SIFT algorithm. SIFT features are interest points based on some local appearances of the object, which are independent of the size and rotation of the target image and have a high tolerance for lighting, noise, and slight changes in perspective. Therefore, using SIFT feature points as feature points in the target image can make the image retrieval method very robust.
[0059] Since feature points are usually high-dimensional vectors, directly comparing the target image with sample images in the database would result in a large computational load for the similar image retrieval process. Therefore, after obtaining all the feature points of the target image, feature point quantization encoding can be performed on each target image feature point based on a pre-constructed feature point code table. The feature point quantization encoding process is also the process of converting all the target image feature points from high-dimensional vectors into low-byte integers, thereby obtaining the target quantization value after feature point quantization encoding of each target image feature point.
[0060] S202. Based on the quantization values of each target and the index of the same image, determine the retrieval results corresponding to the target image.
[0061] In this embodiment, a shared graph index can be pre-constructed. This index includes at least one sample quantization value. Each sample quantization value is obtained by quantizing and encoding the sample image feature points based on a feature point code table after extracting the feature points from the sample image. The shared graph index also includes the sample image number corresponding to each sample quantization value. Therefore, after obtaining the target quantization values of the feature points of each target image, the retrieval results corresponding to the target image can be determined based on the relationship between the shared graph index and each target quantization value.
[0062] Specifically, in determining the search results corresponding to a target image based on each target quantization value and the same graph index, the process begins by searching for the target sample quantization value that is identical to each target quantization value in the same graph index. Then, the ID of the target sample image corresponding to each target sample quantization value is obtained. The search results corresponding to the target image are determined based on the number of times each target sample image ID is hit. In determining the search results corresponding to the target image based on the number of times each target sample image ID is hit, the number of hits can be compared with a preset number of hits. Target sample images with a number of hits greater than or equal to the preset number of hits are taken as the search results corresponding to the target image. After obtaining the search results corresponding to the target image, the search results, i.e., the target sample images, can be displayed.
[0063] In this embodiment, at least one target image feature point is first extracted from the target image. Based on a feature point code table, each target image feature point is quantized and encoded to obtain a target quantized value. Then, based on the target quantized values and the same graph index, the retrieval result corresponding to the target image is determined. By pre-quantizing and encoding the sample image feature points in each sample image according to the feature point code table, and constructing a same graph index based on the sample quantized values of the sample image feature points, after extracting the target image feature points of the target image, the same quantized values can be obtained by quantizing and encoding each target image feature point according to the feature point code table. Then, the sample image corresponding to the target quantized value is searched in the same graph index, thus obtaining the retrieval result corresponding to the target image. Since the computational cost of quantization encoding is much less than that of directly comparing feature points in sample images and target images, the computational cost when retrieving similar images can be reduced, effectively improving the retrieval speed when retrieving similar images.
[0064] Please see Figure 3 , Figure 3 This is a flowchart illustrating an image retrieval method according to another embodiment of this application.
[0065] like Figure 3 As shown, the method includes:
[0066] S301. Obtain at least one sample image and extract the sample image feature points of each sample image.
[0067] As is understandable, sample images serve as the data source for similar image retrieval. Therefore, similar image retrieval of the target image means retrieving similar images from all sample images. In the process of constructing the feature point code table, it is first necessary to obtain at least one sample image as the data source, and then extract the sample image feature points of each sample image. For the extraction of sample image feature points, please refer to the method for extracting at least one target image feature point of the target image in the above embodiment.
[0068] For example, in this embodiment, the SIFT algorithm is also used to extract sample image feature points from each sample image. Through the SIFT algorithm, a different number of SIFT feature points (sample image feature points) can be extracted from each sample image. Each feature point is represented by a 128-dimensional (this dimension is optimal) float type vector. Since the set of sample images is large, in this embodiment, Hadoop's MapReduce task is used to extract image features to shorten the computation time. A threshold for the number of SIFT feature points can be set. For example, the number of sample image feature points in each sample image is a third preset number to limit the number of SIFT feature points and thus save storage space.
[0069] After obtaining the feature points of each sample image, in order to reduce the amount of data in the process of constructing the feature point code table and improve the subsequent calculation process of quantizing and encoding the feature points of each target image based on the feature point code table, the feature points of each sample image can be clustered to obtain at least one cluster set. The clustering process is to divide the sample image feature points with the same characteristics into the same cluster set, so each cluster set includes at least one sample image feature point.
[0070] Optionally, in the process of clustering the feature points of each sample image, a feasible implementation method is to first perform hierarchical clustering on the feature points of each sample image. In this hierarchical clustering process, the number of clustering layers is set to a first preset number, and the number of cluster centers in each clustering layer is set to a second preset number. The first preset number and the second preset number can be set according to the number of sample images (for example, for a set of one billion sample images, setting the number of clustering layers to 3 and the number of cluster centers to 100 can achieve better results). Therefore, after performing hierarchical clustering on the feature points of each sample image, the first preset number of clustering layers can be obtained. Each clustering layer includes at least one cluster set. Specifically, the top clustering layer includes the second preset number of cluster sets. When clustering from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster sets in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
[0071] Then, the cluster centers of each cluster are calculated based on the feature points of the sample images included in each cluster set. The cluster centers can then represent all the feature points of the sample images in their corresponding cluster set. Finally, a feature point code table is constructed based on the relationship between the cluster centers and the number of each cluster center. Since the feature points of each sample image are clustered and transformed into the cluster centers of each cluster set, the amount of data in the process of constructing the feature point code table is reduced. This can effectively improve the subsequent calculation process of feature point quantization encoding of each target image feature point based on the feature point code table. In addition, replacing the sample image feature points with the feature point code table can also greatly reduce the storage capacity required to save the sample image feature points.
[0072] Please see Figure 4 , Figure 4 This is a schematic diagram of hierarchical clustering provided for another embodiment of this application. For example... Figure 4As shown, after extracting the feature points of each sample image using the SIFT algorithm, hierarchical clustering is performed on all SIFT feature points in the sample image set. This can be achieved using Hadoop's MapReduce task to shorten the processing time. Here, the clustering layers are set to 3, and the cluster centers in each layer are set to 4. Subsequent embodiments will be based on this set of hyperparameters. Since the clustering layers are set to 3, a total of three levels of hierarchical clustering are performed. The first hierarchical clustering performs clustering on all SIFT feature points (… Figure 4 The process is performed by (denoted as root), clustering all SIFT feature points into 4 classes, resulting in the first clustering layer consisting of 4 cluster sets. Figure 4 The middle layer is denoted as level 1, which is the top-level clustering layer. The cluster centers of the four cluster sets are denoted as c1 to c4. Figure 4 Only c1 is marked in the text. In the process of calculating the cluster center points of each cluster based on the feature points of the sample images included in the cluster set, the vector of the cluster center point can be considered as the centroid of the feature point vectors of all sample images under that cluster set. The second hierarchical clustering is performed on a total of four cluster sets corresponding to c1 to c4, resulting in a second clustering layer containing 16 cluster sets. Figure 4 (Refered as level 2), taking cluster center c1 as an example, the feature points of sample images in the cluster set corresponding to c1 are clustered into 4 classes, resulting in 4 cluster sets. The cluster centers of these 4 cluster sets are denoted as c5 to c8. The clustering process of c2 to c4 is the same as that of c1. The third level of clustering is performed on a total of 16 cluster sets corresponding to c5 to c20, and the algorithm steps are the same as the first two, resulting in a third clustering layer containing 64 cluster sets. Figure 4 In the example, denoted as level 3, the cluster centers of these 64 cluster sets are denoted as c21 to c84, thus forming a full quadtree of height 4. This full quadtree includes the relationships between cluster centers (i.e., the relationships between branches of the cluster centers) and the numbers of each cluster center. This full quadtree is the constructed feature point code table. Optionally, without changing the feature extraction algorithm (using the SIFT algorithm), the feature point code table constructed from the sample image data has universality after construction and does not need to be reconstructed in subsequent applications.
[0073] S302. Based on the feature point code table, the feature points of each sample image are quantized and encoded to obtain the sample quantization value of the feature points of each sample image.
[0074] Since the feature point code table includes the relationships between cluster centroids and the numbers of each cluster centroid, the feature points of each sample image can be quantized and encoded based on the feature point code table to obtain the sample quantized values of each sample image feature point. Specifically, the target cluster centroids matching the feature points of each sample image can be found among the cluster centroids included in the feature point code table. For example, the cluster centroids that are the same as the feature points of each sample image can be found as target cluster centroids. Then, the feature points of each sample image are quantized and encoded according to the numbers corresponding to each target cluster centroid to obtain the sample quantized values of each sample image feature point. For example, the numbers corresponding to each target cluster centroid can be used as the sample quantized values of their corresponding sample image feature points.
[0075] When performing hierarchical clustering on the feature points of each sample image to obtain a feature point code table, the process of finding the target cluster center point matching each sample image feature point among the cluster center points included in the feature point code table can first be performed according to the relationship between the cluster center points of each sample image, searching from the top to the bottom for the cluster center point matching each sample image feature point. Then, the cluster center point that matches each sample image feature point and is located at the bottom layer is taken as the target cluster center point matching each sample image feature point. By finding the target cluster center point matching each sample image feature point in this way, the time for determining the target cluster center point can be greatly reduced.
[0076] For example, for Figure 4 In this process, after performing hierarchical clustering on all SIFT feature points in the sample image set to obtain the feature point code table, the SIFT feature points of each sample image can be quantized and encoded. First, a beam search with a width of 1 can be performed on the full quadtree using the 128-dimensional vector of each feature point to find the leaf node with the L2 distance to the 128-dimensional vector. The leaf node's number is then used to encode the 128-dimensional vector. This completes the encoding process from a 128-dimensional float vector to a 4-byte integer. Similarly, this process can be performed on the vectors of all SIFT feature points to complete the quantization process of all feature points in all sample images.
[0077] S303. Construct a common image index based on the quantization value of each sample and the number of the sample image corresponding to each quantization value.
[0078] After obtaining the quantized values of feature points for each sample image, since each feature point belongs to a specific sample image, we can obtain the ID of the sample image to which each feature point belongs. This allows us to obtain the ID of the sample image corresponding to each quantized value. Therefore, we can construct a shared graph index based on each quantized value and the ID of the corresponding sample image. Specifically, we can construct inverted keys based on each quantized value and an inverted list based on the IDs of the sample images to which the feature points of each quantized value belong. Then, we construct an inverted index structure based on each inverted key and its corresponding inverted list, and obtain the shared graph index from this inverted index structure.
[0079] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the construction of a similar graph index, provided for another embodiment of this application. For example... Figure 5 As shown in (A), there are four sample images, numbered 1, 2, 3, and 4. The feature points in each sample image are quantized and encoded based on a feature point code table, resulting in quantized values for the feature points in each image. For specific quantized values, please refer to [link to relevant documentation]. Figure 5 (A); Further, inverted index structures can be constructed based on the quantized values of each sample, and inverted lists can be constructed based on the sample image numbers to which the feature points of each sample image belong. Then, an inverted index structure can be constructed based on each inverted index and the inverted lists corresponding to each inverted index (e.g., Figure 5 (as shown in (B)).
[0080] Understandably, the process of building the same graph index described above can be performed before image retrieval. In other words, the process of building the same graph index can be done offline, and the same graph index can also be saved for easy access at any time.
[0081] S304. Extract at least one target image feature point from the target image, and perform feature point quantization encoding on each target image feature point based on the feature point code table to obtain the target quantization value of each target image feature point.
[0082] Optionally, the process of extracting at least one feature point of the target image can be basically the same as the offline construction process of the same graph index. However, since the feature extraction in online retrieval only needs to process one image per request and has higher real-time requirements, a single machine is used as the computing carrier (instead of using Hadoop's map reduce task). This step obtains the SIFT features of the target image requested by the user, which can be N (with the upper limit limited by a threshold) 128-dimensional float vectors.
[0083] In the process of quantizing and encoding the feature points of each target image, the feature point code table that has been constructed offline can be used directly for feature quantization and encoding. For the specific quantization and encoding process, please refer to the above process of quantizing and encoding the feature points of each sample image based on the feature point code table. It will not be repeated here. Then, the target quantization value of each target image feature point is obtained.
[0084] S305. Based on the quantization values of each target and the index of the same image, determine the retrieval results corresponding to the target image.
[0085] Since an offline identical graph index is pre-built, after obtaining the target quantization values of feature points in each target image, the retrieval results corresponding to the target images can be determined based on the relationship between the identical graph index and each target quantization value. Specifically, in determining the retrieval results corresponding to the target images based on each target quantization value and the identical graph index, the target sample quantization value that is the same as each target quantization value can be found in the identical graph index first. Then, the ID of the target sample image corresponding to each target sample quantization value is obtained, and the retrieval results corresponding to the target images are determined based on the number of times each target sample image ID is hit. In the process of determining the retrieval results corresponding to the target images based on the number of times each target sample image ID is hit, the number of times each target sample image ID is hit can be compared with a preset number of hits. Target sample images with a number of hits greater than or equal to the preset number of hits are taken as the retrieval results corresponding to the target images.
[0086] Please see Figure 6 , Figure 6 This is a schematic diagram of a similar image retrieval provided for another embodiment of this application.
[0087] The process of determining the retrieval results corresponding to the target image based on the quantized values of each target and the same graph index is also the process of querying the inverted keywords that match the quantized SIFT features (N integers) in the same graph index, and retrieving the corresponding inverted chains to count the number of times the target sample image is hit. For example... Figure 6 As shown in (A), if the SIFT features after quantization encoding are [21,37,55,82,84], then we can... Figure 4 The process involves retrieving the 5 matching inverted chains from the same graph index. The count of target image IDs matching is essentially traversing each inverted chain and counting the number of times each target image ID matches within its inverted node. The more times a target image matches, the more SIFT feature points in that target image overlap with those in the target image, and the higher the probability that the two images are identical. The statistical results of matching target images within matching inverted chains are shown below. Figure 6(B) You can also set a hit count threshold. For example, if the hit count threshold is 4, then the image numbered 4 will be returned to the user as the same image as the given target image. If the hit count threshold is 9, then there is no image in the existing sample image set that is the same as the user's given target image. At this point, the entire online image retrieval process is completed.
[0088] In this embodiment, the image retrieval method is applicable to the retrieval of identical images in a large-scale image set (on the order of billions). By abandoning the current time-complexity-intensive pairwise image feature matching algorithm, establishing an index, and converting the time-consuming vector L2 distance calculation process into a numerical matching process, the average response time is in the hundreds of milliseconds range for a billion-image set. Furthermore, due to the use of quantization encoding technology, a 128-dimensional float vector is converted into a 4-byte integer (depending on the number of clustering layers and the number of cluster centers), reducing the space occupied from 512 bytes to 4 bytes, a reduction of approximately 99.22%, saving bandwidth occupied during online feature transmission. Finally, with the code table and identical image index, there is no need to store the features of a billion-image set as in the current pairwise image feature matching algorithm, resulting in significant space savings.
[0089] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an image retrieval device provided in another embodiment of this application. For example... Figure 7 As shown, the image retrieval device 700 includes:
[0090] The feature quantization module 710 is used to extract at least one target image feature point from the target image, and to perform feature point quantization encoding on each target image feature point based on the feature point code table to obtain the target quantization value of each target image feature point.
[0091] The index retrieval module 720 is used to determine the retrieval results corresponding to the target image based on the quantization values of each target and the index of the same image;
[0092] The same image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by feature point quantization encoding based on the feature point code table.
[0093] Optionally, the device further includes: a sample feature point acquisition module, used to acquire at least one sample image and extract sample image feature points from each sample image; a sample feature point quantization module, used to quantize and encode the feature points of each sample image based on a feature point code table to obtain the sample quantization value of each sample image feature point; and an index construction module, used to construct a common image index based on each sample quantization value and the number of the sample image corresponding to each sample quantization value.
[0094] Optionally, the device further includes: a sample clustering module for clustering feature points of each sample image to obtain at least one cluster set; a cluster center calculation module for calculating the cluster center point of each cluster set based on the sample image feature points included in each cluster set; and a cluster code table construction module for constructing a feature point code table based on the relationship between each cluster center point and the number of each cluster center point.
[0095] Optionally, the sample feature point quantization module is also used to find the target cluster center point that matches the feature points of each sample image in the cluster center points included in the feature point code table; and to quantize and encode the feature points of each sample image according to the number corresponding to each target cluster center point to obtain the sample quantization value of each sample image feature point.
[0096] Optionally, the index building module is also used to build inverted keywords based on the quantization values of each sample, and to build an inverted list based on the sample image number to which the feature points of the sample image corresponding to each sample quantization value belong; to build an inverted index structure based on each inverted keyword and the inverted list corresponding to each inverted keyword, and to obtain the same graph index based on the inverted index structure.
[0097] Optionally, the sample clustering module is further configured to perform hierarchical clustering on the feature points of each sample image to obtain a first preset number of clustering layers, each clustering layer including at least one cluster set; wherein, the top clustering layer includes a second preset number of cluster sets, and when clustering is performed from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster set in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
[0098] Optionally, the sample feature point quantization module is also used to search for cluster centers that match the feature points of each sample image from top to bottom according to the relationship between the cluster centers of each cluster in the feature point code table; and to take the cluster centers that match the feature points of each sample image and are located at the bottom layer as the target cluster centers for matching the feature points of each sample image.
[0099] Optionally, the index retrieval module 720 is also used to search for the target sample quantization value that is the same as each target quantization value in the same graph index; obtain the number of the target sample image corresponding to each target sample quantization value; and determine the retrieval result corresponding to the target image based on the number of times the number of each target sample image is hit.
[0100] Optionally, it is also used to compare the number of times each target sample image's number is hit with a preset number of hits, and to use the target sample image with a number of hits greater than or equal to the preset number of hits as the search result corresponding to the target image.
[0101] Optionally, the number of sample image feature points in each sample image is a third preset number.
[0102] This application provides an image retrieval device comprising: a feature quantization module, used to extract at least one target image feature point from a target image, and to perform feature point quantization encoding on each target image feature point based on a feature point code table to obtain a target quantization value for each target image feature point; and an index retrieval module, used to determine the retrieval result corresponding to the target image based on each target quantization value and a same graph index. By pre-quantizing and encoding the sample image feature points in each sample image according to the feature point code table, and constructing a same graph index based on the sample quantization values of each sample image feature point, after extracting the target image feature points of the target image, the same method can be used to quantize and encode each target image feature point according to the feature point code table to obtain a target quantization value. Then, the sample image corresponding to the target quantization value is searched in the same graph index, thus obtaining the retrieval result corresponding to the target image. Since the computational cost of quantization encoding is much less than the computational cost of directly comparing feature points in sample images and target images, the computational cost when retrieving similar images can be reduced, effectively improving the retrieval speed when retrieving similar images.
[0103] This application also provides a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of any of the methods described in the above embodiments.
[0104] Further, please see Figure 8 , Figure 8 This application provides a schematic diagram of the structure of an electronic device. For example... Figure 8 As shown, the electronic device 800 may include: at least one central processing unit 801, at least one network interface 804, user interface 803, memory 805, and at least one communication bus 802.
[0105] The communication bus 802 is used to enable communication between these components.
[0106] The user interface 803 may include a display screen and a camera. Optionally, the user interface 803 may also include a standard wired interface and a wireless interface.
[0107] The network interface 804 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0108] The central processing unit 801 may include one or more processing cores. The central processing unit 801 connects to various parts within the electronic device 800 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 805, and by calling data stored in the memory 805. Optionally, the central processing unit 801 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The central processing unit 801 may integrate one or more of the following: a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the central processing unit 801.
[0109] The memory 805 may include random access memory (RAM) or read-only memory. Optionally, the memory 805 may include a non-transitory computer-readable storage medium. The memory 805 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 805 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 805 may also be at least one storage device located remotely from the aforementioned central processing unit 801. Figure 8 As shown, the memory 805, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an image retrieval program.
[0110] exist Figure 8In the illustrated electronic device 800, the user interface 803 is mainly used to provide an input interface for the user and to obtain the user's input data; while the central processing unit 801 can be used to call the image retrieval program stored in the memory 805 and specifically perform the following operations:
[0111] At least one target image feature point is extracted from the target image. The feature points of each target image feature point are quantized and encoded based on the feature point code table to obtain the target quantization value of each target image feature point. Based on each target quantization value and the same image index, the retrieval result corresponding to the target image is determined. The same image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by quantizing and encoding the feature points based on the feature point code table.
[0112] Optionally, before extracting at least one target image feature point from the target image, the method further includes: acquiring at least one sample image and extracting sample image feature points from each sample image; quantizing and encoding each sample image feature point based on a feature point code table to obtain sample quantization values for each sample image feature point; and constructing a common graph index based on each sample quantization value and the number of the sample image corresponding to each sample quantization value.
[0113] Optionally, before quantizing and encoding the feature points of each sample image based on the feature point code table, the method further includes: clustering the feature points of each sample image to obtain at least one cluster set; calculating the cluster center point of each cluster set based on the sample image feature points included in each cluster set; and constructing a feature point code table based on the relationship between the cluster center points and the number of each cluster center point.
[0114] Optionally, the feature points of each sample image are quantized and encoded based on the feature point code table to obtain the sample quantization value of each sample image feature point, including: finding the target cluster center point that matches the feature points of each sample image among the cluster center points included in the feature point code table; and quantizing and encoding the feature points of each sample image according to the number corresponding to each target cluster center point to obtain the sample quantization value of each sample image feature point.
[0115] Optionally, a common graph index is constructed based on the quantization values of each sample and the number of the sample image corresponding to each quantization value, including: constructing inverted keywords based on the quantization values of each sample, and constructing an inverted list based on the number of the sample image to which the feature points of the sample image corresponding to each quantization value belong; constructing an inverted index structure based on each inverted keyword and the inverted list corresponding to each inverted keyword, and obtaining the common graph index based on the inverted index structure.
[0116] Optionally, clustering the feature points of each sample image to obtain at least one cluster set includes: performing hierarchical clustering on the feature points of each sample image to obtain a first preset number of clustering layers, each clustering layer including at least one cluster set; wherein, the top clustering layer includes a second preset number of cluster sets, and when clustering from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster set in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
[0117] Optionally, in the cluster centers included in the feature point code table, the target cluster center that matches the feature points of each sample image is searched, including: searching from the top to the bottom layer for cluster centers that match the feature points of each sample image according to the relationship between the cluster centers in the feature point code table; and taking the cluster center that matches the feature points of each sample image and is at the bottom layer as the target cluster center that matches the feature points of each sample image.
[0118] Optionally, based on each target quantization value and the same graph index, the retrieval results corresponding to the target image are determined, including: finding the target sample quantization value that is the same as each target quantization value in the same graph index; obtaining the number of the target sample image corresponding to each target sample quantization value; and determining the retrieval results corresponding to the target image based on the number of times the number of each target sample image is hit.
[0119] Optionally, the search results corresponding to the target image are determined based on the number of times each target sample image's ID is hit, including: comparing the number of times each target sample image's ID is hit with a preset number of hits, and using the target sample image with a number of hits greater than or equal to the preset number of hits as the search results corresponding to the target image.
[0120] Optionally, the number of sample image feature points in each sample image is a third preset number.
[0121] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some feature points may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0122] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0123] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0124] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0125] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this application.
[0126] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0127] The above is a description of an image retrieval method, apparatus, storage medium, and electronic device provided in the embodiments of this application. For those skilled in the art, based on the ideas of the embodiments of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.
Claims
1. An image retrieval method, characterized in that the method includes: Extract at least one target image feature point from the target image, and perform feature point quantization encoding on each target image feature point based on the feature point code table to obtain the target quantization value of each target image feature point; Based on the target quantization values and the same image index, the search results corresponding to the target image are determined; The same image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by feature point quantization encoding based on the feature point code table. The step of determining the retrieval results corresponding to the target image based on each target quantization value and the same image index includes: Search for the target sample quantization value that is the same as each target quantization value in the same graph index; Obtain the ID of the target sample image corresponding to the quantization value of each target sample, and determine the retrieval result corresponding to the target image based on the number of hits of each target sample image ID; The step of determining the retrieval result corresponding to the target image based on the number of hits for each target sample image number includes: The number of hits for each target sample image is compared with the preset number of hits. Target sample images with a number of hits greater than or equal to the preset number of hits are used as the search results corresponding to the target images. After obtaining the search results corresponding to the target images, the search results, i.e., the target sample images, are displayed.
2. The method according to claim 1, characterized in that, before extracting at least one target image feature point of the target image, it further includes: Obtain at least one sample image and extract the sample image feature points from each sample image; Based on the feature point code table, the feature points of each sample image are quantized and encoded to obtain the sample quantization value of the feature points of each sample image. A common graph index is constructed based on the quantization value of each sample and the corresponding image number of each sample.
3. The method according to claim 2, characterized in that, before quantizing and encoding the feature points of each sample image based on the feature point code table, it further includes: Cluster the feature points of each sample image to obtain at least one cluster set; Calculate the cluster center point of each cluster set based on the feature points of the sample images included in each cluster set; A feature point code table is constructed based on the relationships between cluster centroids and the numbering of each cluster centroid.
4. The method according to claim 3, characterized in that, the step of quantizing and encoding the feature points of each sample image based on the feature point code table to obtain the sample quantization value of each sample image feature point includes: In the cluster center points included in the feature point code table, find the target cluster center point that matches the feature points of each sample image; Based on the number corresponding to each target cluster center, the feature points of each sample image are quantized and encoded to obtain the sample quantization value of each sample image feature point.
5. The method according to claim 3, characterized in that, The construction of a common image index based on the quantization value of each sample and the number of the sample image corresponding to each quantization value includes: An inverted keyword is constructed based on the quantization value of each sample, and an inverted list is constructed based on the number of the sample image to which the feature point of the sample image corresponding to the quantization value of each sample belongs. An inverted index structure is constructed based on each inverted key and the corresponding inverted list, and a graph index is obtained based on the inverted index structure.
6. The method according to claim 4, characterized in that, The clustering of feature points from each sample image yields at least one cluster set, including: Hierarchical clustering is performed on the feature points of each sample image to obtain a first preset number of clustering layers, and each clustering layer includes at least one cluster set; The top-level clustering layer includes a second preset number of cluster sets. When clustering is performed from the top-level clustering layer to the bottom-level clustering layer, the sample image feature points included in the cluster sets in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
7. The method according to claim 6, characterized in that, The step of finding the target cluster center point that matches the feature points of each sample image from the cluster center points included in the feature point code table includes: Based on the relationship between the cluster centers in the feature point code table, search from the top to the bottom for cluster centers that match the feature points of each sample image; The cluster center points that match the feature points of each sample image and are located at the lowest level are used as the target cluster center points for matching the feature points of each sample image.
8. The method according to claim 2, characterized in that, The number of feature points in each sample image is the third preset number.
9. An image retrieval device, characterized in that the device comprises: The feature quantization module is used to extract at least one feature point of the target image, and to perform feature point quantization encoding on each feature point of the target image based on the feature point code table to obtain the target quantization value of each feature point of the target image. The index retrieval module is used to determine the retrieval results corresponding to the target image based on each target quantization value and the same image index; The same image index includes at least one sample quantization value and the number of the sample image corresponding to each sample quantization value. Each sample quantization value is obtained by feature point quantization encoding based on the feature point code table. The index retrieval module is further configured to search for target sample quantization values that are the same as each target quantization value in the same graph index; obtain the number of the target sample image corresponding to each target sample quantization value; and determine the retrieval result corresponding to the target image based on the number of times the number of each target sample image is hit. The index retrieval module is also used to compare the number of hits of each target sample image with a preset number of hits, and take the target sample image with a number of hits greater than or equal to the preset number of hits as the retrieval result corresponding to the target image. After obtaining the retrieval result corresponding to the target image, the retrieval result, i.e. the target sample image, is displayed.
10. The apparatus according to claim 9, characterized in that the apparatus further comprises: The sample feature point acquisition module is used to acquire at least one sample image and extract the sample image feature points of each sample image. The sample feature point quantization module is used to quantize and encode the feature points of each sample image based on the feature point code table to obtain the sample quantization value of the feature points of each sample image. The index building module is used to build a common graph index based on the quantization value of each sample and the number of the sample image corresponding to each quantization value.
11. The apparatus according to claim 10, characterized in that the apparatus further comprises: The sample clustering module is used to cluster the feature points of each sample image to obtain at least one cluster set. The cluster center calculation module is used to calculate the cluster center points of each cluster set based on the feature points of the sample images included in each cluster set; The clustering code table construction module is used to construct a feature point code table based on the relationships between cluster centers and the number of each cluster center.
12. The apparatus according to claim 11, characterized in that the sample feature point quantization module is further configured to search for a target cluster center point matching each sample image feature point in the cluster center points included in the feature point code table; and to quantize and encode each sample image feature point according to the number corresponding to each target cluster center point to obtain the sample quantization value of each sample image feature point.
13. The apparatus according to claim 11, characterized in that, The index building module is further configured to build inverted keywords based on the quantization values of each sample, and to build an inverted list based on the number of the sample image to which the feature points of the sample image corresponding to each quantization value belong; to build an inverted index structure based on each inverted keyword and the inverted list corresponding to each inverted keyword, and to obtain the same graph index based on the inverted index structure.
14. The apparatus according to claim 12, characterized in that, The sample clustering module is further configured to perform hierarchical clustering on the feature points of each sample image to obtain a first preset number of clustering layers, each clustering layer including at least one cluster set; wherein, the top clustering layer includes a second preset number of cluster sets, and when clustering is performed from the top clustering layer to the bottom clustering layer, the sample image feature points included in the cluster set in each clustering layer are clustered into the second preset number of cluster sets in the next clustering layer.
15. The apparatus according to claim 14, characterized in that, The sample feature point quantization module is also used to search for cluster centers that match the feature points of each sample image from top to bottom according to the relationship between the cluster centers of each cluster in the feature point code table; and to take the cluster centers that match the feature points of each sample image and are located at the bottom layer as the target cluster centers for matching the feature points of each sample image.
16. The apparatus according to claim 10, characterized in that, The number of feature points in each sample image is the third preset number.
17. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the steps of the method as described in any one of claims 1 to 8.
18. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Object recognition method based on generalization visual dictionary diagram
CN102609732A
Quick retrieval method and system of vehicle image on the basis of feature geometric constraint
CN106528662A
Image retrieval method and device, computer equipment and storage medium
CN110083731A