A repeated sample rapid detection method based on image feature multi-level matching
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]本发明的目的是提供一种基于图像特征多级匹配的重复样本快速检测方法,用于解决现有技术中存在的大规模图像数据重复检测计算复杂度高,基于特征相似性检索结果准确性不足等问题
本发明通过结合轻量化深度特征相似检索和原始图像特征匹配,实现由粗到精的重复检测,通过建立索引实现大规模特征库高效相似查找,基于图像特征匹配精准判定重复样本,并自动生成详细的检测报告,百万个样本图像重复检测报告生成仅耗时0.5小时,重复检测结果准确率高于95%。
Smart Images

Figure CN120596695B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image retrieval, and particularly relates to the fields of intelligent image interpretation, feature detection, and sample duplication detection. Specifically, it is a fast method for detecting duplicate samples based on multi-level matching of image features. Background Technology
[0002] In recent years, deep learning technology has developed rapidly. In the field of intelligent image interpretation, high-performance hardware devices have significantly shortened the development cycle of large-scale parameter models, and larger sample datasets have further promoted the excellent performance of models. However, with the increase in sample size, the repetition checking and evaluation of image samples becomes particularly important, and the supervision and management of sample quality becomes more challenging. Patent CN119493875A discloses an image retrieval system and method based on color moments and deep learning features. It extracts color moments from images, clusters them, constructs an index tree, queries image hierarchical features to generate retrieval image feature vectors, and traverses the index tree based on the retrieval vectors to obtain a candidate set of similar images. The problems with this scheme are: for large-scale feature libraries, conventional similar feature retrieval methods are computationally intensive and cannot meet the needs of rapid repetition detection of massive samples; there is an imbalance between image feature representation ability and feature extraction efficiency, feature vector representation ability and feature library size. Summary of the Invention
[0003] The purpose of this invention is to provide a fast method for detecting duplicate samples based on multi-level matching of image features, which solves the problems of high computational complexity in large-scale image data duplicate detection and insufficient accuracy of feature similarity-based retrieval results in the prior art.
[0004] To achieve the above objectives, the present invention adopts the following technical solution: A fast method for detecting duplicate samples based on multi-level matching of image features, comprising: S1. Normalize and preprocess the massive number of image samples to be repeatedly detected; S2. Efficient construction of image feature vector library based on pre-trained encoder; S3. Fast pre-retrieval based on N most similarity based on image features, where N is a user-defined number of retrievals, and the retrieval results are sorted by similarity; S4. Accurate duplicate detection based on pre-retrieved similar image feature point matching; S5. Duplicate search report generation.
[0005] Furthermore, the normalization preprocessing in step S1 includes: The number of image channels is uniform. For single-channel images, the channel data is copied and stitched together to obtain a three-channel image. For multi-channel images, only the first three channels are used for feature extraction. The image has uniform spatial dimensions and a uniform aspect ratio. For all images to be detected, if r >1.5, retained through cropping r = 1 is the largest image center region, if 1.5>= r >= 1, through image scaling r = 1; Unify the spatial dimensions of the images and scale all images to the same size. s This ensures that the normalized image maintains a dimension of 3. ×s×s .
[0006] Further, step S2 includes: S2.1. Construct an image feature vector extractor based on a pre-trained model; S2.2. Feature vector extraction: Enhancement transformation is performed on each input image sample, including horizontal and vertical image flipping, and 90° clockwise and counterclockwise rotation transformation, for the original image. i The enhanced image is stitched together with multiple transformed samples channel by channel to obtain an enhanced image with 15 channels. S2.3. Establish a mapping relationship between each extracted feature vector and its original image using a unique identifier; S2.4. Image feature library index creation.
[0007] Furthermore, the pre-trained model in S2.1 is an image classification model trained on the ImageNet large-scale image dataset. The image feature extractor is based on the encoder part of the pre-trained model, and its input is the sample data processed in step S1. The image feature extractor outputs a one-dimensional feature vector corresponding to the image. V f The larger the vector length, the more accurate the representation of image features, and the larger the corresponding feature database. Considering the balance between retrieval efficiency and accuracy, the vector... V f length l Set it to 512.
[0008] Furthermore, the feature vector extraction of the sample images in S2.2 is performed through batch processing, with each batch processed... b Each batch of input data has 1 sample, and the scale of each batch is 1. b×15×s×s , b The size depends on the performance of the computing device. The extracted image features are in floating-point format and stored in half-precision format, which reduces the size of the feature library while effectively representing image features.
[0009] Furthermore, in S2.4, the feature library index is divided into multiple clusters based on the cosine similarity of feature vectors, when the total number of sample images... MWhen the value is greater than 256, the feature library is divided into... m Each cluster is organized and managed, among which Each cluster is automatically generated based on a clustering algorithm, and a feature library cluster center is built for each cluster to facilitate rapid location of clusters based on feature similarity.
[0010] Furthermore, S3 specifically involves: obtaining the feature clusters most similar to the feature vector to be retrieved from the feature library cluster centers; and each retrieval only queries the subset containing the feature cluster that is most similar to the feature vector to be retrieved. N Each result returns the similarity score and original image identifier for each search result.
[0011] Furthermore, S4 includes: S4.1. Construction of an image keypoint feature descriptor extractor based on a pre-trained model; S4.2. Based on the constructed extractor model, key point feature descriptions are extracted in batches for each sample image, and the feature descriptors of key points are obtained. The image key point feature descriptors are mapped through the unique identifier of the image. S4.3. Based on the pre-retrieved image feature similarity relationship, query the feature points corresponding to each image involved, perform feature point matching with the similar images obtained in S3, calculate whether the homography matrix formed based on the feature point matching relationship is ill-conditioned, and determine whether it is a duplicate image. The duplicate category includes complete duplication and partial duplication. S4.4. Retain features whose matching degree with the image to be retrieved is greater than a specified threshold. α The system identifies the results and automatically generates attachments containing information on image, feature similarity, and feature point matching.
[0012] Furthermore, the keypoint feature descriptor extractor described in S4.1 outputs a one-dimensional feature descriptor vector of the keypoints of the corresponding image. V p , where vector V p The length is 128. The extractor directly extracts key points and feature descriptions from images based on a deep learning pre-trained model, without the need for model training and optimization. The number of keypoint features extracted from different images in S4.2 varies considerably; only the most salient ones are retained. d If the number of keypoint descriptors is less than 100,000, then the number of keypoint descriptors is less than 100,000. d ,use 0 Vector filling.
[0013] Furthermore, the duplicate retrieval report in S5 includes two parts: an overall duplicate analysis report and a duplicate image retrieval attachment. The overall duplication analysis report includes, but is not limited to, the percentage of complete duplication, the percentage of partial duplication, the maximum number of duplications, the average number of duplications, and a table of duplicate sample information, as well as other global detection results. The duplicate image retrieval attachments correspond to the list items in the overall report, with each item corresponding to a separate attachment file. Each file displays the duplicate results for a specific image sample, including image thumbnails and duplicate matching scores.
[0014] The beneficial effects of this invention are as follows: This invention achieves coarse-to-fine duplicate detection by combining lightweight deep feature similarity retrieval and original image feature matching. It enables efficient similarity search of a large-scale feature library by establishing an index, accurately identifies duplicate samples based on image feature matching, and automatically generates detailed detection reports. The generation of duplicate detection reports for millions of sample images takes only 0.5 hours, and the accuracy of duplicate detection results is higher than 95%. Attached Figure Description
[0015] Figure 1 This is a flowchart of the main method of the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.
[0017] refer to Figure 1 As shown, a fast method for detecting duplicate samples based on multi-level matching of image features includes: S1. Normalize and preprocess the massive number of image samples to be repeatedly detected; S2. Efficient construction of image feature vector library based on pre-trained encoder; S3. Fast pre-retrieval based on N most similarity based on image features, where N is a user-defined number of retrievals, and the retrieval results are sorted by similarity; S4. Accurate duplicate detection based on pre-retrieved similar image feature point matching; S5. Duplicate search report generation.
[0018] Example: First, the image sample set to be repeated detection is... I All image channels are uniformly set to 3. For images with fewer than 3 channels, the channels are copied and stitched together. For images with more than 3 channels, only the data from the first 3 channels is taken. For the image sample set to be repeated detection I Unifying spatial dimensions through image scaling and cropping; for a given image i Aspect Ratio ,in w and h These represent the pixel values occupied by the width and height of the image, respectively.r >1.5, retained through center clipping r = 1 is the largest image region, if 1.5 >= r >= 1, through image scaling r = 1; The cropped image was scaled down to 128 pixels, and the final normalized image spatial dimensions were unified to [value missing]. 3×128×128 ; The image features are extracted using a deep learning model. Based on an image classification model pre-trained on the ImageNet large-scale image dataset, taking a lightweight ResNet18 feature extraction module with 18 network layers as an example, the encoder is used to extract features from the normalized images. i Extracting feature vectors V f By constructing a custom output convolutional layer, the extracted one-dimensional feature vectors can effectively represent image information while having a smaller feature length. The set of features from all image samples constitutes a feature library, represented as... F ; Length of extracted feature vectors l Setting it to 512 and converting the original floating-point format to half-precision floating-point numbers significantly reduces the memory consumption of the feature library while maintaining the feature expressive power and supporting efficient access. To ensure the spatial invariance of image features, during feature vector extraction, each input image sample undergoes enhancement transformations, including horizontal and vertical flipping, and 90° clockwise and counterclockwise rotation; the original image... i The enhanced image is stitched together with multiple transformed samples channel by channel to obtain an enhanced image with 15 channels. Considering the large number of image samples, batch processing is used to improve feature vector extraction efficiency in order to fully utilize computing resources; if each batch processes... b If there are 100 samples, then the scale of the input data is 100. b×15×128×128 , b The size depends on the performance of the computing device; The extracted feature vectors are mapped to the original images using filenames as unique identifiers, so that the subsequent process of accurate matching of repeated images can quickly obtain the information associated with the corresponding images from the retrieved features. For large-scale feature libraries F Conventional similar feature retrieval methods are computationally intensive and cannot meet the needs of rapid repetitive detection of massive samples; assuming the feature library contains 500,000 samples, existing methods require at least 500,000 feature comparisons for a single retrieval. To improve the efficiency of N-most similarity retrieval based on image feature vectors, the constructed feature library is divided into different clusters using cosine similarity, and a fast similar feature retrieval is achieved by establishing an efficient indexing strategy.
[0019] The feature index construction strategy first uses the k-means clustering method to cluster the extracted feature library, and the number of cluster centers... m The calculation method is as follows: ; The above example yielded a total of 707 feature clusters. The cluster center features of each cluster were extracted to organize a multi-level index relationship. When retrieving similar features, the cluster center that is most similar to the feature to be retrieved was obtained first. Then, the most similar features were retrieved only in the cluster corresponding to that cluster center, which significantly reduced the computational cost of feature similarity. After the similar feature vector pre-retrieval, it is necessary to further perform precise matching of image repetition based on image feature points to determine whether images with similar features are duplicates. This embodiment further constructs an image keypoint feature description extractor based on a pre-trained model to extract keypoint feature descriptions in batches from the image sample library to be retrieved; each image sample keypoint is represented by a one-dimensional feature description vector. V p express, V p The length is 128, which provides support for precise matching of repeated images; The image key point feature descriptor extractor extracts the image sample set to be detected from the normalized data processed in step S1. E Obtain the set of key point feature descriptors for each image. P ; The image key point feature descriptor extractor is based on a deep learning pre-trained model, which does not require model training and optimization, and directly extracts key points and feature descriptions from the image. Similar to the construction of image feature libraries, image key point feature descriptions are processed in batches. Image key point feature descriptors establish a mapping relationship through unique image identifiers, enabling fast querying in the process of accurate matching. Due to differences in image detail levels, the number of keypoints extracted from different images varies significantly. To improve matching efficiency, only the most salient keypoints are retained. d Keypoint features, if the number of image keypoint descriptors is less than [number missing] d ,use 0 Vector filling; The repetitive image retrieval method based on feature-based multi-level matching first relies on the constructed image feature database. F Get the most similar N One sample, then from N Each search result is matched with the corresponding image key point features. V p Multi-level matching strategies are used to improve retrieval accuracy and efficiency. Specifically, firstly, based on the constructed image feature library F, for image sample set E Search all images in China N The search process is a primary search, and the returned results contain a unique image identifier. This identifier can be used to query the corresponding image information and image key point feature descriptions in real time. The initial retrieval first obtains the feature clusters most similar to the feature vector to be retrieved from the feature library cluster centers, and then queries the subset containing the feature clusters most similar to the feature vector to be retrieved. N One result; N The number of similar samples to be retrieved is set to a custom value, and the search results are sorted by similarity. N The size selection does not affect the retrieval efficiency; in this embodiment... N Set to 10; Based on the 10 search results obtained from the initial search, image key point feature descriptions were constructed. V p Accurate matching of image repetition; Specifically, firstly, based on the 10 most similar images obtained from the pre-retrieval, a set of key point feature descriptions is generated. P Query the keypoint feature description vector for each image involved. V p ; The key point features of the image to be retrieved are matched with 10 similar images, and the homography matrix formed by the matching relationship is calculated to determine whether it is ill-conditioned and whether it is a duplicate image. The duplicate categories include complete duplication and partial duplication. Based on feature point matching results, retain those whose feature matching degree with key points in the image to be retrieved is greater than a specified threshold. α The identification results are recorded, and the corresponding repetition information is recorded. After all images to be detected have been matched, an image sample set duplicate detection report is generated, including an overall duplicate analysis report and a duplicate image description document attachment. The image sample set E The overall repeatability analysis report includes, but is not limited to, the percentage of completely duplicated images, the percentage of partially duplicated images, the maximum number of times an image is duplicated, the average number of times an image is duplicated, and a table of duplicate sample information, etc., as global detection results. The duplicate image retrieval attachments correspond to information items in the overall report, with each item corresponding to a separate explanatory document attachment. Each file displays the duplicate results for a specific image sample, including the original image, image feature similarity, feature point matching degree, homography matrix visualization, and other information.
[0020] Although the present invention has been described above, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many modifications under the guidance of the present invention without departing from the spirit of the present invention, and these modifications are all within the protection scope of the present invention.
Claims
1. A fast method for detecting duplicate samples based on multi-level matching of image features, characterized in that, include: S1. Normalize and preprocess the massive number of image samples to be repeatedly detected; S2. Efficient construction of image feature vector library based on pre-trained encoder; S3. Fast pre-retrieval based on N most similarity based on image features, where N is a user-defined number of retrievals, and the retrieval results are sorted by similarity; S4. Accurate duplicate detection based on pre-retrieved similar image feature point matching; S5. Duplicate search report generation; The normalization preprocessing in step S1 includes: The number of image channels is uniform. For single-channel images, the channel data is copied and stitched together to obtain a three-channel image. For multi-channel images, only the first three channels are used for feature extraction. The image has uniform spatial dimensions and a uniform aspect ratio. For all images to be detected, if r > 1.5, the largest image center region with r = 1 is retained by cropping; if 1.5 >= r >= 1, r = 1 is made by scaling the image. Here, w and h represent the pixel values occupied by the width and height of the image, respectively. To unify the spatial dimensions of the images, all images are scaled to scale s, so that the dimensions of the normalized images remain 3×s×s. Step S4 includes: S4.
1. Construction of an image keypoint feature descriptor extractor based on a pre-trained model; S4.
2. Based on the constructed extractor model, key point feature descriptions are extracted in batches for each sample image, and the feature descriptors of key points are obtained. The image key point feature descriptors are mapped through the unique identifier of the image. S4.
3. Based on the pre-retrieved image feature similarity relationship, query the feature points corresponding to each image involved, perform feature point matching with the similar images obtained in S3, calculate whether the homography matrix formed based on the feature point matching relationship is ill-conditioned, and determine whether it is a duplicate image. The duplicate category includes complete duplication and partial duplication. S4.
4. Retain the recognition results that match the feature points of the image to be retrieved with a degree greater than a specified threshold α, and automatically generate an attachment containing image, feature similarity, and feature point matching information.
2. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 1, characterized in that, Step S2 includes: S2.
1. Construct an image feature vector extractor based on a pre-trained model; S2.
2. The feature vector extractor performs enhancement transformations on each input image sample, including horizontal and vertical image flipping, and 90° clockwise and counterclockwise rotation transformations. The original image i and multiple transformed samples are sequentially concatenated by channel to obtain an enhanced image with 15 channels. S2.
3. Establish a mapping relationship between each extracted feature vector and its original image using a unique identifier; S2.
4. Image feature library index creation.
3. The method for rapid detection of duplicate samples based on multi-level matching of image features according to claim 2, characterized in that, The pre-trained model in S2.1 is an image classification model trained on the ImageNet large-scale image dataset. The image feature vector extractor is based on the encoder part of the pre-trained model, and its input is the sample data processed in step S1. The image feature extractor outputs a one-dimensional feature vector V corresponding to the image. f The larger the vector length, the more accurate the representation of image features, and the larger the corresponding feature library size. Considering the balance between retrieval efficiency and accuracy, the vector V... f The length l is set to 512.
4. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 3, characterized in that, The feature vector extraction of sample images in S2.2 is carried out through batch processing, with b samples processed in each batch. The input data scale of each batch is b×15×s×s, where the size of b depends on the performance of the computing device. The extracted image features are in floating-point format and stored in half-precision format, which reduces the size of the feature library while effectively representing image features.
5. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 4, characterized in that, In S2.4, the feature library index is divided into multiple clusters based on the cosine similarity of feature vectors. When the total number of sample images M > 256, the feature library is divided into m clusters for organization and management. Each cluster is automatically generated based on a clustering algorithm, and a feature library cluster center is built for each cluster to facilitate rapid location of clusters based on feature similarity.
6. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 5, characterized in that, S3 specifically involves: obtaining the feature clusters most similar to the feature vector to be retrieved from the feature library cluster centers; querying only the N results most similar to the feature vector to be retrieved in the subset of the feature cluster; and returning the similarity and original image identifier of each retrieval result.
7. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 6, characterized in that, The keypoint feature descriptor extractor described in S4.1 outputs a one-dimensional feature descriptor vector V for the keypoints of the corresponding image. p , where vector V p The length is 128. The extractor directly extracts key points and feature descriptions from the image based on a deep learning pre-trained model, without the need for model training and optimization. In S4.2, the number of key point features extracted from different images varies greatly. Only the most significant d feature points are retained. If the number of key point descriptors is less than d, they are filled with a 0 vector.
8. The method for fast detection of duplicate samples based on multi-level matching of image features according to claim 7, characterized in that: The duplicate retrieval report in S5 includes two parts: an overall duplicate analysis report and duplicate image retrieval attachments. The overall duplication analysis report includes, but is not limited to, the percentage of complete duplication, the percentage of partial duplication, the maximum number of duplications, the average number of duplications, and a duplicate sample information table; The duplicate image retrieval attachments correspond to the list items in the overall report, with each item corresponding to a separate attachment file. Each file displays the duplicate results for a specific image sample, including image thumbnails and duplicate matching scores.
Citation Information
Patent Citations
Image retrieval system and method based on color moment and deep learning features
CN119493875A
Repeated image retrieval method and device, equipment and storage medium
CN115129915A