Image comparison method and device
By performing feature extraction and comparing the collection similarity of images, the problem of insufficient image alignment accuracy in the prior art is solved, and a higher image alignment accuracy is achieved.
Patent Information
- Application Number
- CN202111141500.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2041-09-28
AI Technical Summary
When existing image comparison technologies deal with differences in shooting angles, clothing, makeup, posture, etc., it is difficult to accurately identify the same target, resulting in a low comparison accuracy.
By performing feature extraction on the first picture and the second picture, a collection of feature vectors is obtained, and multiple feature vectors that meet the similarity requirements are determined in the feature library to form a collection similarity to confirm the identity of the target.
The scope of comparison is expanded, the samples are increased, and the accuracy of image comparison is improved, ensuring that the same target can be accurately identified under different angles and dresses.
Smart Images

Figure CN114118184B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer vision technology, and in particular, to an image comparison method, apparatus, computing device, and computer-readable storage medium. Background Art
[0002] With the rapid development of computers, the Internet, and multimedia in recent years, there is an increasing amount of massive image data in the world. In order to effectively analyze and utilize the value of these images, various industries are deeply researching efficient and accurate feature matching technology, such as search engines, e-commerce platforms, security, information authentication, etc.
[0003] When the similarity comparison is performed on two images, if the similarity is high, it is confirmed that the two images are relatively similar and the objects therein are the same object.
[0004] However, the above method has certain limitations. When the target in one picture is actually the same as the target in another picture, but is identified as having low similarity due to differences in shooting angle, clothing, makeup, posture, etc., the comparison result of "the targets in the two pictures are the same target" will not be output. In this way, the correct comparison result will be missed, resulting in a low comparison accuracy rate.
[0005] In summary, the embodiments of the present invention provide an image comparison method to improve the accuracy of image comparison. Summary of the invention
[0006] An embodiment of the present invention provides an image comparison method for improving the accuracy of image comparison.
[0007] In a first aspect, an embodiment of the present invention provides an image comparison method, comprising:
[0008] Perform feature extraction on the first image and the second image respectively to obtain a first feature vector of the first image and a second feature vector of the second image;
[0009] According to the first feature vector, a plurality of feature vectors satisfying a similarity requirement with the first feature vector are determined from a feature library to form a first feature vector collection;
[0010] According to the second feature vector, a plurality of feature vectors satisfying a similarity requirement with the second feature vector are determined from a feature library to form a second feature vector collection;
[0011] Determine whether the collection similarity of the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determine that the target corresponding to the first picture and the target corresponding to the second picture are the same target.
[0012] In the feature library, multiple feature vectors that meet the similarity requirements with the first feature vector are determined to form a first feature vector collection, and multiple feature vectors that meet the similarity requirements with the second feature vector are determined to form a second feature vector collection in the feature library. Then, the two feature vector collections are compared for collection similarity, which can expand the scope of comparison and increase the samples for comparison. When the similarity of the two collections meets the threshold condition, it is considered that the target corresponding to the first image and the target corresponding to the second image are the same target. By making the above improvements to the image comparison method, more information is taken into account in the comparison process, and the accuracy of image comparison is improved.
[0013] Optionally, determining whether a collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition includes:
[0014] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0015] An average value of the multiple vector similarities is determined as the collection similarity, and it is determined whether the collection similarity meets a first threshold condition.
[0016] The above method can convert the similarity comparison result of the feature vectors in the two collections into the comparison result of the two collections, so as to confirm whether the target corresponding to the first picture and the target corresponding to the second picture are the same target through the comparison result of the two collections, thereby improving the accuracy of the comparison.
[0017] Optionally, determining whether a collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition includes:
[0018] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0019] According to the vector similarity, determining the intersection-and-union ratio of the first feature vector collection and the second feature vector collection, and determining the intersection-and-union ratio as the collection similarity; the intersection in the intersection-and-union ratio is the feature vector corresponding to the vector similarity that meets the set condition; the set condition is that the vector similarity meets the similarity requirement and the corresponding feature vectors are not the same;
[0020] Determine whether the collection similarity meets a second threshold condition.
[0021] Another method for determining the similarity between a first feature vector set and a second feature vector set is provided, which increases the diversity of comparison and improves the accuracy of image comparison.
[0022] Optionally, according to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection includes:
[0023] Acquire a first target feature related to the target in the first picture;
[0024] According to the first feature vector, determining from the feature library feature vectors that meet the first target feature and satisfy a similarity requirement with the first feature vector to form a first feature vector collection;
[0025] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0026] According to the second feature vector, feature vectors that meet the first target feature and satisfy a similarity requirement with the second feature vector are determined from the feature library to form a second feature vector set.
[0027] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the first feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the first feature vector collection, and the feature vectors in the retrieved first feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined based on the target in the first picture. Then, when the first target feature is met, multiple feature vectors that meet the similarity requirements are determined, and the probability that they are the same target as the target in the first picture is greatly increased. This also improves the accuracy of determining the first feature vector collection. In addition, the feature vectors in the second feature vector collection also meet the first target feature, so the consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0028] Optionally, according to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection includes:
[0029] Acquire a first target feature related to the target in the first picture;
[0030] Acquire a second target feature related to the target in the second picture;
[0031] If the first target feature and the second target feature have an intersection, determining a target feature of the intersection of the first target feature and the second target feature;
[0032] According to the first feature vector, determining from the feature library feature vectors that meet the intersection target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0033] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0034] According to the second feature vector, feature vectors that meet the intersection target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0035] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the feature vector collection, and the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined according to the target in the first picture, the second target feature is determined according to the target in the second picture, and the intersection feature is determined according to the intersection of the first target feature and the second target feature. Then, when the intersection feature is met, multiple feature vectors that meet the similarity requirements are determined, and the probability that the first feature vector collection obtained is the same as the target in the first picture is greatly increased, and the probability that the second feature vector collection obtained is the same as the target in the second picture is also greatly increased. This improves the accuracy of determining the first feature vector collection and the second feature vector collection. The consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0036] Optionally, according to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection, further comprising:
[0037] If there is no intersection between the first target feature and the second target feature, determining a target feature that is a union of the first target feature and the second target feature;
[0038] According to the first feature vector, determining from the feature library feature vectors that meet the union target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0039] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0040] According to the second feature vector, feature vectors that meet the union target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0041] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the feature vector collection, and the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined based on the target in the first picture, and the second target feature is determined based on the target in the second picture. If there is no intersection between the first target feature and the second target feature, then the union feature of the two is determined. Since the union feature is also determined by combining the first target feature and the second target feature, multiple feature vectors that meet the similarity requirements are determined in accordance with the union feature. The probability that the first feature vector collection obtained is the same as the target in the first picture is also very high, and the probability that the second feature vector collection obtained is the same as the target in the second picture is also very high. This improves the accuracy of determining the first feature vector collection and the first feature vector collection. The consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0042] Optionally, before determining, from a feature library according to the first feature vector, feature vectors that meet a similarity requirement with the first feature vector to form a first feature vector collection, the method further includes:
[0043] It is determined that the first feature vector and the second feature vector do not meet a similarity requirement.
[0044] In the case that the first feature vector and the second feature vector do not meet the similarity requirement, determining the first feature vector collection and the second feature vector collection can reduce the workload of the system and improve the accuracy of the final comparison.
[0045] In a second aspect, an embodiment of the present invention further provides an image comparison device, comprising:
[0046] A processing unit, configured to perform feature extraction on the first image and the second image respectively, to obtain a first feature vector of the first image and a second feature vector of the second image;
[0047] A determination unit is used to determine, based on the first feature vector, from a feature library a plurality of feature vectors that meet similarity requirements with the first feature vector to form a first feature vector collection; based on the second feature vector, determine from a feature library a plurality of feature vectors that meet similarity requirements with the second feature vector to form a second feature vector collection; determine whether the collection similarity of the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determine that the target corresponding to the first image and the target corresponding to the second image are the same target.
[0048] Optionally, the determining unit is specifically configured to:
[0049] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0050] An average value of the multiple vector similarities is determined as the collection similarity, and it is determined whether the collection similarity meets a first threshold condition.
[0051] Optionally, the determining unit is specifically configured to:
[0052] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0053] According to the vector similarity, determining the intersection-and-union ratio of the first feature vector collection and the second feature vector collection, and determining the intersection-and-union ratio as the collection similarity; the intersection in the intersection-and-union ratio is the feature vector corresponding to the vector similarity that meets the set condition; the set condition is that the vector similarity meets the similarity requirement and the corresponding feature vectors are not the same;
[0054] Determine whether the collection similarity meets a second threshold condition.
[0055] Optionally, the determining unit is specifically configured to:
[0056] Acquire a first target feature related to the target in the first picture;
[0057] According to the first feature vector, determining from the feature library feature vectors that meet the first target feature and satisfy a similarity requirement with the first feature vector to form a first feature vector collection;
[0058] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0059] According to the second feature vector, feature vectors that meet the first target feature and satisfy a similarity requirement with the second feature vector are determined from the feature library to form a second feature vector set.
[0060] Optionally, the determining unit is specifically configured to:
[0061] Acquire a first target feature related to the target in the first picture;
[0062] Acquire a second target feature related to the target in the second picture;
[0063] If the first target feature and the second target feature have an intersection, determining a target feature of the intersection of the first target feature and the second target feature;
[0064] According to the first feature vector, determining from the feature library feature vectors that meet the intersection target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0065] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0066] According to the second feature vector, feature vectors that meet the intersection target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0067] Optionally, the determining unit is further configured to:
[0068] If there is no intersection between the first target feature and the second target feature, determining a target feature that is a union of the first target feature and the second target feature;
[0069] According to the first feature vector, determining from the feature library feature vectors that meet the union target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0070] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0071] According to the second feature vector, feature vectors that meet the union target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0072] Optionally, the determining unit is further configured to:
[0073] It is determined that the first feature vector and the second feature vector do not meet a similarity requirement.
[0074] In a third aspect, an embodiment of the present invention further provides a computing device, including:
[0075] Memory for storing computer programs;
[0076] The processor is used to call the computer program stored in the memory and execute the image comparison method listed in any of the above-mentioned ways according to the obtained program.
[0077] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the image comparison method listed in any of the above-mentioned methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0079] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present invention;
[0080] Figure 2 A schematic diagram of a flow chart of an image comparison method provided by an embodiment of the present invention;
[0081] Figure 3 A schematic diagram of a flow chart of an image comparison method provided by an embodiment of the present invention;
[0082] Figure 4 A schematic diagram of a flow chart of an image comparison method provided by an embodiment of the present invention;
[0083] Figure 5 A schematic diagram of the structure of an image comparison device provided by an embodiment of the present invention;
[0084] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0085] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0086] Based on the exemplary embodiments described in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the claims attached to this application. In addition, although the disclosure in this application is introduced according to one or several exemplary examples, it should be understood that each aspect of the disclosure can also constitute a complete implementation method separately.
[0087] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0088] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise indicated. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, for example, they can be implemented according to orders other than those given in the diagrams or descriptions of the embodiments of this application.
[0089] In addition, the terms "include" and "have" and any variations thereof are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to those components explicitly listed but may include other components not explicitly listed or inherent to such products or devices.
[0090] Figure 1 A system architecture applicable to an embodiment of the present invention is exemplarily shown. The system architecture may be a server 100 , including a processor 110 , a communication interface 120 , and a memory 130 .
[0091] The communication interface 120 is used to communicate with the terminal device, send and receive information transmitted by the terminal device, and realize communication.
[0092] The processor 110 is the control center of the server 100, and uses various interfaces and routes to connect various parts of the entire server 100, and executes various functions of the server 100 and processes data by running or executing software programs and / or modules stored in the memory 130, and calling data stored in the memory 130. Optionally, the processor 110 may include one or more processing units.
[0093] The memory 130 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing by running the software programs and modules stored in the memory 130. The memory 130 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to business processing, etc. In addition, the memory 130 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0094] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.
[0095] Above Figure 1 The server shown can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0096] Figure 2 A method for image comparison provided by an embodiment of the present invention is shown. For two images to be compared, feature extraction is performed respectively to obtain feature vectors corresponding to the two images. For example, for image A, feature extraction is performed on image A to obtain a first feature vector corresponding to image A. Similarly, a second feature vector corresponding to image B can be obtained.
[0097] Optionally, for any image, target detection may be performed on the image first. If it is determined that there are multiple targets in the image, the region where the target to be compared is located in the image may be segmented to obtain sub-images by image segmentation, and then feature extraction may be performed on the sub-images. The embodiments of the present invention do not limit the methods of target detection and image segmentation.
[0098] Then, the vector similarity between the first eigenvector and the second eigenvector is calculated. Those skilled in the art may select a method for calculating the vector similarity as needed, and the embodiment of the present invention does not limit this.
[0099] If the vector similarity between the first eigenvector and the second eigenvector exceeds a preset threshold, it is determined that the target corresponding to picture A and the target corresponding to picture B are the same target; if it does not exceed the preset threshold, it is determined that the target corresponding to picture A and the target corresponding to picture B are not the same target.
[0100] However, the above method has certain limitations. When the target in picture A and the target in picture B are actually the same target, but are identified as having low similarity due to differences in shooting angles, clothing, makeup, posture, etc., the targets in picture A and picture B will not be confirmed as the same target. In this way, the correct comparison result will be missed, resulting in a low comparison accuracy rate.
[0101] Figure 3 Another method for image comparison provided by an embodiment of the present invention is shown, comprising the following steps:
[0102] Step 301 , extract features from the first picture and the second picture respectively to obtain a first feature vector for the first picture and a second feature vector for the second picture.
[0103] Step 302: According to the first feature vector, a plurality of feature vectors satisfying a similarity requirement with the first feature vector are determined from a feature library to form a first feature vector set.
[0104] Step 303: According to the second feature vector, a plurality of feature vectors satisfying a similarity requirement with the second feature vector are determined from a feature library to form a second feature vector set.
[0105] Step 304, determining whether the collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determining that the target corresponding to the first image and the target corresponding to the second image are the same target.
[0106] The image comparison method provided by the embodiment of the present invention is introduced in detail below.
[0107] In step 301, the embodiment of the present invention does not limit the sources of the first image and the second image. For example, the system may perform image comparison based on multiple images input by the user, or the system may perform image comparison based on the image to be retrieved input by the user and a large number of images in the database during image retrieval.
[0108] There are many methods for extracting features from images, which are not limited in the embodiments of the present invention. For example, a trained feature extraction model may be used. After feature extraction, a first feature vector of the first image and a second feature vector of the second image are obtained.
[0109] In step 302, based on the first feature vector, multiple feature vectors that meet the similarity requirement with the first feature vector are determined from a feature library to form a first feature vector set.
[0110] The embodiment of the present invention does not limit the source of the feature vectors in the feature library. For example, the feature vectors may come from road surveillance images of a certain intersection, road surveillance images of a certain province or even the whole country, ID photos of personnel pre-entered by a company, etc.
[0111] There are feature vectors corresponding to pictures taken at different times and locations in the feature library. The first feature vector is used to calculate the vector similarity with multiple feature vectors in the feature library. The embodiment of the present invention does not limit the method for calculating the vector similarity. For example, the Euclidean distance, cosine distance, etc. between two feature vectors are calculated, and the distance between the two feature vectors is used to represent the vector similarity between the two feature vectors. Two methods for calculating the vector similarity between feature vectors are provided below.
[0112] Method 1
[0113] The cosine distance is calculated to represent the vector similarity.
[0114] Step 1: Calculate the cosine of the angle between the first feature vector and multiple feature vectors in the feature library using the following formula:
[0115]
[0116] Wherein, cosθ is the cosine of the angle, x1 and x2 are two dimensions of the first feature vector, and y1 and y2 are two dimensions of any feature vector in the feature library;
[0117] Step 2: Convert the angle cosine in the range of [-1, 1] to a distance value in the range of [0, 1], wherein the distance value is the vector similarity.
[0118] For example, the first feature vector is (1, 2, 3), and any feature vector in the feature library is (2, 4, 6). The dimensions of the above two feature vectors are both 3. The above is only an example, and the embodiment of the present invention does not limit the dimension of the feature vector.
[0119] Then the cosine of the angle between the first eigenvector and the eigenvector in the eigendata library is:
[0120]
[0121] This means that the angle between the first feature vector and the feature vector in the feature library is 0°, and the similarity between the two is very high. Then the cosine value of the angle is converted into a measure of similarity. For example, (cosine value of the angle + 1) / 2 is determined as the vector similarity between the first feature vector and the feature vector in the feature library. In this example, the vector similarity between the first feature vector and the feature vector in the feature library is 1.
[0122] Method 2
[0123] The similarity is represented by calculating the Euclidean distance.
[0124] Step 1: Calculate the Euclidean distance between the first feature vector and multiple feature vectors in the feature library according to the following formula:
[0125]
[0126] Step 2: Convert Euclidean distance into vector similarity.
[0127] For example, the first feature vector is (1, 2, 3), and any feature vector in the feature library is (2, 4, 6). The dimensions of the above two feature vectors are both 3. The above is only an example, and the embodiment of the present invention does not limit the dimension of the feature vector.
[0128] Then the Euclidean distance between the first eigenvector and the eigenvector in the eigendata library is:
[0129]
[0130] Then the Euclidean distance is converted into a measure of vector similarity. For example, taking the inverse, the vector similarity between the first feature vector and the feature vector in the feature library is obtained as
[0131] After calculating the vector similarity between the first feature vector and each feature vector in the feature library in the above manner, multiple feature vectors that meet the similarity requirements are determined in the feature library to form a first feature vector collection. The similarity requirement can be a restriction on a threshold or a restriction on a quantity. For example, the feature vectors in the feature library whose vector similarity exceeds 0.8 are combined to obtain the first feature vector collection, or the first 100 feature vectors whose vector similarities are sorted in descending order are combined to obtain the first feature vector collection. The embodiment of the present invention does not limit this.
[0132] For example, the final set of first eigenvectors is {(2,1,3), (2,3,5)}.
[0133] In step 303, based on the second feature vector, multiple feature vectors that meet the similarity requirement with the second feature vector are determined from a feature library to form a second feature vector set.
[0134] The process of determining the second set of feature vectors is the same as step 302 and will not be repeated here.
[0135] It should be noted that the embodiment of the present invention does not limit the order of step 302 and step 303, and they may be performed simultaneously.
[0136] In step 304, it is determined whether the collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition. If so, it is determined that the target corresponding to the first image and the target corresponding to the second image are the same target.
[0137] There are many ways to determine the similarity between two collections. The following two methods are provided to determine the similarity between two collections.
[0138] Method 1
[0139] Step 1, determining the vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0140] Step 2: Calculate an average value of multiple vector similarities, and determine whether the average value of the multiple vector similarities meets a first threshold condition.
[0141] For example, the first feature vector set obtained is {a1, a2}, which includes 2 feature vectors; the second feature vector set obtained is {b1, b2, b3}, which includes 3 feature vectors. By calculating the vector similarity between any feature vector in the first feature vector set and any feature vector in the second feature vector set, 6 vector similarities can be obtained, as shown in Table 1.
[0142] The method for calculating vector similarity is the same as described in step 302 and will not be repeated here.
[0143] Table 1
[0144]
[0145] Calculate the average value of the similarities of the six vectors, that is, (c1+c2+c3+c4+c5+c6) / 6, and determine whether the average value meets the first threshold condition. For example, if the first threshold condition is 0.8, if the average value is greater than 0.8, it means that the similarity between the first feature vector collection and the second feature vector collection meets the first threshold condition, thereby determining that the target corresponding to the first image and the target corresponding to the second image are the same target.
[0146] Method 2
[0147] Step 1: Determine the vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection.
[0148] Step 2: According to the vector similarity, determine the intersection-over-union ratio of the first set of feature vectors and the second set of feature vectors, and determine the intersection-over-union ratio as the set similarity; the intersection in the intersection-over-union ratio is the feature vector corresponding to the vector similarity that meets the set conditions; the set conditions are that the vector similarity meets the similarity requirements and the corresponding feature vectors are not the same.
[0149] In the example of method 1, as shown in Table 1, 6 vector similarities are obtained, and the vector similarities that meet the similarity requirements and whose corresponding feature vectors are different are determined among the 6 vector similarities. For example, the vector similarities c1, c2, and c6 meet the similarity requirements, but c1 and c2 both contain the same feature vector a1, then the value with the larger vector similarity is determined in c1 and c2 as the final determined value. If the similarity of c1 is higher, c1 and c6 are determined as vector similarities whose vector similarities meet the set conditions, and the corresponding feature vectors are a1-b1 and a2-b3, then the number of pairs of feature vectors contained in the intersection in the intersection-union ratio is determined to be 2, and the total number of feature vectors in the union of the first feature vector collection and the second feature vector collection is 6, and the ratio is 1 / 3.
[0150] Step three: determine whether the ratio meets the second threshold condition.
[0151] If the ratio meets the second threshold condition, it means that the collection similarity between the first feature vector collection and the second feature vector collection is relatively high.
[0152] The above method is only an example, and the embodiment of the present invention does not limit the method for determining the collection similarity of two feature vector collections.
[0153] If the collection similarity of the two feature vector collections meets the threshold condition, it is determined that the object corresponding to the first picture and the object corresponding to the second picture are the same object.
[0154] Optionally, various modifications may be made to the manner of determining the first feature vector set and the second feature vector set in step 302 and step 303.
[0155] Since there are feature vectors corresponding to pictures of various shooting times and shooting locations in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, when determining the feature vector collection, the target feature is limited. The target feature can be the shooting location and / or shooting time, etc. The embodiment of the present invention does not limit the target feature. In this way, the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the accuracy of the determined feature vector collection will be improved.
[0156] Several specific embodiments are provided below.
[0157] Embodiment 1
[0158] According to the target in the first picture, a related first target feature is determined. According to the first target feature, a first feature vector collection and a second feature vector collection are determined. The target feature includes a spatial feature or a temporal feature.
[0159] For example, the target person M in the first picture lives in Pudong, Shanghai, and often travels to Pudong, Shanghai for business or tourism. In this case, Pudong, Shanghai is determined as the first target feature of the first picture. In short, the determined first target feature is related to the target person in the first picture. In this example, the determined Pudong, Shanghai can retrieve more photos of the target person M.
[0160] Taking the first feature vector as a retrieval sample, multiple feature vectors shot in Pudong, Shanghai and meeting the similarity requirement with the first feature vector are retrieved from the feature library to form a first feature vector collection.
[0161] Similarly, taking the second feature vector as a retrieval sample, multiple feature vectors taken in Pudong, Shanghai and meeting the similarity requirement with the second feature vector are retrieved from the feature library to form a second feature vector collection.
[0162] Optionally, in addition to direct retrieval in the above manner, the following method can also be used: for any feature vector, a target feature library is determined in the feature library based on the first target feature; based on the feature vector, feature vectors that meet the similarity requirements with the feature vector are determined from the target feature library to form a feature vector collection.
[0163] Taking the first feature vector as an example, a target feature library photographed in Pudong, Shanghai is determined in the feature library, the first feature vector is used as a retrieval sample, and multiple feature vectors that meet the similarity requirement with the first feature vector are determined in the feature library to form a first feature vector collection.
[0164] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the first feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the first feature vector collection, and the feature vectors in the retrieved first feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined based on the target in the first picture. Then, when the first target feature is met, multiple feature vectors that meet the similarity requirements are determined, and the probability that they are the same target as the target in the first picture is greatly increased. This also improves the accuracy of determining the first feature vector collection. In addition, the feature vectors in the second feature vector collection also meet the first target feature, so the consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0165] Embodiment 2
[0166] According to the target in the first picture, determine the relevant first target feature. According to the target in the second picture, determine the relevant second target feature. According to the first target feature and the second target feature, determine the intersection feature, and according to the intersection feature, determine the first feature vector collection and the second feature vector collection. Wherein, the target feature includes a spatial feature or a temporal feature.
[0167] For example, if the target person M in the first picture often travels between Shanghai and Nanjing, and the target person N in the second picture often travels between Shanghai and Guangzhou, the intersection of the two, Shanghai, is determined as the intersection feature. In this example, the determined Shanghai can retrieve more photos of the target person M and the target person N.
[0168] Taking the first feature vector as a retrieval sample, multiple feature vectors shot in Shanghai and satisfying the similarity requirement with the first feature vector are retrieved from the feature library to form a first feature vector collection.
[0169] Similarly, taking the second feature vector as a retrieval sample, multiple feature vectors shot in Shanghai and satisfying the similarity requirement with the second feature vector are retrieved from the feature library to form a second feature vector collection.
[0170] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the feature vector collection, and the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined according to the target in the first picture, the second target feature is determined according to the target in the second picture, and the intersection feature is determined according to the intersection of the first target feature and the second target feature. Then, when the intersection feature is met, multiple feature vectors that meet the similarity requirements are determined, and the probability that the first feature vector collection obtained is the same as the target in the first picture is greatly increased, and the probability that the second feature vector collection obtained is the same as the target in the second picture is also greatly increased. This improves the accuracy of determining the first feature vector collection and the second feature vector collection. The consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0171] Embodiment 3
[0172] According to the target in the first picture, determine the relevant first target feature. According to the target in the second picture, determine the relevant second target feature. If there is no intersection between the first target feature and the second target feature, determine the union feature, and determine the first feature vector collection and the second feature vector collection according to the union feature. The target feature includes a spatial feature or a temporal feature.
[0173] For example, the target person M in the first picture often travels between Shanghai and Nanjing, and the target person N in the second picture often travels between Yunnan and Guangzhou. There is no intersection between the two, so the union of the two - Shanghai, Nanjing, Yunnan and Guangzhou is determined as the union feature. In this example, Shanghai, Nanjing, Yunnan and Guangzhou can retrieve more photos of the target person M and the target person N.
[0174] Taking the first feature vector as a retrieval sample, multiple feature vectors shot in Shanghai, Nanjing, Yunnan and Guangzhou and meeting the similarity requirement with the first feature vector are retrieved from the feature library to form a first feature vector collection.
[0175] Similarly, taking the second feature vector as a retrieval sample, multiple feature vectors shot in Shanghai, Nanjing, Yunnan and Guangzhou and satisfying the similarity requirement with the second feature vector are retrieved from the feature library to form a second feature vector collection.
[0176] Since there are feature vectors corresponding to pictures of various target features in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the target features are limited when determining the feature vector collection, and the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined based on the target in the first picture, and the second target feature is determined based on the target in the second picture. If there is no intersection between the first target feature and the second target feature, then the union feature of the two is determined. Since the union feature is also determined by combining the first target feature and the second target feature, multiple feature vectors that meet the similarity requirements are determined in accordance with the union feature. The probability that the first feature vector collection obtained is the same as the target in the first picture is also very high, and the probability that the second feature vector collection obtained is the same as the target in the second picture is also very high. This improves the accuracy of determining the first feature vector collection and the first feature vector collection. The consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of the subsequent determination of the collection similarity between the first feature vector collection and the second feature vector collection is improved.
[0177] Embodiment 4
[0178] According to the target in the first picture, determine the relevant first target feature. According to the target in the second picture, determine the relevant second target feature. Determine the intersection of the first target feature and the second target feature as the intersection feature, and determine the first feature vector collection and the second feature vector collection according to the intersection feature. The target feature includes a spatial feature and a temporal feature.
[0179] For example, the target person M in the first picture frequently traveled between Shanghai and Nanjing from January to June 2021, and the target person N in the second picture frequently traveled between Shanghai and Guangzhou from April to August 2021. The intersection of spatial features and the intersection of temporal features - April to June 2021 + Shanghai is determined as the intersection feature. In this example, Shanghai determined from April to June 2021 can retrieve more photos of the target person M and the target person N.
[0180] Taking the first feature vector as the retrieval sample, multiple feature vectors taken in Shanghai from April to June 2021 and meeting the similarity requirements with the first feature vector are retrieved from the feature library to form the first feature vector collection.
[0181] Similarly, taking the second feature vector as the retrieval sample, multiple feature vectors taken in Shanghai from April to June 2021 and meeting the similarity requirements with the second feature vector are retrieved from the feature library to form a second feature vector collection.
[0182] Since there are feature vectors corresponding to pictures of various shooting locations and shooting times in the feature library, if the feature library is directly searched, the feature vector collection obtained will contain too many feature vectors that do not meet the user's needs. Therefore, the shooting location and shooting time are limited when determining the feature vector collection, and the feature vectors in the retrieved feature vector collection are consistent with the user's needs. At the same time, the first target feature is determined according to the target in the first picture, the second target feature is determined according to the target in the second picture, the intersection time feature is determined according to the first time feature and the second time feature, the intersection space feature is determined according to the first target feature and the second target feature, and the intersection feature is determined according to the intersection space feature and the intersection time feature. Since the intersection feature is also determined by combining the first target feature and the second target feature, multiple feature vectors that meet the similarity requirements are determined in the case of meeting the intersection feature, and the probability that the first feature vector collection obtained is the same target as the target in the first picture is further increased, and the probability that the second feature vector collection obtained is the same target as the target in the second picture is also further increased. This improves the accuracy of determining the first feature vector collection and the first feature vector collection. The consistency of the first feature vector collection and the second feature vector collection is guaranteed. The accuracy of subsequent determination of the similarity between the first feature vector collection and the second feature vector collection is improved.
[0183] Optionally, the first image and the second image may be compared for similarity. If it is determined that the vector similarity between the two exceeds a preset threshold, the target corresponding to the first image and the target corresponding to the second image are the same target, then the comparison is terminated and a display result of "same target" is output; if it is determined that the vector similarity between the two does not exceed the preset threshold, the target corresponding to the first image and the target corresponding to the second image are not the same target, then the following steps are performed. Figure 3 Those skilled in the art may make selections as needed, and the embodiments of the present invention are not limited thereto.
[0184] In order to better explain the embodiment of the present invention, the above-mentioned image comparison process will be described below in a specific implementation scenario. Figure 4 shown.
[0185] Step 401: extract features from the first picture and the second picture to obtain a first feature vector for the first picture and a second feature vector for the second picture.
[0186] Step 402, calculating the vector similarity between the first eigenvector and the second eigenvector;
[0187] Step 403 , determining whether the vector similarity between the first feature vector and the second feature vector meets the similarity requirement, if so, proceeding to step 411 ; if not, proceeding to step 404 .
[0188] Step 404: Acquire a first target feature related to the target in the first image; and acquire a second target feature related to the target in the second image.
[0189] Step 405 , determining whether the first target feature and the second target feature have an intersection, if so, proceeding to step 406 , if not, proceeding to step 407 .
[0190] Step 406: Determine intersection features. The intersection features include intersection spatial features and / or intersection temporal features.
[0191] Step 407: determine the union features. The union features include the union spatial features and / or the union temporal features.
[0192] Step 408: Determine in the feature library that multiple feature vectors that meet the intersection feature and satisfy the similarity requirement with the first feature vector form a first feature vector collection; determine in the feature library that multiple feature vectors that meet the intersection feature and satisfy the similarity requirement with the second feature vector form a second feature vector collection.
[0193] Step 409, determining in the feature library a plurality of feature vectors that meet the union feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection; determining in the feature library a plurality of feature vectors that meet the union feature and satisfy the similarity requirement with the second feature vector to form a second feature vector collection;
[0194] Step 410, determining whether the collection similarity between the first feature vector collection and the second feature vector collection meets the threshold condition, if so, proceeding to step 411, if not, ending the process.
[0195] Step 411: The target corresponding to the first image and the target corresponding to the second image are the same target, and a prompt message "Comparison successful" is displayed.
[0196] Based on the same technical concept, Figure 5 The structure of an image comparison device provided by an embodiment of the present invention is exemplarily shown, and the structure can execute the image comparison process.
[0197] like Figure 5 As shown, the device specifically includes:
[0198] A processing unit 501 is used to extract features from the first picture and the second picture respectively to obtain a first feature vector of the first picture and a second feature vector of the second picture;
[0199] The determination unit 502 is used to determine, based on the first feature vector, from a feature library a plurality of feature vectors that meet the similarity requirement with the first feature vector to form a first feature vector collection; based on the second feature vector, determine, from a feature library a plurality of feature vectors that meet the similarity requirement with the second feature vector to form a second feature vector collection; determine whether the collection similarity of the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determine that the target corresponding to the first image and the target corresponding to the second image are the same target.
[0200] Optionally, the determining unit 502 is specifically configured to:
[0201] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0202] An average value of the multiple vector similarities is determined as the collection similarity, and it is determined whether the collection similarity meets a first threshold condition.
[0203] Optionally, the determining unit 502 is specifically configured to:
[0204] Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection;
[0205] According to the vector similarity, determining the intersection-and-union ratio of the first feature vector collection and the second feature vector collection, and determining the intersection-and-union ratio as the collection similarity; the intersection in the intersection-and-union ratio is the feature vector corresponding to the vector similarity that meets the set condition; the set condition is that the vector similarity meets the similarity requirement and the corresponding feature vectors are not the same;
[0206] Determine whether the collection similarity meets a second threshold condition.
[0207] Optionally, the determining unit 502 is specifically configured to:
[0208] Acquire a first target feature related to the target in the first picture;
[0209] According to the first feature vector, determining from the feature library feature vectors that meet the first target feature and satisfy a similarity requirement with the first feature vector to form a first feature vector collection;
[0210] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0211] According to the second feature vector, feature vectors that meet the first target feature and satisfy a similarity requirement with the second feature vector are determined from the feature library to form a second feature vector set.
[0212] Optionally, the determining unit 502 is specifically configured to:
[0213] Acquire a first target feature related to the target in the first picture;
[0214] Acquire a second target feature related to the target in the second picture;
[0215] If the first target feature and the second target feature have an intersection, determining a target feature of the intersection of the first target feature and the second target feature;
[0216] According to the first feature vector, determining from the feature library feature vectors that meet the intersection target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0217] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0218] According to the second feature vector, feature vectors that meet the intersection target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0219] Optionally, the determining unit 502 is further configured to:
[0220] If there is no intersection between the first target feature and the second target feature, determining a target feature that is a union of the first target feature and the second target feature;
[0221] According to the first feature vector, determining from the feature library feature vectors that meet the union target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection;
[0222] According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes:
[0223] According to the second feature vector, feature vectors that meet the union target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
[0224] Optionally, the determining unit 502 is further configured to:
[0225] It is determined that the first feature vector and the second feature vector do not meet a similarity requirement.
[0226] Based on the same technical concept, the embodiment of the present application provides a computer device, such as Figure 6 As shown, it includes at least one processor 601 and a memory 602 connected to the at least one processor. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6 For example, the processor 601 and the memory 602 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0227] In the embodiment of the present application, the memory 602 stores instructions that can be executed by at least one processor 601, and the at least one processor 601 can perform the steps of the above-mentioned image comparison method by executing the instructions stored in the memory 602.
[0228] The processor 601 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, and perform image comparison by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0229] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0230] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0231] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer-executable program. The computer-executable program is used to enable a computer to execute the image comparison method listed in any of the above-mentioned ways.
[0232] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0233] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0234] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0235] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0236] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An image comparison method, characterized in that: include: Perform feature extraction on the first image and the second image respectively to obtain a first feature vector of the first image and a second feature vector of the second image; According to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection; According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection; Determine whether the collection similarity of the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determine that the target corresponding to the first picture and the target corresponding to the second picture are the same target.
2. The method according to claim 1, characterized in that Determining whether the collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition includes: Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection; An average value of the multiple vector similarities is determined as the collection similarity, and it is determined whether the collection similarity meets a first threshold condition.
3. The method according to claim 1, characterized in that Determining whether the collection similarity between the first feature vector collection and the second feature vector collection meets a threshold condition includes: Determine a vector similarity between any feature vector in the first feature vector collection and any feature vector in the second feature vector collection; According to the vector similarity, determining the intersection-and-union ratio of the first feature vector collection and the second feature vector collection, and determining the intersection-and-union ratio as the collection similarity; the intersection in the intersection-and-union ratio is the feature vector corresponding to the vector similarity that meets the set condition; the set condition is that the vector similarity meets the similarity requirement and the corresponding feature vectors are not the same; Determine whether the collection similarity meets a second threshold condition.
4. The method according to claim 1, characterized in that According to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection includes: Acquire a first target feature related to the target in the first picture; According to the first feature vector, determining from the feature library feature vectors that meet the first target feature and satisfy a similarity requirement with the first feature vector to form a first feature vector collection; According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes: According to the second feature vector, feature vectors that meet the first target feature and satisfy a similarity requirement with the second feature vector are determined from the feature library to form a second feature vector set.
5. The method according to claim 1, characterized in that According to the first feature vector, determining feature vectors that meet similarity requirements with the first feature vector from a feature library to form a first feature vector collection includes: Acquire a first target feature related to the target in the first picture; Acquire a second target feature related to the target in the second picture; If the first target feature and the second target feature have an intersection, determining a target feature of the intersection of the first target feature and the second target feature; According to the first feature vector, determining from the feature library feature vectors that meet the intersection target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection; According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes: According to the second feature vector, feature vectors that meet the intersection target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
6. The method according to claim 5, characterized in that According to the first feature vector, feature vectors satisfying similarity requirements with the first feature vector are determined from a feature library to form a first feature vector collection, further comprising: If there is no intersection between the first target feature and the second target feature, determining a target feature that is a union of the first target feature and the second target feature; According to the first feature vector, determining from the feature library feature vectors that meet the union target feature and satisfy the similarity requirement with the first feature vector to form a first feature vector collection; According to the second feature vector, determining feature vectors that meet similarity requirements with the second feature vector from a feature library to form a second feature vector collection includes: According to the second feature vector, feature vectors that meet the union target feature and satisfy the similarity requirement with the second feature vector are determined from the feature library to form a second feature vector collection.
7. The method according to claim 1, characterized in that Before determining, from a feature library according to the first feature vector, feature vectors that meet a similarity requirement with the first feature vector to form a first feature vector collection, the method further includes: It is determined that the first feature vector and the second feature vector do not meet a similarity requirement.
8. An image comparison device, characterized in that: include: A processing unit, configured to perform feature extraction on the first image and the second image respectively, to obtain a first feature vector of the first image and a second feature vector of the second image; A determination unit is used to determine, based on the first feature vector, from a feature library feature vectors that meet similarity requirements with the first feature vector to form a first feature vector collection; based on the second feature vector, determine from a feature library feature vectors that meet similarity requirements with the second feature vector to form a second feature vector collection; determine whether the collection similarity of the first feature vector collection and the second feature vector collection meets a threshold condition, and if so, determine that the target corresponding to the first image and the target corresponding to the second image are the same target.
9. A computing device, characterized in that include: Memory for storing computer programs; A processor, configured to call a computer program stored in the memory, and execute the method according to any one of claims 1 to 7 according to the obtained program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Target retrieval method and device and electronic equipment
CN108229289A
Image retrieval method and device and electronic equipment
CN110019896A