Image retrieval method, device, equipment and storage medium
By using probabilistic mapping functions and manifold ranking methods in a multi-camera environment, combined with visual and spatiotemporal information, the inaccuracy problem caused by equipment differences and environmental factors in image retrieval is solved, and the accuracy and stability of retrieval results are improved. .
Patent Information
- Application Number
- CN202011321508.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-23
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-11-23
AI Technical Summary
In a multi-camera environment, the image retrieval task is affected by factors such as device differences, the appearance, posture, perspective, and environmental occlusion of the target object, leading to inaccuracies in retrieval results.
By obtaining the feature vectors of multiple images, using the probability mapping function to determine the transition probability matrix, combined with the manifold sorting method, the image sequence from high to low matching degree is output, and visual similarity and spatiotemporal information are integrated to improve the accuracy of the retrieval results.
It improves the accuracy and stability of image retrieval results, reduces the interference of different feature extraction methods and similarity measurement methods, and avoids the complexity of parameter adjustment in the manifold sorting method.
Smart Images

Figure CN113515658B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image retrieval technology, and in particular to an image retrieval method, device, equipment and storage medium. Background Art
[0002] At present, cameras are deployed in many scenes to collect videos of the surrounding environment, so as to achieve the purpose of video monitoring, etc. For example, several cameras are set up on both sides of the road in the city to achieve video monitoring of the city.
[0003] In practical applications, we face such an image retrieval task: given a reference image of a target object (such as a person or a car), we need to find matching images from a large number of images captured by multiple cameras. The target object may pass through different cameras during its movement. Due to the differences between different cameras, and the influence of the target object's appearance, posture, shooting angle, environmental occlusion, etc., the task of retrieving images containing the target object is challenging.
[0004] At present, one method to complete the above-mentioned image retrieval task is to use a manifold ranking method. Through the manifold ranking method, a large number of images captured by multiple cameras can be output sequentially in order from high to low matching degree with the above-mentioned given reference image.
[0005] In the diffusion process of the manifold sorting method, the transition probability matrix is needed. The rationality of the definition of the transition probability matrix will directly affect the accuracy of the output results of the manifold sorting, that is, the accuracy of the image retrieval results. Summary of the invention
[0006] The embodiments of the present invention provide an image retrieval method, apparatus, device and storage medium, which can improve the accuracy of image retrieval results.
[0007] In a first aspect, an embodiment of the present invention provides an image retrieval method, the method comprising:
[0008] Acquire feature vectors corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras;
[0009] Mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object;
[0010] Based on the first transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0011] In a second aspect, an embodiment of the present invention provides an image retrieval device, the device comprising:
[0012] An acquisition module, used for acquiring feature vectors corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are acquired by a plurality of cameras;
[0013] A determination module, used for mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object;
[0014] A sorting module is used to sequentially output the multiple images through a manifold sorting method based on the first transition probability matrix.
[0015] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the image retrieval method as described in the first aspect.
[0016] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the image retrieval method as described in the first aspect.
[0017] In a fifth aspect, an embodiment of the present invention provides an image retrieval method, the method comprising:
[0018] In response to a request to invoke a target service, determining a processing resource corresponding to the target service;
[0019] The following steps are performed using the processing resources corresponding to the target service:
[0020] Acquire feature vectors corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras;
[0021] Mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object;
[0022] Based on the first transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0023] In the scheme provided by the above-mentioned embodiment of the present invention, for multiple images collected by multiple cameras, the feature vector corresponding to each image is determined respectively. In addition, a reference image containing the target object is selected from the multiple images, corresponding to the query point of the manifold sorting method. It is necessary to process the multiple images by the manifold sorting method so as to output the multiple images in the order of the degree of matching with the reference image from high to low. In order to achieve this purpose, firstly, the similarity between the two feature vectors is calculated, that is, the similarity between the two images, and secondly, the similarity between the two feature vectors is mapped according to the set probability mapping function to determine the transition probability matrix (called the first transition probability matrix) required to be used in the diffusion process of the manifold sorting method, so as to output multiple images in sequence through the manifold sorting method based on the first transition probability matrix. At this time, the multiple images are output in the order of the degree of matching with the reference image from high to low.
[0024] In the above scheme, the similarity between the two feature vectors is probabilistically calibrated by the above probability mapping function, that is, the similarity between the two corresponding feature vectors is calibrated according to whether the two images contain the same target object, so as to avoid the interference of different feature vector extraction methods and different similarity measurement methods on the manifold sorting method. This interference can be reflected in the need to adjust the relevant parameters involved in the execution process of the manifold sorting method accordingly under different feature vector extraction methods and different similarity measurement methods. Through the effect of the above probability mapping function, the similarities obtained under different feature vector extraction methods and different similarity measurement methods can be uniformly mapped to the measurement of matching probability, and the mapping result is stable and reliable, so that after the relevant parameters of the manifold sorting method are initially set, no adjustment is required. In addition, the accuracy of the output results of the manifold sorting method is also guaranteed.
[0025] In a sixth aspect, an embodiment of the present invention provides an image retrieval method, the method comprising:
[0026] Acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification;
[0027] Determine a first transition probability matrix according to the similarity between the two eigenvectors;
[0028] According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix;
[0029] Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix;
[0030] Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0031] In a seventh aspect, an embodiment of the present invention provides an image retrieval device, the device comprising:
[0032] An acquisition module, used to acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification;
[0033] A first determination module, used for determining a first transfer probability matrix according to the similarity between two feature vectors;
[0034] A second determination module is used to obtain a second transfer probability matrix by determining the transfer probability between the two space-time points according to a set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points;
[0035] A third determining module, configured to determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix;
[0036] A sorting module is used to sequentially output the multiple images through a manifold sorting method based on the third transition probability matrix.
[0037] In an eighth aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the image retrieval method as described in the sixth aspect.
[0038] In the ninth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the image retrieval method as described in the sixth aspect.
[0039] In a tenth aspect, an embodiment of the present invention provides an image retrieval method, the method comprising:
[0040] In response to a request to invoke a target service, determining a processing resource corresponding to the target service;
[0041] The following steps are performed using the processing resources corresponding to the target service:
[0042] Acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification;
[0043] Determine a first transition probability matrix according to the similarity between the two eigenvectors;
[0044] According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix;
[0045] Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix;
[0046] Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0047] In the solution provided by the above embodiment of the present invention, for multiple images collected by multiple cameras, the feature vectors and spatiotemporal points corresponding to each image are determined respectively. In addition, a reference image containing the target object is selected from the multiple images, corresponding to the query point of the manifold sorting method. It is necessary to process the multiple images by the manifold sorting method so as to output the multiple images in the order of the degree of matching with the reference image from high to low. In order to achieve this purpose, firstly, the similarity between the feature vectors of each pair is calculated, that is, the visual similarity between the two images, so as to determine the first transition probability matrix based on the visual similarity. Secondly, the spatiotemporal information of the image is integrated into the manifold sorting method, which is to say that the second transition probability matrix is determined based on the spatiotemporal information between the two images. Specifically, according to the probability density function set for measuring the transfer time difference between the two cameras, and the acquisition time and camera identification corresponding to the two spatiotemporal points, the transition probability between the two spatiotemporal points is determined to obtain the second transition probability matrix. Finally, based on the above-mentioned first transfer probability matrix and second transfer probability matrix, a third transfer probability matrix is determined, which integrates the visual similarity and spatiotemporal transfer information between images. The third transfer probability matrix is used in the diffusion process of the manifold sorting method to finally output multiple images in sequence through the manifold sorting method.
[0048] In the above scheme, by integrating the visual similarity between images and the spatiotemporal transfer probability into the diffusion process of the manifold sorting method, the visual similarity between images and the rationality of spatiotemporal transfer are fully considered during the execution of the manifold sorting method, thereby ensuring the accuracy of the output results of the manifold sorting method. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 A flowchart of an image retrieval method provided by an embodiment of the present invention;
[0051] Figure 2 A flowchart of a probability mapping function acquisition method provided by an embodiment of the present invention;
[0052] Figure 3 A schematic diagram of a mapping relationship between similarity and matching probability between feature vectors provided in an embodiment of the present invention;
[0053] Figure 4 A schematic diagram of an image retrieval scenario provided by an embodiment of the present invention;
[0054] Figure 5 A flowchart of another image retrieval method provided by an embodiment of the present invention;
[0055] Figure 6 A flowchart of another image retrieval method provided by an embodiment of the present invention;
[0056] Figure 7 A schematic diagram of the structure of an image retrieval device provided by an embodiment of the present invention;
[0057] Figure 8 For Figure 7 A schematic diagram of the structure of an electronic device corresponding to the image retrieval device provided in the illustrated embodiment;
[0058] Fig. 9 A schematic diagram of the structure of an image retrieval device provided by an embodiment of the present invention;
[0059] Fig.10 For Fig. 9 A schematic diagram of the structure of an electronic device corresponding to the image retrieval device provided in the illustrated embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0061] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0062] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0063] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0064] The image retrieval solution provided in the embodiment of the present invention can be executed by an electronic device, which can be a terminal device such as a PC, a laptop, or a server in the cloud. The server can be a physical server including an independent host, or a virtual server, or a cloud server.
[0065] The main purpose of the image retrieval solution provided by the embodiment of the present invention is to find images matching a specific target object from a number of images collected by multiple cameras within a period of time. The target object may be, for example, a person or a car. The images collected by the camera refer to multiple frames of images obtained by sampling image frames of the video captured by the camera within a period of time.
[0066] Specifically, the manifold sorting method can be used to complete the image retrieval task. In simple terms, assume that multiple cameras have captured 10,000 images, and the target object is user X. User X may pass through different cameras during movement, so images captured by different cameras may contain images of user X. Based on the manifold sorting method, the 10,000 images can be output sequentially in the end, where the output order of the 10,000 images is arranged in descending order according to the degree of matching with user X. In this way, the relevant staff who trigger the image retrieval task can select multiple images containing user X one by one based on the 10,000 images output sequentially. For example, the first 100 images may contain user X. Furthermore, the relevant staff can know the movement trajectory of user X in the corresponding time period based on the time when the 100 images were taken and the camera position.
[0067] The manifold sorting method used in the embodiment of the present invention is an optimization of the traditional manifold sorting method. In summary, the optimization is mainly reflected in the generation method of the transition probability matrix used in the diffusion process of the manifold sorting method.
[0068] First, let's briefly introduce the execution process of the traditional manifold sorting method:
[0069] Given a data set X = {x(1),…,x(i),x(i+1),…,x(n)}, some of the data points are marked as query points, and the remaining data points (as data points to be sorted) need to be sorted according to their relationship with the query points.
[0070] First, the similarity between each pair of data points can be calculated. For example, the similarity can be defined by the distance between data points (cosine distance, Euclidean distance).
[0071] Secondly, design the transition probability matrix: the transition probability from data point to data point can be defined by defining an algorithm to calculate the similarity between the above data points to define the transition probability matrix. Such algorithms include k-nearest neighbor algorithm, shortest path algorithm, etc.
[0072] Again, iteration is performed: based on the transition probability matrix, continuous random walks are performed from the query point to finally determine the ranking score corresponding to each data point after multiple iterations.
[0073] Finally, the data points are sorted according to their ranking scores (from large to small), and all the data points are output in sequence.
[0074] From the above introduction, we can see that in the traditional manifold sorting method, the transition probability matrix is defined only according to the similarity between data points. If the similarity between data points is defined differently, the transition probability matrix will also be different, and the final sorting result will also be different, and a stable and reliable sorting result cannot be obtained. In addition, if the similarity between data points is defined differently, it will also be necessary to update the relevant parameters in the algorithm for calculating the transition probability matrix (such as the k value in the k-nearest neighbor algorithm, etc.), as well as the relevant parameters in the iterative process, which is more complex.
[0075] To this end, the following are provided: Figure 1 The solution provided by the illustrated embodiment avoids interference from different similarity definition methods by defining a new transition probability matrix, so as to ensure that a stable and reliable sorting result is finally obtained without the need to update relevant parameters in the manifold sorting method.
[0076] Figure 1 A flowchart of an image retrieval method provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method comprises the following steps:
[0077] 101. Obtain feature vectors corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras.
[0078] 102. Map the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix. The probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object.
[0079] 103. Based on the first transition probability matrix, multiple images are sequentially outputted through a manifold sorting method.
[0080] In the embodiment of the present invention, the target object may be a specific person, vehicle or other object, or may be a certain type of object, such as a truck or other object.
[0081] In actual applications, a number of cameras are installed on both sides of the roads in the city so that pedestrians and vehicles on the roads can be monitored through these cameras. Therefore, the above-mentioned multiple cameras may be all or part of the cameras deployed in the city.
[0082] Assume such a scenario: you want to query the movement trajectory of a user (i.e., the target object) within a certain time period. At this time, you can sample the videos taken by the above-mentioned multiple cameras in the time period to obtain the above-mentioned multiple images. It is understandable that some of these images may contain the user, while other images do not contain the user. The purpose of the solution provided in this embodiment is to output these multiple images in sequence according to the degree of match between the image and the user.
[0083] In this embodiment, the reference image can be an image containing the target object selected from multiple images, or can be an additional image containing the target object. The reference image serves as a query point in the manifold sorting method.
[0084] To implement the manifold sorting method, first, visual feature vectors are extracted for each of the multiple images. In practical applications, the feature vectors can be extracted using a pre-trained neural network model (such as a convolutional neural network model). Of course, other existing methods can also be used to extract the feature vectors.
[0085] After obtaining the feature vector of each image, the similarity between the feature vectors can be calculated. Specifically, the distance between the feature vectors (such as Euclidean distance, cosine distance) can be calculated first, and then the similarity between the two feature vectors can be determined based on the distance between the two feature vectors. It can be understood that the mapping relationship between the distance between feature vectors and the similarity between feature vectors can be predefined to obtain the similarity between feature vectors based on the mapping relationship.
[0086] After obtaining the similarity between the two feature vectors, the similarity between the two feature vectors can be mapped according to the set probability mapping function to determine the transition probability matrix. To distinguish it from other transition probability matrices below, it is called the first transition probability matrix.
[0087] In an embodiment of the present invention, a probability mapping function is defined to measure the probability that the two images corresponding to any two feature vectors both contain the target object. For example, in theory, if the target object is contained in two images, then the probability value obtained by mapping the feature vectors corresponding to the two images based on the similarity between the two images after mapping based on the probability mapping function is 1, indicating that the two images both contain the target object. On the contrary, if at least one of the two images does not contain the target object, then the probability value obtained by mapping the feature vectors corresponding to the two images based on the similarity between the two images after mapping based on the probability mapping function is 0.
[0088] Therefore, no matter how the feature vector of the image is extracted, the similarity between the feature vectors of the two images can be unified into the measurement of matching probability (corresponding to the same target object) through the above probability mapping function, so as to shield the differences between different feature vector extraction methods and different similarity definition methods. Therefore, a stable first transition probability matrix is finally obtained based on the probability mapping function without being disturbed by the differences between different feature vector extraction methods and different similarity definition methods.
[0089] The following first introduces how to obtain the above probability mapping function.
[0090] In summary, the probability mapping function needs to be trained based on a large number of sample images.
[0091] like Figure 2 As shown, the method for obtaining the probability mapping function can be implemented through the following steps:
[0092] 201. Obtain feature vectors corresponding to each of the plurality of sample images.
[0093] In practical applications, the plurality of sample images may also be a plurality of images obtained by sampling videos captured by a plurality of cameras in a certain period of time. A feature vector is extracted for each sample image.
[0094] 202. Label multiple sample images to mark whether each sample image contains a target object.
[0095] In practical applications, a target object may be selected, and images containing the target object in multiple sample images are marked as 1, and images not containing the target object are marked as 0.
[0096] 203. Determine the similarity between the feature vectors of any two sample images, and determine a reference probability value corresponding to the any two sample images according to the annotation information of the any two sample images, wherein the reference probability value is used to measure the probability that the target object is contained in the any two sample images.
[0097] 204. Taking the similarity between the feature vectors of the arbitrary two sample images as an independent variable and the reference probability values corresponding to the arbitrary two sample images as a function value, a probability mapping function is fitted by monotonic regression.
[0098] Taking any two sample images, sample image i and sample image j, as examples, the similarity between the feature vectors corresponding to the two sample images is calculated.
[0099] In addition, the reference probability values corresponding to sample images i and sample images j are determined according to the labeling information corresponding to each of sample images i and sample images j, that is, the probability that sample images i and sample images j correspond to the same target object. For example, if the labeling values of sample images i and sample images j are both 1, that is, sample images i and sample images j both contain the target object, then the reference probability value is 1; if at least one of sample images i and sample images j has a labeling value of 0, that is, sample images i and sample images j do not both contain the target object, then the reference probability value is 0.
[0100] The above similarity and reference probability value are calculated for any two sample images. Then, the similarity is used as the independent variable of the probability mapping function, and the reference probability value is used as the function value of the probability mapping function. A monotonic probability mapping function is fitted through monotonic regression.
[0101] The monotonic regression method is to solve the monotonic function so that the coordinate points can be fitted while maintaining monotonicity.
[0102] For ease of understanding, combined Figure 3 To illustrate the mapping relationship between the similarity between the above feature vectors and the matching probability and the fitting result of the probability mapping function.
[0103] like Figure 3 As shown in , the horizontal axis represents the similarity between feature vectors, and the vertical axis represents the reference probability value, which is represented by black dots. Since the reference probability value is directly determined based on the annotation information corresponding to the sample image, the reference probability value actually has only two values: 0 and 1. However, in Figure 3 In order to make it more vivid, the reference probability value is set to a continuous value in the interval [0,1].
[0104] After the probability mapping function is obtained based on the above method, specifically, the similarities between the two feature vectors are mapped according to the probability mapping function to determine the first transition probability matrix, which can be implemented as follows:
[0105] Determine a first similarity matrix according to the similarities between the two feature vectors;
[0106] According to a set probability mapping function, the similarities in the first similarity matrix are mapped into probability values to obtain a second similarity matrix;
[0107] A first transition probability matrix is determined according to the second similarity matrix.
[0108] For ease of description, assuming that there are N images in total, N is greater than 1, then optionally, the first similarity matrix can be a matrix with N rows and N columns, represented as A N*N , any element Aij Represents the similarity between the feature vectors of image i and image j.
[0109] Assuming that the probability mapping function is represented by Φ, any of the above elements A ij Through the mapping of the probability mapping function, that is, after inputting the probability mapping function as an independent variable, the probability value obtained can be expressed as: S ij =Φ(A ij ), it is understandable that S ij The value interval is [0,1]. In this way, for the first similarity matrix A N*N After the above mapping is performed on each element in, the second similarity matrix S can be obtained. N*N .
[0110] Afterwards, the second similarity matrix S N*N To get the first transition probability matrix, expressed as P1 N*N .
[0111] Optionally, for any element P in the first transition probability matrix ij For example, its value can be determined as follows: ij =S ij / ∑ k S ik ,or, in, is a preset mapping function, ∑ k S ik Represents the sum of the elements in the i-th row in the second similarity matrix.
[0112] After obtaining the first transition probability matrix, the diffusion process of the traditional manifold sorting can be continued: based on the first transition probability matrix, starting from the eigenvector corresponding to the reference image, a random walk is performed in the eigenvectors corresponding to each of the N images to finally determine the sorting scores corresponding to each of the N images, and the N images are output sequentially according to the sorting scores corresponding to each of the N images.
[0113] In fact, the N images are sorted as follows: the reference image is ranked first (if the reference image is selected from the N images), and the other images are sorted in descending order according to their corresponding ranking scores.
[0114] In the above embodiments, the first similarity matrix includes the similarity between the feature vectors of any two images in all the multiple images. Therefore, the calculation amount of the second similarity matrix and the first transition probability matrix subsequently obtained based on the first similarity matrix is relatively high. In order to reduce the calculation amount, optionally, the first similarity matrix can also be obtained by the following two optional methods.
[0115] In an optional embodiment, determining the first similarity matrix according to the similarity between the two feature vectors can also be implemented as follows:
[0116] For any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of other images;
[0117] The similarities between the feature vector of any one image and the feature vectors of other images are processed as follows: a plurality of similarities that meet set conditions are retained, and the remaining similarities are set to zero;
[0118] The processed similarity is determined as a row in a first similarity matrix to obtain a first similarity matrix.
[0119] For example, assuming that the above setting condition is topK (not limited to this), that is, the top K similarities with the highest similarity are selected. And assuming that all the multiple images are N images, for any image i, the similarity between it and the remaining images is calculated respectively, so that N similarities corresponding to image i can be obtained, among which the similarity between image i and itself is: A ii =1. Sort the N similarities from large to small, select the top K similarities, keep the K similarities, and set the remaining NK similarities to 0. In this way, a first similarity matrix with N rows and N columns can be obtained, in which each row corresponds to the similarity between an image and the feature vectors of other images. In each row, there are K non-zero elements, and the remaining NK elements are 0. K can be set to an integer greater than 1 according to actual needs.
[0120] Based on this, when calculating the second similarity matrix, it is only necessary to perform the mapping process of the probability mapping function on the non-zero elements in the first similarity matrix. Similarly, when calculating the first transfer probability matrix, it is only necessary to perform the calculation on the non-zero elements in the second similarity matrix.
[0121] In another optional embodiment, determining the first similarity matrix according to the similarity between the two feature vectors may also be implemented as follows:
[0122] Determine the similarity between the feature vector of the reference image and the feature vectors of the other images respectively;
[0123] Determining multiple similarities among the similarities that meet set conditions;
[0124] The similarities between the feature vectors corresponding to any two of the images corresponding to the plurality of similarities are determined to obtain a first similarity matrix.
[0125] For example, assuming that the above setting condition is topK (not limited to this), for the reference image, the similarities between the feature vectors of the reference image and the remaining images are calculated respectively, and the obtained similarities are sorted in descending order, and the top K similarities are taken out, and the K images corresponding to these K similarities are determined.
[0126] Afterwards, the similarity between the feature vectors of the K images is calculated between each other to obtain a first similarity matrix of K*K dimensions. It can be seen that the amount of calculation of the subsequent second similarity matrix and the first transition probability matrix is reduced.
[0127] Combine the following Figure 4 To illustrate the execution process of the above image retrieval method in a practical application scenario.
[0128] Assume that Figure 4 In the road scene shown in the figure, three cameras are deployed: C1 to C3. And it is assumed that the target object is a certain person, called user A. The current task is to find images containing user A from the images taken by the camera in a certain time period.
[0129] At this time, Figure 4 Taking the three cameras shown in the figure as an example, after the videos captured by the three cameras are sent to the server, the server can sample the image frames of the videos captured by each camera. Assuming that each camera captures M frames of images, the three cameras capture a total of 3*M frames of images, where M is an integer greater than 1.
[0130] Assume that user A passes through these three cameras in sequence during the above time period, and assume that two of the M frames of images corresponding to camera C1 contain user A, denoted as F6 and F7 respectively; assume that one of the M frames of images corresponding to camera C2 contains user A, denoted as F m+10 ; Assume that there are two frames of images in the M frames corresponding to camera C3 that contain user A, denoted as F 2m+8 、F 2m+9 .
[0131] like Figure 4As shown in , a reference image containing user A can be selected, assuming it is image F6, and feature vectors are extracted for each image. Based on the extracted feature vectors, the similarity between the two feature vectors is calculated. Then, the similarity between the two feature vectors is mapped based on the set probability mapping function to obtain the corresponding probability value. The first transfer probability matrix is composed of all the obtained probability values. Then, the manifold sorting method is executed based on the first transfer probability matrix to finally obtain the sorting scores corresponding to each of the 3*M frames of images, and the 3*M frames of images are output in the order of the sorting scores. For example, the output results are: F6, F7, F m+10 、F 2m+8 、F 2m+9 ···.
[0132] Figure 5 A flowchart of another image retrieval method provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the method may include the following steps:
[0133] 501. Obtain feature vectors and space-time points corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of an acquisition time and a camera identifier.
[0134] 502. Map the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix. The probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object.
[0135] 503. According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identification corresponding to two space-time points, the transfer probability between two space-time points is determined to obtain a second transfer probability matrix.
[0136] 504. Determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix.
[0137] 505. Based on the third transition probability matrix, output multiple images in sequence through a manifold sorting method.
[0138] In this embodiment, the process of obtaining the first transition probability matrix may refer to the relevant descriptions in the aforementioned other embodiments, which will not be described in detail here.
[0139] In this embodiment, in addition to uniformly mapping the similarity between the visual feature vectors of the images to the measurement of the matching probability through the probability mapping function, the spatiotemporal information, that is, the spatiotemporal transfer probability between images, is also integrated in the diffusion process of the manifold sorting method.
[0140] Based on this, for multiple images collected from multiple cameras, in addition to extracting visual feature vectors, it is also necessary to determine the time-space point corresponding to each image. Among them, the time-space point corresponding to an image is composed of two attributes: time and space. Time refers to the time when the image is collected, and space refers to the position of the camera that took the image. Among them, the position of the camera can be represented by a camera identifier, because in actual applications, the corresponding relationship between the camera identifier and its deployment position can be pre-stored, or the deployment position of the camera can be directly used as the camera identifier.
[0141] In this embodiment, by incorporating the rationality of the space-time transfer between space-time points into the diffusion process of the manifold sorting method, the accuracy of the manifold sorting result can be improved. Including the rationality of the space-time transfer between space-time points into the diffusion process of the manifold sorting method is to determine the above-mentioned second transition probability matrix reflecting the transition probability between space-time points. In this way, the third transition probability matrix used in the diffusion process of the manifold sorting method includes both the visual features of the image and the space-time features of the image.
[0142] The process of determining the second transition probability matrix is described below.
[0143] In the process of determining the second transfer probability matrix, a probability density function for measuring the transfer time difference between two cameras is required. The process of obtaining the probability density function is first described.
[0144] Optionally, the probability density function can be obtained as follows:
[0145] For any two cameras C1 and C2, assuming that the target object is a pedestrian, the time taken by a large number of pedestrians to pass through the two cameras under different conditions (such as different time periods, different walking speeds, and different road conditions) can be counted, which is called the transfer time difference. In this way, many values of the transfer time difference can be obtained. After that, the probability value corresponding to each transfer time difference is counted, so that the probability density function corresponding to the two cameras C1 and C2 is defined by each transfer time difference and its corresponding probability value.
[0146] For example, suppose that through statistics of data samples of 1,000 people, the transfer time differences corresponding to cameras C1 and C2 include three values: 3 minutes, 5 minutes, and 8 minutes. Among them, the proportion corresponding to 3 minutes is 500 / 1000, the proportion corresponding to 5 minutes is 300 / 1000, and the proportion corresponding to 3 minutes is 200 / 1000. Then for cameras C1 and C2, the following corresponding relationship between the transfer time difference and the probability value can be obtained:
[0147] [1 minute, 3 minutes]: 0.5; (3 minutes, 5 minutes]: 0.3; (5 minutes, 8 minutes]: 0.2.
[0148] Take image i and image j as an example, assuming that the space-time point corresponding to image i includes the acquisition time t i And the camera identifier C1, the space-time point corresponding to image j includes the acquisition time t j And camera identifier C2. Then based on the probability density functions corresponding to the cameras C1 and C2 determined above, as well as the acquisition time and camera identifiers corresponding to these two time-space points, the transition probability between these two time-space points is determined.
[0149] Specifically, the camera identifiers at these two time-space points can tell us which two cameras need to be used and which corresponding probability density functions they correspond to - the probability density functions corresponding to cameras C1 and C2:
[0150] [1 minute, 3 minutes]: 0.5; (3 minutes, 5 minutes]: 0.3; (5 minutes, 8 minutes]: 0.2.
[0151] Then, based on the acquisition times at these two time-space points, the difference in acquisition time can be known: t j -t i Then, the target transfer time difference matching the difference in acquisition time is determined from the transfer time differences included in the probability density functions corresponding to cameras C1 and C2. Assume that t j -t i =6 minutes, then the target transfer time difference is in the range of (5 minutes, 8 minutes], so the transfer probability between these two space-time points is 0.2.
[0152] Through the above process, the transition probability between the space-time points corresponding to any two images can be obtained, so that the second transition probability matrix is formed by the transition probabilities between the space-time points corresponding to any two images.
[0153] It is worth noting that the two images corresponding to the elements in the i-th row and j-th column of the second transition probability matrix are the same as the two images corresponding to the elements in the i-th row and j-th column of the first transition probability matrix. For example, the two images corresponding to the elements in the i-th row and j-th column of the second transition probability matrix are image i and image j, then the two images corresponding to the elements in the i-th row and j-th column of the first transition probability matrix are also image i and image j.
[0154] Assume that the element in the i-th row and j-th column of the first transition probability matrix is represented as P1 ij , denote the element in the i-th row and j-th column of the second transition probability matrix as P2 ij, then optionally, the third transition probability matrix P3 can be obtained as follows: P3 ij =P1 ij P2 ij / ∑ k P1 ik P2 ik .P3 ij Represents the element in the i-th row and j-th column of the third transition probability matrix.
[0155] After obtaining the third transition probability matrix, the diffusion process of the traditional manifold sorting can be continued: based on the third transition probability matrix, starting from the eigenvector corresponding to the reference image, random walks are performed in the eigenvectors corresponding to each of the multiple images to finally determine the sorting scores corresponding to each of the multiple images, and output the multiple images in sequence according to the sorting scores corresponding to each of the multiple images.
[0156] It is worth noting that, as mentioned above, in the process of determining the first transition probability matrix, the first similarity matrix can be first determined based on the similarity between the pairwise eigenvectors, and then the similarities in the first similarity matrix are mapped through a probability mapping function to obtain a second similarity matrix, and finally, the first transition probability matrix is obtained based on the second similarity matrix.
[0157] In the process of determining the first similarity matrix, the similarities between the feature vectors of all images may be calculated to obtain the first similarity matrix. Alternatively, in order to reduce the amount of calculation, the two methods for determining the first similarity matrix described above are provided.
[0158] When the first similarity matrix is determined by using the above two optional methods that can reduce the amount of calculation, the determination of the second transition probability matrix is also changed accordingly.
[0159] Specifically, as described above, in an optional embodiment, the first similarity matrix is determined according to the similarity between the two feature vectors, which can be implemented as follows:
[0160] For any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of other images;
[0161] The similarities between the feature vector of any one image and the feature vectors of other images are processed as follows: a plurality of similarities that meet set conditions are retained, and the remaining similarities are set to zero;
[0162] The processed similarity is determined as a row in a first similarity matrix to obtain a first similarity matrix.
[0163] At this time, according to the probability density function set for measuring the transfer time difference between two cameras, and the acquisition time and camera identification corresponding to two space-time points, the transfer probability between two space-time points is determined to obtain the second transfer probability matrix, which can be implemented as follows:
[0164] For any similarity retained in the first similarity matrix, determine two images corresponding to the any similarity;
[0165] Determine two space-time points corresponding to the two images;
[0166] Determining a probability density function corresponding to the camera identifiers at the two space-time points;
[0167] Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function;
[0168] The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities; the element corresponding to a similarity having a value of zero in the first similarity matrix in the second transition probability matrix is zero.
[0169] For ease of understanding, for example, assume that the element in the i-th row and j-th column of the first similarity matrix is A ij , corresponding to image i and image j; the element in the i-th row and k-th column is A ik , image i and image k. Among them, A ij Not zero, A ik is zero. Then, for A ij For the corresponding image i and image j, according to the camera identification and acquisition time contained in the space-time points corresponding to the two images and the preset probability density function corresponding to the two cameras, the transition probability between the space-time points corresponding to the two images can be obtained, which is assumed to be expressed as D ij . And for A ik For the corresponding image i and image k, because A ik If D is zero, there is no need to calculate the transition probability between the space-time points corresponding to the two images. We can directly set the transition probability between the two space-time points to zero. ik =0.
[0170] It can be understood that, assuming that the number of multiple images captured by multiple cameras is N, the first similarity matrix obtained based on the solution provided in this embodiment is an N*N dimensional matrix. Similarly, the second transition probability matrix obtained through the above processing process is also an N*N dimensional matrix.
[0171] As described above, in another optional embodiment, the first similarity matrix is determined according to the similarity between the two feature vectors, which can also be implemented as follows:
[0172] Determine the similarity between the feature vector of the reference image and the feature vectors of the other images respectively;
[0173] Determining multiple similarities among the similarities that meet set conditions;
[0174] The similarities between the feature vectors corresponding to any two of the images corresponding to the plurality of similarities are determined to obtain a first similarity matrix.
[0175] Based on this, according to the probability density function set for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to two space-time points, by determining the transfer probability between the two space-time points, a second transfer probability matrix can be obtained, which can be implemented as follows:
[0176] For any similarity in the first similarity matrix, determine two images corresponding to the any similarity;
[0177] Determine two space-time points corresponding to the two images;
[0178] Determining a probability density function corresponding to the camera identifiers at the two space-time points;
[0179] Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function;
[0180] The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities.
[0181] In simple terms, for each similarity in the first similarity matrix, the transition probability of the space-time point between the two images is calculated.
[0182] It can be understood that, assuming that the number of multiple images captured by multiple cameras is N, the first similarity matrix obtained based on the solution provided in this embodiment is a K*K dimensional matrix. Similarly, the second transition probability matrix obtained through the above processing process is also a K*K dimensional matrix.
[0183] In summary, Figure 5 In the solution provided by the illustrated embodiment, in the diffusion process of the manifold sorting method, the transition probabilities between the spatiotemporal points of the image are integrated, and the visual similarity of the image is mapped to a unified matching probability metric. This not only enriches the information dimension on which the diffusion process is based, but also shields the interference of differences in the extraction methods of visual features, making the final sorting result more accurate and reliable.
[0184] Figure 6 A flowchart of another image retrieval method provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the method comprises the following steps:
[0185] 601. Obtain feature vectors and space-time points corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of an acquisition time and a camera identifier.
[0186] 602. Determine a first transition probability matrix according to the similarity between any two feature vectors.
[0187] 603. According to the probability density function set for measuring the transfer time difference between two cameras, and the acquisition time and camera identification corresponding to two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix.
[0188] 604. Determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix.
[0189] 605. Based on the third transition probability matrix, sequentially output multiple images through a manifold sorting method.
[0190] Among them, after obtaining the third transfer probability matrix, based on the third transfer probability matrix, starting from the eigenvector corresponding to the reference image, a random walk is performed in the eigenvectors corresponding to each of the multiple images to determine the ranking scores corresponding to each of the multiple images, so as to output the multiple images in sequence according to the ranking scores corresponding to each of the multiple images.
[0191] In this embodiment, the method for obtaining the second transition probability matrix may refer to the relevant description in the above-mentioned embodiment, which will not be described in detail here.
[0192] In this embodiment, the first transition probability matrix can be obtained based on the similarity between the two feature vectors alone, or based on the similarity between the two feature vectors and a set probability mapping function as described above. The method for obtaining the probability mapping function refers to the relevant description in the above other embodiments.
[0193] That is to say, a similarity matrix may be determined only according to the similarities between the two feature vectors, and then the first transition probability matrix may be determined according to the similarity matrix.
[0194] It is also possible to determine a similarity matrix based on the similarity between the two eigenvectors and a set probability mapping function, and then determine the first transfer probability matrix based on the similarity matrix. At this time, as described above, the first similarity matrix can be determined based on the similarity between the two eigenvectors, and then, based on the set probability mapping function, the second similarity matrix is obtained by mapping the similarity between the two eigenvectors in the first similarity matrix into probability values.
[0195] It is understandable that the above-mentioned "similarity matrix determined only based on the similarity between the two eigenvectors" is actually the first similarity matrix. In other words, the first transition probability matrix can be obtained directly based on the first similarity matrix, or the first similarity matrix can be mapped to the second similarity matrix through a probability mapping function, and then the first transition probability matrix can be obtained based on the second similarity matrix.
[0196] Therefore, when determining the similarity matrix only according to the similarity between the two feature vectors, that is, determining the first similarity matrix, as described above, in order to reduce the amount of calculation of subsequent calculations, optionally, the first similarity matrix can be determined according to the following method:
[0197] For any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of other images;
[0198] The similarities between the feature vector of any one image and the feature vectors of other images are processed as follows: a plurality of similarities that meet set conditions are retained, and the remaining similarities are set to zero;
[0199] The processed similarity is determined as a row in a similarity matrix to obtain a similarity matrix (ie, a first similarity matrix).
[0200] Therefore, the determination process of the second transition probability matrix can be implemented as follows:
[0201] For any similarity retained in the similarity matrix (i.e., the first similarity matrix), determine two images corresponding to the any similarity;
[0202] Determine two space-time points corresponding to the two images;
[0203] Determining a probability density function corresponding to the camera identifiers at the two space-time points;
[0204] Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function;
[0205] The transition probability is determined as an element in the second transition probability matrix corresponding to any similarity; the element corresponding to the similarity with a value of zero in the similarity matrix in the second transition probability matrix is zero.
[0206] In addition, optionally, the first similarity matrix can also be obtained in the following manner:
[0207] respectively determining the similarities between the feature vector of the reference image and the feature vectors of other images;
[0208] Determining multiple similarities among the similarities that meet set conditions;
[0209] The similarities between the feature vectors corresponding to any two of the images corresponding to the plurality of similarities are determined to obtain a similarity matrix (ie, a first similarity matrix).
[0210] Based on this, the second transition probability matrix can be obtained as follows:
[0211] For any similarity in the similarity matrix (i.e., the first similarity matrix), determine two images corresponding to the any similarity;
[0212] Determine two space-time points corresponding to the two images;
[0213] Determining a probability density function corresponding to the camera identifiers at the two space-time points;
[0214] Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function;
[0215] The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities.
[0216] The detailed implementation process of the above solution can refer to the relevant descriptions in the aforementioned other embodiments and will not be repeated here.
[0217] As mentioned above, the image retrieval method provided by the present invention can be executed in the cloud, and a number of computing nodes can be deployed in the cloud, each of which has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service, and of course, a computing node can also provide one or more services.
[0218] For the solution provided by the present invention, the cloud can provide a service for completing the image retrieval method, which is called a target service. When a user needs to use the target service, the target service is called to trigger a request to the cloud to call the target service. The request can carry videos taken by multiple cameras. The cloud determines the computing node that responds to the request and uses the processing resources in the computing node (i.e., the processing resources corresponding to the target service) to perform the following steps:
[0219] Acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification;
[0220] Determine a first transition probability matrix according to the similarity between the two eigenvectors;
[0221] According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix;
[0222] Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix;
[0223] Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0224] The specific implementation methods of the above steps can refer to the relevant descriptions in the above other embodiments and will not be repeated here.
[0225] In addition, optionally, in response to the request to call the target service, after determining the processing resources corresponding to the target service, the cloud can also use the processing resources corresponding to the target service to perform the following steps:
[0226] Acquire feature vectors corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras;
[0227] Mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object;
[0228] Based on the first transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
[0229] The specific implementation methods of the above steps can refer to the relevant descriptions in the above other embodiments and will not be repeated here.
[0230] The following will describe in detail the image retrieval device of one or more embodiments of the present invention. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.
[0231] Figure 7 A schematic diagram of the structure of an image retrieval device provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the device includes: an acquisition module 11, a determination module 12, and a sorting module 13.
[0232] The acquisition module 11 is used to acquire feature vectors corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras.
[0233] The determination module 12 is used to map the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix. The probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object.
[0234] The sorting module 13 is configured to sequentially output the plurality of images through a manifold sorting method based on the first transition probability matrix.
[0235] Optionally, the determination module 12 can be specifically used to: determine a first similarity matrix based on the similarity between pairwise feature vectors; obtain a second similarity matrix by mapping the similarities in the first similarity matrix to probability values according to a set probability mapping function; and determine a first transfer probability matrix based on the second similarity matrix.
[0236] Optionally, the sorting module 13 can be specifically used to: based on the first transfer probability matrix, start from the feature vector corresponding to the reference image, perform random walks in the feature vectors corresponding to each of the multiple images to determine the sorting scores corresponding to each of the multiple images; and output the multiple images in sequence according to the sorting scores corresponding to each of the multiple images.
[0237] Optionally, the acquisition module 11 is further used to: acquire the space-time points corresponding to each of the multiple images, and the space-time points are composed of acquisition time and camera identification. The determination module 12 is further used to: determine the transition probability between the two space-time points according to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identification corresponding to the two space-time points, so as to obtain a second transfer probability matrix; determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix. The sorting module 13 is further used to: output the multiple images in sequence based on the third transfer probability matrix by a manifold sorting method.
[0238] Optionally, the determination module 12 can be specifically used to: for any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of the other images; perform the following processing on the similarity between the feature vector of the any image and the feature vectors of the other images: retain multiple similarities among the similarities that meet the set conditions, and set the remaining similarities to zero; determine the similarities after the processing as a row in the first similarity matrix to obtain the first similarity matrix.
[0239] Based on this, in the process of obtaining the second transfer probability matrix by determining the transfer probability between the two space-time points according to the set probability density function for measuring the transfer time difference between the two cameras, and the acquisition time and camera identification corresponding to the two space-time points, the determination module 12 can be specifically used to: for any similarity retained in the first similarity matrix, determine the two images corresponding to the any similarity; determine the two space-time points corresponding to the two images; determine the probability density function corresponding to the camera identification in the two space-time points; determine the transfer probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; determine the transfer probability as the element corresponding to the any similarity in the second transfer probability matrix; the similarity with a value of zero in the first similarity matrix corresponds to zero in the second transfer probability matrix.
[0240] Optionally, in the process of determining the first similarity matrix, the determination module 12 can be specifically used to: respectively determine the similarity between the feature vector of the reference image and the feature vector of other images; determine multiple similarities that meet the set conditions in the similarities; determine the similarity between the feature vectors corresponding to each of the multiple similarities, so as to obtain the first similarity matrix. Based on this, in the process of obtaining the second transfer probability matrix by determining the transfer probability between the two space-time points according to the set probability density function for measuring the transfer time difference between the two cameras, and the acquisition time and camera identification corresponding to the two space-time points, the determination module 12 can be specifically used to: for any similarity in the first similarity matrix, determine the two images corresponding to the any similarity; determine the two space-time points corresponding to the two images; determine the probability density function corresponding to the camera identification in the two space-time points; determine the transfer probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; determine the transfer probability as the element corresponding to the any similarity in the second transfer probability matrix.
[0241] Optionally, the determination module 12 can also be used to: obtain the feature vectors corresponding to each of the multiple sample images; annotate the multiple sample images to mark whether each sample image contains the target object; determine the similarity between the feature vectors of any two sample images, and determine the reference probability value corresponding to the any two sample images based on the annotation information of the any two sample images, the reference probability value is used to measure the probability that the target object is contained in the any two sample images; use the similarity between the feature vectors of the any two sample images as the independent variable, and the reference probability value corresponding to the any two sample images as the function value, and fit the probability mapping function by monotonic regression.
[0242] Figure 7 The device shown can perform the aforementioned Figures 1 to 5 The image retrieval method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiment and will not be repeated here.
[0243] In one possible design, the above Figure 7 The structure of the image retrieval device shown can be implemented as an electronic device, such as Figure 8 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 stores executable code. When the executable code is executed by the first processor 21, the first processor 21 can at least implement the above-mentioned Figures 1 to 5 The image retrieval method provided in the illustrated embodiment.
[0244] Optionally, the electronic device may further include a first communication interface 23 for communicating with other devices.
[0245] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, wherein an executable code is stored on the non-transitory machine-readable storage medium. When the executable code is executed by a processor of an electronic device, the processor can at least implement the above-mentioned Figures 1 to 5 The image retrieval method provided in the illustrated embodiment.
[0246] Fig. 9 A schematic diagram of the structure of an image retrieval device provided by an embodiment of the present invention is shown in FIG. Fig. 9 As shown, the device includes: an acquisition module 31, a first determination module 32, a second determination module 33, a third determination module 34, and a sorting module 35.
[0247] The acquisition module 31 is used to obtain the feature vectors and time-space points corresponding to each of the multiple images, wherein the multiple images include a reference image, the reference image contains a target object, the multiple images are collected by multiple cameras, and the time-space points are composed of a collection time and a camera identifier.
[0248] The first determination module 32 is used to determine a first transition probability matrix according to the similarity between any two feature vectors.
[0249] The second determination module 33 is used to obtain a second transfer probability matrix by determining the transfer probability between the pairwise space-time points according to a probability density function set for measuring the transfer time difference between the pairwise cameras and the acquisition time and camera identifier corresponding to the pairwise space-time points.
[0250] The third determination module 34 is configured to determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix.
[0251] The sorting module 35 is used to sequentially output the multiple images through a manifold sorting method based on the third transition probability matrix.
[0252] Optionally, the sorting module 35 can be specifically used to: based on the third transfer probability matrix, start from the feature vector corresponding to the reference image, perform random walks in the feature vectors corresponding to each of the multiple images to determine the sorting scores corresponding to each of the multiple images; and output the multiple images in sequence according to the sorting scores corresponding to each of the multiple images.
[0253] Optionally, the first determination module 32 may be specifically configured to: determine a similarity matrix according to similarities between any two feature vectors; and determine a first transition probability matrix according to the similarity matrix.
[0254] Optionally, the first determination module 32 may be specifically configured to determine a similarity matrix according to similarities between any two feature vectors and a set probability mapping function, wherein the probability mapping function is used to measure the probability that the target object is contained in two images corresponding to any two feature vectors.
[0255] Optionally, the first determination module 32 can be specifically used to: determine a first similarity matrix according to the similarity between each pair of feature vectors; and obtain a second similarity matrix by mapping the similarities in the first similarity matrix to probability values according to a set probability mapping function, and the similarity matrix is the second similarity matrix.
[0256] Optionally, the first determination module 32 can also be used to: obtain the feature vectors corresponding to each of the multiple sample images collected by the multiple cameras; annotate the multiple sample images to mark whether each sample image contains the target object; determine the similarity between the feature vectors of any two sample images, and determine the reference probability value corresponding to the any two sample images based on the annotation information of the any two sample images, the reference probability value is used to measure the probability that the target object is contained in any two sample images; use the similarity between the feature vectors of the any two sample images as the independent variable, and the reference probability value corresponding to the any two sample images as the function value, to fit the probability mapping function by monotonic regression.
[0257] Optionally, the first determination module 32 can be specifically used to: for any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of the other images; perform the following processing on the similarity between the feature vector of the any image and the feature vectors of the other images: retain multiple similarities among the similarities that meet the set conditions, and set the remaining similarities to zero; determine the similarities after the processing as a row in the similarity matrix to obtain the similarity matrix.
[0258] Based on this, optionally, the second determination module 33 can be specifically used to: for any similarity retained in the similarity matrix, determine the two images corresponding to the any similarity; determine the two space-time points corresponding to the two images; determine the probability density function corresponding to the camera identifier in the two space-time points; determine the transition probability between the two space-time points based on the acquisition time in the two space-time points and the probability density function; determine the transition probability as the element corresponding to the any similarity in the second transition probability matrix; the similarity with a value of zero in the similarity matrix corresponds to zero in the second transfer probability matrix.
[0259] Optionally, the first determination module 32 can be specifically used to: respectively determine the similarity between the feature vector of the reference image and the feature vectors of other images; determine multiple similarities among the similarities that meet set conditions; determine the similarity between the feature vectors corresponding to each of the images corresponding to the multiple similarities, so as to obtain a similarity matrix.
[0260] Based on this, optionally, the second determination module 33 can be specifically used to: for any similarity in the similarity matrix, determine the two images corresponding to the any similarity; determine the two space-time points corresponding to the two images; determine the probability density function corresponding to the camera identification in the two space-time points; determine the transition probability between the two space-time points based on the acquisition time in the two space-time points and the probability density function; determine the transition probability as the element in the second transition probability matrix corresponding to the any similarity.
[0261] Fig. 9 The device shown can perform the aforementioned Figure 6 The image retrieval method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiment and will not be repeated here.
[0262] In one possible design, the above Fig. 9 The structure of the image retrieval device shown can be implemented as an electronic device, such as Fig.10As shown, the electronic device may include: a second processor 41 and a second memory 42. The second memory 42 stores executable code. When the executable code is executed by the second processor 41, the second processor 41 can at least implement the above-mentioned Figure 6 The image retrieval method provided in the illustrated embodiment.
[0263] Optionally, the electronic device may further include a second communication interface 43 for communicating with other devices.
[0264] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, wherein an executable code is stored on the non-transitory machine-readable storage medium. When the executable code is executed by a processor of an electronic device, the processor can at least implement the above-mentioned Figure 6 The image retrieval method provided in the illustrated embodiment.
[0265] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0266] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0267] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An image retrieval method, characterized in that: include: Acquire feature vectors corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras; Mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object; Based on the first transition probability matrix, sequentially outputting the plurality of images by a manifold sorting method; Among them, the step of determining the first transfer probability matrix includes: determining a first similarity matrix according to the similarity between each pair of eigenvectors; according to the probability mapping function, mapping the similarity in the first similarity matrix to a probability value to obtain a second similarity matrix, and determining the first transfer probability matrix according to the second similarity matrix.
2. The method according to claim 1, characterized in that The step of sequentially outputting the plurality of images based on the first transition probability matrix by a manifold sorting method comprises: Based on the first transition probability matrix, starting from the feature vector corresponding to the reference image, a random walk is performed in the feature vectors corresponding to each of the multiple images to determine the ranking scores corresponding to each of the multiple images; The multiple images are outputted in sequence according to the ranking scores corresponding to the multiple images.
3. The method according to claim 1, characterized in that The method further comprises: Acquire the time-space points corresponding to each of the multiple images, wherein the time-space points are composed of acquisition time and camera identifier; According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix; Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix; The step of sequentially outputting the plurality of images based on the first transition probability matrix by a manifold sorting method comprises: Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
4. The method according to claim 3, characterized in that The step of determining a first similarity matrix according to the similarities between the two feature vectors comprises: For any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of other images; The similarities between the feature vector of any one image and the feature vectors of other images are processed as follows: a plurality of similarities that meet set conditions are retained, and the remaining similarities are set to zero; The processed similarity is determined as a row in a first similarity matrix to obtain a first similarity matrix.
5. The method according to claim 4, characterized in that The method of obtaining a second transition probability matrix by determining the transition probability between the two space-time points according to the set probability density function for measuring the transition time difference between the two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, includes: For any similarity retained in the first similarity matrix, determine two images corresponding to the any similarity; Determine two space-time points corresponding to the two images; Determining a probability density function corresponding to the camera identifiers at the two space-time points; Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities; the element corresponding to a similarity having a value of zero in the first similarity matrix in the second transition probability matrix is zero.
6. The method according to claim 3, characterized in that: The step of determining a first similarity matrix according to the similarities between the two feature vectors comprises: respectively determining the similarities between the feature vector of the reference image and the feature vectors of other images; Determining multiple similarities among the similarities that meet set conditions; The similarities between the feature vectors corresponding to any two of the images corresponding to the plurality of similarities are determined to obtain a first similarity matrix.
7. The method according to claim 6, characterized in that The method of obtaining a second transition probability matrix by determining the transition probability between the two space-time points according to the set probability density function for measuring the transition time difference between the two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, includes: For any similarity in the first similarity matrix, determine two images corresponding to the any similarity; Determine two space-time points corresponding to the two images; Determining a probability density function corresponding to the camera identifiers at the two space-time points; Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities.
8. The method according to claim 1, characterized in that The method further comprises: Obtaining feature vectors corresponding to each of the multiple sample images; Annotating the multiple sample images to indicate whether each sample image contains the target object; Determine the similarity between the feature vectors of any two sample images, and determine the reference probability value corresponding to the any two sample images according to the annotation information of the any two sample images, wherein the reference probability value is used to measure the probability that the target object is contained in the any two sample images; The probability mapping function is fitted by monotonic regression, taking the similarity between the feature vectors of the arbitrary two sample images as an independent variable and the reference probability values corresponding to the arbitrary two sample images as a function value.
9. An image retrieval device, characterized in that: include: An acquisition module, used for acquiring feature vectors corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are acquired by a plurality of cameras; A determination module, configured to determine a first similarity matrix according to the similarities between the two eigenvectors; and to obtain a second similarity matrix by mapping the similarities in the first similarity matrix into probability values according to a set probability mapping function, and to determine a first transfer probability matrix according to the second similarity matrix, wherein the probability mapping function is used to measure the probability that the target object is contained in two images corresponding to any two eigenvectors; A sorting module is used to sequentially output the multiple images through a manifold sorting method based on the first transition probability matrix.
10. The device according to claim 9, characterized in that: The acquisition module is also used to: acquire the time-space points corresponding to each of the multiple images, wherein the time-space points are composed of the acquisition time and camera identification; The determination module is further used to: determine the transition probability between the two space-time points according to the set probability density function for measuring the transfer time difference between the two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, so as to obtain a second transfer probability matrix; determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix; The sorting module is further used to: output the multiple images in sequence through a manifold sorting method based on the third transition probability matrix.
11. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the image retrieval method as described in any one of claims 1 to 8.
12. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the image retrieval method according to any one of claims 1 to 8.
13. An image retrieval method, characterized in that: include: Acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification; Determine a similarity matrix according to the similarity between the two feature vectors, and determine a first transition probability matrix according to the similarity matrix; According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix; Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix; Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
14. The method according to claim 13, characterized in that The step of sequentially outputting the plurality of images based on the third transition probability matrix by a manifold sorting method comprises: Based on the third transition probability matrix, starting from the feature vector corresponding to the reference image, a random walk is performed in the feature vectors corresponding to each of the multiple images to determine the ranking scores corresponding to each of the multiple images; The multiple images are outputted in sequence according to the ranking scores corresponding to the multiple images.
15. The method according to claim 13, characterized in that Determining a similarity matrix according to the similarity between the two feature vectors comprises: A similarity matrix is determined according to the similarity between the two feature vectors and a set probability mapping function, wherein the probability mapping function is used to measure the probability that the target object is contained in two images corresponding to any two feature vectors.
16. The method according to claim 15, characterized in that Determining the similarity matrix according to the similarity between the two feature vectors and the set probability mapping function includes: Determine a first similarity matrix according to the similarities between the two feature vectors; According to the set probability mapping function, the similarities in the first similarity matrix are mapped into probability values to obtain a second similarity matrix, and the similarity matrix is the second similarity matrix.
17. The method according to claim 15, characterized in that The method further comprises: Obtaining feature vectors corresponding to each of the plurality of sample images captured by the plurality of cameras; Annotating the multiple sample images to indicate whether each sample image contains the target object; Determine the similarity between the feature vectors of any two sample images, and determine the reference probability value corresponding to the any two sample images according to the annotation information of the any two sample images, wherein the reference probability value is used to measure the probability that the target object is contained in the any two sample images; The probability mapping function is fitted by monotonic regression, taking the similarity between the feature vectors of the arbitrary two sample images as an independent variable and the reference probability values corresponding to the arbitrary two sample images as a function value.
18. The method according to claim 13, characterized in that Determining a similarity matrix according to the similarity between the two feature vectors comprises: For any image among the multiple images, respectively determine the similarity between the feature vector of the any image and the feature vectors of other images; The similarities between the feature vector of any one image and the feature vectors of other images are processed as follows: a plurality of similarities that meet set conditions are retained, and the remaining similarities are set to zero; The processed similarity is determined as a row in a similarity matrix to obtain a similarity matrix.
19. The method according to claim 18, characterized in that The method of obtaining a second transition probability matrix by determining the transition probability between the two space-time points according to the set probability density function for measuring the transition time difference between the two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, includes: For any similarity retained in the similarity matrix, determine two images corresponding to the any similarity; Determine two space-time points corresponding to the two images; Determining a probability density function corresponding to the camera identifiers at the two space-time points; Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities; the element corresponding to a similarity with a value of zero in the similarity matrix in the second transition probability matrix is zero.
20. The method according to claim 13, characterized in that Determining a similarity matrix according to the similarity between the two feature vectors comprises: respectively determining the similarities between the feature vector of the reference image and the feature vectors of other images; Determining multiple similarities among the similarities that meet set conditions; The similarities between the feature vectors corresponding to any two images in the images corresponding to the plurality of similarities are determined to obtain a similarity matrix.
21. The method according to claim 20, characterized in that The method of obtaining a second transition probability matrix by determining the transition probability between the two space-time points according to the set probability density function for measuring the transition time difference between the two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, includes: For any similarity in the similarity matrix, determine two images corresponding to the any similarity; Determine two space-time points corresponding to the two images; Determining a probability density function corresponding to the camera identifiers at the two space-time points; Determine the transition probability between the two space-time points according to the acquisition time in the two space-time points and the probability density function; The transition probability is determined as an element in a second transition probability matrix corresponding to any of the similarities.
22. An image retrieval device, characterized in that: include: An acquisition module, used to acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification; A first determination module is used to determine a similarity matrix according to the similarity between the two feature vectors, and determine a first transition probability matrix according to the similarity matrix; A second determination module is used to obtain a second transfer probability matrix by determining the transfer probability between the two space-time points according to a set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points; A third determining module, configured to determine a third transfer probability matrix according to the first transfer probability matrix and the second transfer probability matrix; A sorting module is used to sequentially output the multiple images through a manifold sorting method based on the third transition probability matrix.
23. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the image retrieval method as described in any one of claims 13 to 21.
24. A non-transitory machine-readable storage medium, characterized in that The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the image retrieval method according to any one of claims 13 to 21.
25. An image retrieval method, characterized in that: include: In response to a request to invoke a target service, determining a processing resource corresponding to the target service; The following steps are performed using the processing resources corresponding to the target service: Acquire feature vectors and space-time points corresponding to a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, the plurality of images are acquired by a plurality of cameras, and the space-time points are composed of acquisition time and camera identification; Determine a similarity matrix according to the similarity between the two feature vectors, and determine a first transition probability matrix according to the similarity matrix; According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix; Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix; Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
26. An image retrieval method, characterized in that: include: In response to a request to invoke a target service, determining a processing resource corresponding to the target service; The following steps are performed using the processing resources corresponding to the target service: Acquire feature vectors corresponding to each of a plurality of images, wherein the plurality of images include a reference image, the reference image includes a target object, and the plurality of images are collected by a plurality of cameras; Mapping the similarities between the two feature vectors according to a set probability mapping function to determine a first transfer probability matrix, wherein the probability mapping function is used to measure the probability that the two images corresponding to any two feature vectors contain the target object; Based on the first transition probability matrix, sequentially outputting the plurality of images by a manifold sorting method; Among them, the step of determining the first transfer probability matrix includes: determining a first similarity matrix according to the similarity between pairwise eigenvectors; according to the probability mapping function, mapping the similarity in the first similarity matrix to a probability value to obtain a second similarity matrix, and determining the first transfer probability matrix according to the second similarity matrix.
27. The method according to claim 26, characterized in that The method further comprises: Acquire the time-space points corresponding to each of the multiple images, wherein the time-space points are composed of acquisition time and camera identifier; According to the set probability density function for measuring the transfer time difference between two cameras, and the acquisition time and camera identifier corresponding to the two space-time points, the transfer probability between the two space-time points is determined to obtain a second transfer probability matrix; Determine a third transition probability matrix according to the first transition probability matrix and the second transition probability matrix; The step of sequentially outputting the plurality of images based on the first transition probability matrix by a manifold sorting method comprises: Based on the third transition probability matrix, the multiple images are sequentially outputted through a manifold sorting method.
Citation Information
Patent Citations
Image retrieval method based on Bessel statistic model
CN105426543A
Target retrieval method and device and electronic equipment
CN108229289A
Target clustering method and system based on space-time constraints
CN110765863A
Picture clustering method and device, electronic equipment and storage medium
CN111414949A
Look-ahead document ranking system
US20080243813A1
