An image search method and related device
By performing dimensionality reduction processing and group comparison of the image library, the problem of large memory usage and long time consumption in image retrieval is solved, and efficient and accurate image retrieval is achieved.
Patent Information
- Application Number
- CN202111403188.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2041-11-24
AI Technical Summary
In the prior art, the image retrieval method occupies a large amount of memory space and consumes time, especially in the processing of massive image data in the security and monitoring fields, and linear retrieval efficiency is low.
The image base library is constructed by dimensionality reduction processing on the original image library, and feature comparison is used for feature comparison, dimensionality reduction search images are selected in group comparison, and then secondary feature comparison is performed to determine the target image.
It reduces memory space usage, improves the efficiency and accuracy of image retrieval, and shortens the search time.
Smart Images

Figure CN114154006B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to an image search method and related device. Background Art
[0002] With the development of technology, image retrieval technology has become increasingly mature. Image retrieval technology obtains images similar to the image to be searched by comparing the feature vectors extracted from the image to be searched with the images in the image library.
[0003] In related technologies, linear retrieval is mostly used to retrieve image features. The so-called linear retrieval is to perform global feature comparison on all images in the image library through the feature vectors of the image to be searched. In today's security, monitoring and other fields, hundreds of millions of image data are accumulated, and the dimensionality of the vectorized features is hundreds or thousands. This method of comprehensively retrieving the stored images occupies a large amount of memory space and takes a long time. Summary of the Invention
[0004] Embodiments of the present application provide an image search method and related device to at least improve the efficiency of image search.
[0005] In a first aspect, embodiments of the present application provide an image search method, the method includes:
[0006] Performing dimensionality reduction processing on each image to be processed in the image set to be processed, and obtaining the dimensionality reduction features of the image to be searched;
[0007] Based on the dimensionality reduction features, screening out a first number of dimensionality reduction images from the image base as dimensionality reduction retrieval images; wherein, the image base is a set of dimensionality reduction images obtained by dimensionality reduction processing of the original images in the original image library, and the number of image features of each dimensionality reduction image in the image base is the same as the number of dimensionality reduction features of the image to be searched;
[0008] Based on the dimensionality reduction retrieval images, determining a retrieval image set from the original image library, the retrieval image set being a set of original images of each dimensionality reduction retrieval image;
[0009] Performing feature comparison on the retrieval image set according to the image to be processed, and determining a target image from the retrieval images based on the comparison result.
[0010] In the embodiments of the present application, the original images in the original image library are pre-dimensionally reduced to construct an image base library. After the images to be processed are dimensionally reduced, the number of features of each image to be processed is the same as that of the dimensionally reduced images in the image base library. Feature comparison is performed on the image base library based on the dimensionally reduced features to determine the dimensionally reduced retrieval images with high similarity to the images to be processed, thereby narrowing the retrieval scope. There is a certain loss in feature comparison using the dimensionally reduced features compared to the non-dimensionally reduced image features. To improve the retrieval accuracy, the embodiments of the present application determine the retrieval image set corresponding to the dimensionally reduced retrieval images from the original image library, and perform secondary feature comparison based on the images to be processed and the retrieval image set to determine the target images. The above process reduces the occupation of memory space by performing similarity comparison using the dimensionally reduced features, improving the retrieval efficiency. After narrowing the retrieval scope, secondary feature comparison is performed using the non-dimensionally reduced image features of the images to be processed and the retrieval image set to improve the retrieval accuracy of the target images.
[0011] In some possible embodiments, screening out a first number of dimensionally reduced images from the image base library based on the dimensionally reduced features includes:
[0012] Dividing the images to be processed into multiple groups;
[0013] For any group of images to be processed, performing feature comparison between the images to be processed and the dimensionally reduced images in the image base library to obtain the feature similarity between each image to be processed in the group of images to be processed and the dimensionally reduced images;
[0014] Based on the feature comparison results of each group of images to be processed, selecting a second number of dimensionally reduced images from each group of images to be processed;
[0015] Based on the feature comparison results of the selected dimensionally reduced images, selecting a first number of dimensionally reduced images from the selected dimensionally reduced images, and the first number of dimensionally reduced images are the dimensionally reduced retrieval images.
[0016] When the embodiments of the present application perform feature comparison on the image base library using the dimensionally reduced features, a grouping comparison method is adopted. By dividing the images to be processed into multiple groups, for each group of images to be processed, feature comparison is performed between the images to be processed and the dimensionally reduced images in the image base library, and a second number of dimensionally reduced images are screened out from each group according to the comparison results. Then, a first number of dimensionally reduced images are selected from all the screened-out dimensionally reduced images as the dimensionally reduced retrieval images, thereby improving the retrieval efficiency.
[0017] In some possible embodiments, performing feature comparison between the images to be processed and the dimensionally reduced images in the image base library includes:
[0018] Dividing the dimensionally reduced images in the image base library into multiple groups;
[0019] For any set of dimension-reduced images, compare the image to be processed with each dimension-reduced image to obtain the feature similarity between the image to be processed and each dimension-reduced image.
[0020] In the embodiments of the present application, when comparing the features of each set of images to be processed with the dimension-reduced images in the image database, a grouped comparison method can be adopted. By dividing the dimension-reduced images in the image database into multiple groups, and for each group of dimension-reduced images, comparing the image to be processed with each dimension-reduced image to obtain the feature similarity between the image to be processed and each dimension-reduced image, thereby improving the retrieval efficiency.
[0021] In some possible embodiments, the selecting, from each set of images to be processed, a second number of dimension-reduced images based on the feature comparison result of each set of images to be processed includes:
[0022] Selecting a third number of dimension-reduced images from each set of dimension-reduced images based on the feature comparison result of each set of dimension-reduced images;
[0023] Selecting a second number of dimension-reduced images from the selected dimension-reduced images based on the feature comparison result of the selected dimension-reduced images.
[0024] In the embodiments of the present application, a third number of dimension-reduced images are selected from each set of dimension-reduced images according to the feature comparison result of each set of dimension-reduced images, and based on all the selected dimension-reduced images, a second number of dimension-reduced images are selected therefrom. The second number of dimension-reduced images obtained in this way are the images with the highest similarity to the image to be processed among all the dimension-reduced images.
[0025] In some possible embodiments, each original image is provided with a unique image label in the original image set, and each dimension-reduced image has the same image label as the original image corresponding to the dimension-reduced image; the determining, from the original image library, a retrieval image set based on the dimension-reduced retrieval image includes:
[0026] Identifying the image label of the dimension-reduced retrieval image;
[0027] Obtaining, from the original image set, the original image with the same image label as the dimension-reduced retrieval image, and determining the retrieval image set according to the original image.
[0028] In the embodiments of the present application, the original images are pre-provided with image labels, and the original images and the dimension-reduced images after dimension reduction have the same image labels. Thus, after determining the dimension-reduced retrieval image from the image database, the corresponding original image can be traced through the image label of the dimension-reduced retrieval image, and the retrieval image set is determined accordingly.
[0029] In some possible embodiments, the step of performing feature comparison on the retrieved image set according to the image to be processed and determining a target image from the retrieved images based on the comparison result includes:
[0030] Obtain the original image features of the image to be processed, where the original image features are the image features of the image to be processed without dimensionality reduction.
[0031] Perform feature comparison between the original image features and the retrieved image set to obtain a target image with the highest similarity to the image to be processed.
[0032] In the embodiments of the present application, when determining the target image, feature comparison is performed between the image features of the image to be processed without dimensionality reduction and the retrieved image set, thereby avoiding the loss caused by using dimensionality-reduced features for feature comparison and improving the retrieval accuracy.
[0033] In some possible embodiments, the image base is determined in the following manner:
[0034] For each original image in the original image library, perform dimensionality reduction on the original image to obtain a dimensionality-reduced image; wherein, the number of image features of the dimensionality-reduced image is less than the number of image features of the original image, and the ratio of the number of image features of the dimensionality-reduced image to the number of image features of the original image is a preset ratio.
[0035] Perform quantization processing on the image features of the dimensionality-reduced image so that the number of bytes of the image features of each dimensionality-reduced image in the image base is less than the number of bytes before quantization processing.
[0036] In the embodiments of the present application, dimensionality reduction is performed on the original image library to obtain dimensionality-reduced images, and quantization processing is performed on the image features of the dimensionality-reduced images to reduce the number of bytes of the image features of the dimensionality-reduced images. Thus, the data volume of the image base composed of dimensionality-reduced images is greatly reduced compared to the original image library, thereby reducing the memory space occupation.
[0037] In some possible embodiments, before comparing the features of the image to be processed with the dimensionality-reduced images in the image base, the method further includes:
[0038] Perform inverse quantization processing on the dimensionality-reduced image, and the feature type of the image features of the dimensionality-reduced image after inverse quantization processing is the same as that of the image features of the original image corresponding to the dimensionality-reduced image.
[0039] The dimensionality-reduced images in the embodiments of the present application have smaller memory occupation after quantization processing. It is necessary to perform inverse quantization on the dimensionality-reduced images before comparing the features of the image to be processed with the dimensionality-reduced images to ensure the retrieval accuracy.
[0040] In some possible embodiments, the type of the image features of the dimensionality-reduced image after quantization processing is an integer type.
[0041] After the embodiments of the present application perform quantization processing on the image features of the dimensionality-reduced image, the type of the image features is changed to the integer type int, so that the number of bytes of the image features is 2, thereby reducing the memory occupation.
[0042] In a second aspect, the embodiments of the present application provide an image search device, and the device includes:
[0043] A dimensionality-reduced feature acquisition module, which performs dimensionality reduction processing on each to-be-processed image in the to-be-processed image set to obtain the dimensionality-reduced features of the to-be-searched image;
[0044] A dimensionality-reduced image screening module, which screens out a first number of dimensionality-reduced images from the image database as dimensionality-reduced retrieval images based on the dimensionality-reduced features; wherein, the image database is a set of dimensionality-reduced images obtained by dimensionality reduction processing of the original images in the original image database, and the number of image features of each dimensionality-reduced image in the image database is the same as the number of dimensionality-reduced features of the to-be-searched image;
[0045] A retrieval image determination module, which determines a retrieval image set from the original image database based on the dimensionality-reduced retrieval images, and the retrieval image set is a set of original images of each dimensionality-reduced retrieval image;
[0046] A target image determination module, which performs feature comparison on the retrieval image set according to the to-be-processed image, and determines a target image from the retrieval images based on the comparison result.
[0047] In some possible embodiments, when performing the operation of screening out a first number of dimensionality-reduced images from the image database as dimensionality-reduced retrieval images based on the dimensionality-reduced features, the dimensionality-reduced image screening module is configured to:
[0048] Divide the to-be-processed image set into multiple groups;
[0049] For any group of to-be-processed images, perform feature comparison between the to-be-processed images and the dimensionality-reduced images in the image database to obtain the feature similarity between each to-be-processed image in the group of to-be-processed images and the dimensionality-reduced images;
[0050] Based on the feature comparison results of each group of to-be-processed images, respectively select a second number of dimensionality-reduced images from each group of to-be-processed images;
[0051] Based on the feature comparison results of the selected dimensionality-reduced images, select a first number of dimensionality-reduced images from the selected dimensionality-reduced images, and the first number of dimensionality-reduced images are the dimensionality-reduced retrieval images.
[0052] In some possible embodiments, when performing the feature comparison between the image to be processed and the dimensionality-reduced images in the image database, the dimensionality-reduced image screening module is configured to:
[0053] Divide the dimensionality-reduced images in the image database into multiple groups;
[0054] For any group of dimensionality-reduced images, perform feature comparison between the image to be processed and each dimensionality-reduced image to obtain the feature similarity between the image to be processed and each dimensionality-reduced image.
[0055] In some possible embodiments, when performing the selection of the second quantity of dimensionality-reduced images from each group of images to be processed based on the feature comparison results of each group of images to be processed, the dimensionality-reduced image screening module is configured to:
[0056] Based on the feature comparison results of each group of dimensionality-reduced images, select the third quantity of dimensionality-reduced images from each group of dimensionality-reduced images;
[0057] Based on the feature comparison results of the selected dimensionality-reduced images, select the second quantity of dimensionality-reduced images from the selected dimensionality-reduced images.
[0058] In some possible embodiments, each original image is provided with an image label that is unique in the original image set, and each dimensionality-reduced image has the same image label as the original image corresponding to the dimensionality-reduced image; when performing the determination of the retrieval image set from the original image database based on the dimensionality-reduced retrieval image, the retrieval image determination module is configured to:
[0059] Identify the image label of the dimensionality-reduced retrieval image;
[0060] Obtain the original image with the same image label as the dimensionality-reduced retrieval image from the original image set, and determine the retrieval image set according to the original image.
[0061] In some possible embodiments, when performing the feature comparison on the retrieval image set according to the image to be processed and determining the target image from the retrieval images based on the comparison results, the target image determination module is configured to:
[0062] Obtain the original image features of the image to be processed, where the original image features are the image features of the image to be processed without dimensionality reduction;
[0063] Perform feature comparison between the original image features and the retrieval image set to obtain the target image with the highest similarity to the image to be processed.
[0064] In some possible embodiments, the image database is determined according to the following method:
[0065] For each original image in the original image library, perform dimensionality reduction processing on the original image to obtain a dimensionality-reduced image; wherein, the number of image features of the dimensionality-reduced image is less than the number of image features of the original image, and the ratio of the number of image features of the dimensionality-reduced image to the number of image features of the original image is a preset ratio;
[0066] Perform quantization processing on the image features of the dimensionality-reduced image, so that the number of bytes of the image features of each dimensionality-reduced image in the image base is less than the number of bytes before quantization processing.
[0067] In some possible embodiments, before performing the feature comparison between the image to be processed and the dimensionality-reduced images in the image base, the dimensionality-reduced image screening module is further configured to:
[0068] Perform inverse quantization processing on the dimensionality-reduced image, and the feature type of the image features of the dimensionality-reduced image after inverse quantization processing is the same as the feature type of the image features of the original image corresponding to the dimensionality-reduced image.
[0069] In some possible embodiments, the image feature type of the dimensionality-reduced image after performing quantization processing on the image features of the dimensionality-reduced image is an integer type.
[0070] In a third aspect, an embodiment of the present application further provides an electronic device, including at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a file search method for a target object provided by an embodiment of the present application.
[0071] In a fourth aspect, an embodiment of the present application further provides a computer storage medium, and the computer storage medium stores a computer program, and the computer program is used to enable a computer to execute a file search method for a target object provided by an embodiment of the present application.
[0072] Other features and advantages of the present application will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present application. The objectives and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the written specification, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. Obviously, the following introduced drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0074] Figure 1 Schematic diagram of the application scenario shown in the embodiments of the present application;
[0075] Figure 2a Overall flowchart of an image search method shown in the embodiments of the present application;
[0076] Figure 2b Schematic diagram of reducing memory space occupation shown in the embodiments of the present application;
[0077] Figure 2c Schematic diagram of determining the dimensionality-reduced retrieval image shown in the embodiments of the present application;
[0078] Figure 2d Schematic diagram of feature comparison shown in the embodiments of the present application;
[0079] Figure 3 Structural diagram of an image search device 300 shown in the embodiments of the present application;
[0080] Figure 4 Schematic diagram of an electronic device shown in the embodiments of the present application. Detailed implementation manners
[0081] Next, the technical solutions in the embodiments of the present application will be clearly and elaborately described with reference to the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " will represent "or", for example, A / B may represent A or B; the "and / or" in the text is only a description of the association relationship of the associated objects, indicating that there can be three relationships, for example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0082] In the description of the embodiments of the present application, unless otherwise specified, the term "a plurality of" means two or more than two, and other quantifiers are similar. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. And without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0083] To further illustrate the technical solutions provided by the embodiments of the present application, the following will be described in detail with reference to the accompanying drawings and specific implementation manners. Although the embodiments of the present application provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or non-creative labor. In steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of the present application. When the method is actually processed or executed by the control device, it can be executed in the method order shown in the embodiments or drawings or executed in parallel.
[0084] Image retrieval technology is widely used. Taking face feature retrieval as an example, when solving cases in the public security industry, it is necessary to retrieve a large number of portraits in the image library based on the image of a suspect with an unknown identity to obtain the identity information of the suspect. In related technologies, after extracting the image features of the image to be searched, the image features are fully pulled into the memory. By comparing the features with the stored images (i.e., the image library), and outputting the images with a similarity higher than the preset threshold. However, this way of comprehensively retrieving the stored images occupies a large amount of memory space and takes a long time.
[0085] To solve the above problems, the inventive concept of this application is as follows: In the embodiments of this application, the original images in the original image library are pre-dimensionally reduced to construct an image base library. After dimensionally reducing the images to be processed, the number of features of each image to be processed is the same as that of the dimensionally reduced images in the image base library. Thus, feature comparison can be performed on the image base library based on the dimensionally reduced features to determine the dimensionally reduced retrieval images with a higher similarity to the images to be processed. Since there is a certain loss in performing feature comparison using dimensionally reduced features compared to non-dimensionally reduced image features, to improve the retrieval accuracy, the embodiments of this application determine the retrieval image set corresponding to the dimensionally reduced retrieval images from the original image library, and perform secondary feature comparison based on the images to be processed and the retrieval image set to determine the target images. The above process reduces the occupation of memory space by performing similarity comparison using dimensionally reduced features, thereby improving the retrieval efficiency.
[0086] First, the images to be processed and the original images in the embodiments of this application are described:
[0087] The images to be processed in the embodiments of this application can be any images with retrieval requirements, such as but not limited to including face images, human body images, animal images, plant images, building images, vehicle images, commodity or item images, etc.; the original images are the video frame images captured by, for example, a network video recorder (NVR, Network Video Recorder), or single-frame images captured by other image acquisition devices, such as but not limited to including face images, human body images, animal images, plant images, building images, vehicle images, commodity or item images, etc.; in the following content of the embodiments of this application, a face image is used as a specific example of the image to be processed to further describe the image search method and related devices provided by this application.
[0088] The following further details the file search method for the target object in the embodiments of this application with reference to the accompanying drawings.
[0089] See Figure 1 , which is a schematic diagram of the application environment according to an embodiment of this application.
[0090] Such asFigure 1 As shown, the application environment may include, for example, a network 10, a server 20, at least one terminal device 30, and a database 40. Among them, the terminal device 30 may include Figure 1 the smartphones 30_1, desktop computers 30_2, and laptop computers 30_n shown in
[0091] In Figure 1 the application scenario shown, the user inputs multiple images to be searched into the terminal device 30, and the terminal device 30 sends the images to be searched to the server 20 through the network 10. The server 20 determines the dimensionality-reduced features of the image to be processed by performing dimensionality reduction on the image to be processed, so that the number of features of the dimensionality-reduced features is the same as that of each dimensionality-reduced image in the pre-stored image library in the database 40.
[0092] In some possible embodiments, the server 20 retrieves the pre-stored image library in the database 40 based on the dimensionality-reduced features, and retrieves the top n images with the highest similarity, where n is an integer. Further, the original images of the n images are determined, and each original image is the image before dimensionality reduction of the n images.
[0093] In some possible embodiments, the image features of the image to be processed without dimensionality reduction are compared with each original image to determine the target image with the highest similarity.
[0094] After introducing the application scenarios applicable to the technical solution of the present application, the following will describe in detail an image search method provided by an embodiment of the present application with reference to the accompanying drawings, specifically as Figure 2a shown, including the following steps:
[0095] Step 201: Perform dimensionality reduction on each image to be processed in the image set to be processed, and obtain the dimensionality-reduced features of the image to be searched;
[0096] The following takes a standard image with 512 dimensions and float floating point type as the image to be processed and the original images in the original image library as an example for illustration. It should be understood that the above limitations on the number and type of image features are only for facilitating the description of the technical solution provided by the present application, rather than limiting the scope of application of the present application.
[0097] The embodiment of the present application pre-performs dimensionality reduction on the image to be processed, reduces the dimension of the image to be processed to 256 dimensions, and thus the memory occupied by the image to be processed is reduced by half.
[0098] Step 202: Based on the dimensionality-reduced features, select a first number of dimensionality-reduced images from the image database as dimensionality-reduced retrieval images; wherein, the image database is a set of dimensionality-reduced images obtained by dimensionality reduction processing of the original images in the original image database, and the number of image features of each dimensionality-reduced image in the image database is the same as the number of dimensionality-reduced features of the image to be searched.
[0099] Image retrieval technology needs to search for target images similar to the image to be searched in the image database according to the image to be searched. As mentioned above, for the sake of convenience of description, the face image is used as the image to be searched in the embodiments of the present application. Correspondingly, the original image database in the embodiments of the present application is a video frame image database or a portrait database constructed based on an image acquisition device in fields such as security.
[0100] In the embodiments of the present application, each original image in the original image database is preprocessed by dimensionality reduction to obtain a dimensionality-reduced image. The number of image features of each dimensionality-reduced image should be the same as the number of dimensionality-reduced features of the image to be searched. The number of image features of the dimensionality-reduced image is less than the number of image features of the original image, and the ratio of the number of image features of the dimensionality-reduced image to the number of image features of the original image is a preset ratio. Specifically, Figure 2b as shown, for example, if the original image is 512-dimensional, then the dimensionality-reduced image is 256-dimensional. Further, quantization processing is performed on the dimensionality-reduced image. The purpose of quantization processing is to change the type of image features of the dimensionality-reduced image. Specifically, if the original image is of float type, then the dimensionality-reduced image obtained after dimensionality reduction processing is also of float type. By performing quantization processing on the float-type dimensionality-reduced image, the dimensionality-reduced image is changed to int type, so that it is reduced from 8 bytes to 2 bytes.
[0101] Through the above processing, when the original image with 512 dimensions and float type is changed to a 256-dimensional and int-type dimensionality-reduced image, the image feature dimension is reduced to half of the original, reducing the memory occupation by half. Further, changing the image features of the original float-type dimensionality-reduced image to int type reduces the number of bytes to one-fourth of the original, and the memory occupation is reduced by 4 times. Thus, the image database constructed according to each dimensionality-reduced image occupies 8 times less memory than the original image database. Considering that face feature retrieval in practical applications is mostly a batch processing process. That is, multiple face images captured by an NVR (Network Video Recorder) or other electronic devices are stored in the memory, and the image database is retrieved in a batch comparison manner to determine the target image corresponding to each image to be processed (that is, the image with the highest similarity to each image to be processed in the image database).
[0102] Based on this, after obtaining the dimensionality-reduced features of each image to be processed in the image set to be processed, each image to be processed can be quantized into an int type and stored in memory to reduce the memory occupancy. When performing feature comparison, first divide the image set to be processed into multiple groups. For any group of images to be processed, compare the features of the images to be processed with the dimensionality-reduced images in the image database to obtain the feature similarity between each image to be processed in the group of images to be processed and the dimensionality-reduced images. Then, based on the feature comparison results of each group of images to be processed, select a second number of dimensionality-reduced images from each group of images to be processed. And based on the feature comparison results of the selected dimensionality-reduced images, select a first number of dimensionality-reduced images from the selected dimensionality-reduced images as the dimensionality-reduced retrieval images.
[0103] Specifically, it can be as Figure 2c shown. For example, there are a total of 100 images in the image set to be processed. First, divide the 100 images to be processed into groups of 10, for a total of 10 groups, numbered 1 to 10. Then perform feature comparison on each group of images to be processed, and select the top 10 dimensionality-reduced images with the highest similarity according to the feature comparison results. Then select the 10 images with the highest similarity from the 10 dimensionality-reduced images selected from each group (a total of 100 images) as the dimensionality-reduced retrieval images.
[0104] Also, considering that the method of grouping and comparing can effectively improve the retrieval rate, when comparing the features of the images to be processed with the dimensionality-reduced images in the image database, the dimensionality-reduced images in the image database can be divided into multiple groups, and for any group of dimensionality-reduced images, compare the features of the images to be processed with each dimensionality-reduced image to obtain the feature similarity between the images to be processed and each dimensionality-reduced image. Then, based on the feature comparison results of each group of dimensionality-reduced images, select a third number of dimensionality-reduced images from each group of dimensionality-reduced images. Based on the feature comparison results of the selected dimensionality-reduced images, select a second number of dimensionality-reduced images from the selected dimensionality-reduced images.
[0105] Specifically, it can be as Figure 2d shown. For example, there are a total of 100 images in the image set to be processed, and a total of 10,000 dimensionality-reduced images in the image database. First, divide the 100 images to be processed into groups of 10, for a total of 10 groups, numbered 1 to 10. Then divide the dimensionality-reduced images into groups of 1000, for a total of 10 groups, numbered a to j. Taking group 10 of the images to be processed as an example, when performing feature comparison on each group of images to be processed, compare with each group from a to j respectively, and according to the feature comparison results of each group, screen out the top 10 images with the highest similarity, a total of 100 images are screened out, and select the 10 images with the highest similarity from the 100 images screened out as the 10 dimensionality-reduced images with the highest similarity obtained by the feature comparison of this group of images to be processed.
[0106] It should be further noted that, as mentioned above, both the image base stored in the memory and the dimensionality-reduced features of the image to be processed are of int type. To improve the retrieval accuracy, the image to be processed and the dimensionality-reduced image should be dequantized before feature comparison, that is, changed from int type to float type. Since the embodiments of the present application perform feature comparison in groups, the computational amount each time (i.e., when performing feature comparison for each group) is much lower than that of global feature comparison, and the resource occupancy of dequantization processing is very small. After testing, this method can still effectively improve the computational efficiency compared with global feature comparison.
[0107] Step 203: Based on the dimensionality-reduced retrieval image, determine a retrieval image set from the original image library, where the retrieval image set is a set of original images of each dimensionality-reduced retrieval image;
[0108] In the embodiments of the present application, each original image is provided with an image label unique in the original image set, and the image label of each dimensionality-reduced image is the same as that of the original image corresponding to the dimensionality-reduced image. That is, the image label of the dimensionality-reduced image after the original image undergoes dimensionality reduction processing is the same as that of the original image. Since the dimensionality-reduced retrieval image mentioned above is selected from the image base, its essence is still a dimensionality-reduced image. Based on this, after obtaining the dimensionality-reduced retrieval image, the original image corresponding to each dimensionality-reduced retrieval image can be determined by querying the image label of the dimensionality-reduced retrieval image and retrieving the original image library based on the image label, and the retrieved original images are the retrieval image set.
[0109] Step 204: Perform feature comparison on the retrieval image set according to the image to be processed, and determine a target image from the retrieval images based on the comparison result.
[0110] Considering that there will be a certain loss when performing feature comparison using dimensionality-reduced features, and its retrieval accuracy is lower than that of non-dimensionality-reduced image features. Therefore, when performing feature comparison on the retrieval image set according to the image to be processed and determining the target image based on the comparison result, first determine the original image features of the image to be processed, and the original image features are the image features of the image to be processed without dimensionality reduction processing. Then use the original image features to perform feature comparison with the retrieval image set to obtain the target image with the highest similarity to the image to be processed. Since the amount of data for comparison in this retrieval stage is greatly reduced, the retrieval time consumption can be ignored, and the time consumption in this stage is mainly reflected in the database query stage, that is, the process of obtaining the retrieval image set. By adopting parallelism and some database query operation optimizations, the time consumption in this stage can be effectively reduced.
[0111] Accordingly, in the above process of the embodiments of the present application, dimensionality reduction features are first used for similarity comparison to reduce the occupation of memory space and improve the retrieval efficiency. Then, after narrowing the retrieval range (i.e., after determining the dimensionality reduction retrieval images from the original image library), the dimensionality-reduced image features of the to-be-processed images are used to perform secondary feature comparison with the retrieval image set to improve the retrieval accuracy of the target images.
[0112] Based on the same inventive concept, the embodiments of the present application provide a face feature search device 300, specifically as Figure 3 shown, including: a dimensionality reduction feature acquisition module 301, configured to perform dimensionality reduction processing on each to-be-processed image in the to-be-processed image set to obtain the dimensionality reduction features of the to-be-searched image;
[0113] The dimensionality reduction feature acquisition module 301 performs dimensionality reduction processing on each to-be-processed image in the to-be-processed image set to obtain the dimensionality reduction features of the to-be-searched image;
[0114] A dimensionality reduction image screening module 302, based on the dimensionality reduction features, screens out a first number of dimensionality reduction images from the image base as dimensionality reduction retrieval images; wherein, the image base is a set of dimensionality reduction images obtained by dimensionality reduction processing of the original images in the original image library, and the number of image features of each dimensionality reduction image in the image base is the same as the number of dimensionality reduction features of the to-be-searched image;
[0115] A retrieval image determination module 303, based on the dimensionality reduction retrieval images, determines a retrieval image set from the original image library, and the retrieval image set is a set of original images of each dimensionality reduction retrieval image;
[0116] A target image determination module 304 performs feature comparison on the retrieval image set according to the to-be-processed image, and determines a target image from the retrieval images based on the comparison result.
[0117] In some possible embodiments, when performing the operation of screening out a first number of dimensionality reduction images from the image base as dimensionality reduction retrieval images based on the dimensionality reduction features, the dimensionality reduction image screening module 302 is configured to:
[0118] Divide the to-be-processed image set into multiple groups;
[0119] For any group of to-be-processed images, perform feature comparison between the to-be-processed images and the dimensionality reduction images in the image base to obtain the feature similarity between each to-be-processed image in the group of to-be-processed images and the dimensionality reduction images;
[0120] Based on the feature comparison results of each group of to-be-processed images, respectively select a second number of dimensionality reduction images from each group of to-be-processed images;
[0121] Based on the feature comparison results of the selected dimensionality-reduced images, select a first quantity of dimensionality-reduced images from the selected dimensionality-reduced images, and the first quantity of dimensionality-reduced images is the dimensionality-reduced retrieval images.
[0122] In some possible embodiments, when performing the feature comparison between the image to be processed and the dimensionality-reduced images in the image base, the dimensionality-reduced image screening module 302 is configured to:
[0123] Divide the dimensionality-reduced images in the image base into multiple groups;
[0124] For any group of dimensionality-reduced images, perform feature comparison between the image to be processed and each dimensionality-reduced image to obtain the feature similarity between the image to be processed and each dimensionality-reduced image.
[0125] In some possible embodiments, when performing the selection of a second quantity of dimensionality-reduced images from each group of images to be processed based on the feature comparison results of each group of images to be processed, the dimensionality-reduced image screening module 302 is configured to:
[0126] Based on the feature comparison results of each group of dimensionality-reduced images, select a third quantity of dimensionality-reduced images from each group of dimensionality-reduced images;
[0127] Based on the feature comparison results of the selected dimensionality-reduced images, select a second quantity of dimensionality-reduced images from the selected dimensionality-reduced images.
[0128] In some possible embodiments, each original image is provided with an image label unique in the original image set, and each dimensionality-reduced image has the same image label as the original image corresponding to the dimensionality-reduced image; when performing the determination of the retrieval image set from the original image library based on the dimensionality-reduced retrieval images, the retrieval image determination module 303 is configured to:
[0129] Identify the image label of the dimensionality-reduced retrieval image;
[0130] Obtain the original images in the original image set that have the same image label as the dimensionality-reduced retrieval image, and determine the retrieval image set according to the original images.
[0131] In some possible embodiments, when performing the feature comparison on the retrieval image set according to the image to be processed and determining the target image from the retrieval images based on the comparison results, the target image determination module 304 is configured to:
[0132] Obtain the original image features of the image to be processed, where the original image features are the image features of the image to be processed without dimensionality reduction;
[0133] Compare the original image features with the retrieved image set to obtain a target image with the highest similarity to the image to be processed.
[0134] In some possible embodiments, the image base library is determined in the following manner:
[0135] For each original image in the original image library, perform dimensionality reduction processing on the original image to obtain a dimensionality-reduced image; wherein, the number of image features of the dimensionality-reduced image is less than the number of image features of the original image, and the ratio of the number of image features of the dimensionality-reduced image to the number of image features of the original image is a preset ratio;
[0136] Perform quantization processing on the image features of the dimensionality-reduced image so that the number of bytes of the image features of each dimensionality-reduced image in the image base library is less than the number of bytes before quantization processing.
[0137] In some possible embodiments, before performing the feature comparison between the image to be processed and the dimensionality-reduced images in the image base library, the dimensionality-reduced image screening module 302 is further configured to:
[0138] Perform inverse quantization processing on the dimensionality-reduced image, and the image features of the dimensionality-reduced image after inverse quantization processing have the same feature type as the image features of the original image corresponding to the dimensionality-reduced image.
[0139] In some possible embodiments, the image feature type of the dimensionality-reduced image after performing quantization processing on the image features of the dimensionality-reduced image is an integer type.
[0140] Next, refer to Figure 4 to describe the electronic device 130 according to this embodiment of the present application. Figure 4 The shown electronic device 130 is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present application.
[0141] As Figure 4 shown, the electronic device 130 is presented in the form of a general electronic device. The components of the electronic device 130 may include but are not limited to: at least one of the above-mentioned processors 131, at least one of the above-mentioned memories 132, and a bus 133 connecting different system components (including the memory 132 and the processor 131).
[0142] The bus 133 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a processor, or a local bus using any bus structure in multiple bus structures.
[0143] The memory 132 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 1321 and / or cache memory 1322, and may further include read-only memory (ROM) 1323.
[0144] The memory 132 may also include a program / utilities 1325 having a set (at least one) of program modules 1324. Such program modules 1324 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.
[0145] The electronic device 130 may also communicate with one or more external devices 134 (such as a keyboard, a pointing device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 130, and / or may communicate with any device that enables the electronic device 130 to communicate with one or more other electronic devices (such as a router, a modem, etc.). Such communication may be through an input / output (I / O) interface 135. Moreover, the electronic device 130 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 136. As shown in the figure, the network adapter 136 communicates with other modules for the electronic device 130 through a bus 133. It should be understood that although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 130, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0146] In some possible embodiments, various aspects of an image search method provided in this application may also be implemented in the form of a program product, which includes program code. When the program product runs on a computer device, the program code is used to cause the computer device to execute the steps in an image search method according to various exemplary embodiments of this application described above in this specification.
[0147] The program product may employ any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the readable storage medium (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0148] The program product for image search according to the embodiments of the present application may employ a portable compact disk read-only memory (CD-ROM) and include program code, and may run on an electronic device. However, the program product of the present application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0149] The readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0150] The program code contained on the readable medium may be transmitted by any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0151] The program code for performing the operations of the present application may be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages - such as Java, C++, etc., and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may be executed entirely on the user's electronic device, partially on the user's device, executed as a stand-alone software package, partially on the user's electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server. In the case of a remote electronic device, the remote electronic device may be connected to the user's electronic device through any type of network - including a local area network (LAN) or a wide area network (WAN) - or may be connected to an external electronic device (e.g., by using an Internet service provider to connect through the Internet).
[0152] It should be noted that although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.
[0153] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution.
[0154] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0155] The present application is described with reference to the flowcharts and block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and block diagrams, and the combination of flows and blocks in the flowcharts and block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and blocks Figure 1 one block or multiple blocks.
[0156] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one flow or multiple flows and blocks Figure 1 one block or multiple blocks.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to generate a computer-implemented process, thereby providing instructions for implementing the process Figure 1 one process or a plurality of processes and blocks Figure 1 steps for the functions specified in one block or a plurality of blocks.
[0158] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to cover the preferred embodiments as well as all changes and modifications falling within the scope of the present application.
[0159] 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 equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. An image search method, characterized in that, The method includes: Performing dimensionality reduction processing on each to-be-processed image in the to-be-processed image set to obtain the dimensionality reduction features of the to-be-processed image; Dividing the to-be-processed image set into multiple groups; for any group of to-be-processed images, comparing the features of the to-be-processed images with the dimensionality reduction images in the image database to obtain the feature similarity between each to-be-processed image in the group of to-be-processed images and the dimensionality reduction image; wherein, the image database is a set of dimensionality reduction images obtained by performing dimensionality reduction processing on the original images in the original image database, and the number of image features of each dimensionality reduction image in the image database is the same as the number of dimensionality reduction features of the to-be-searched image; Based on the feature comparison results of each group of to-be-processed images, respectively selecting a second number of dimensionality reduction images from each group of to-be-processed images; Based on the feature comparison results of the selected dimensionality reduction images, selecting a first number of dimensionality reduction images from the selected dimensionality reduction images as dimensionality reduction retrieval images; Based on the dimensionality reduction retrieval images, determining a retrieval image set from the original image database, where the retrieval image set is a set of original images of each dimensionality reduction retrieval image; Performing feature comparison on the retrieval image set according to the to-be-processed image, and determining a target image from the retrieval images based on the comparison results.
2. The method according to claim 1, wherein The comparing the features of the to-be-processed image with the dimensionality reduction images in the image database includes: Dividing the dimensionality reduction images in the image database into multiple groups; For any group of dimensionality reduction images, comparing the features of the to-be-processed image with each dimensionality reduction image to obtain the feature similarity between the to-be-processed image and each dimensionality reduction image.
3. The method according to claim 2, characterized in that, The respectively selecting a second number of dimensionality reduction images from each group of to-be-processed images based on the feature comparison results of each group of to-be-processed images includes: Based on the feature comparison results of each group of dimensionality reduction images, selecting a third number of dimensionality reduction images from each group of dimensionality reduction images; Based on the feature comparison results of the selected dimensionality reduction images, selecting a second number of dimensionality reduction images from the selected dimensionality reduction images.
4. The method according to claim 1, wherein Each original image in the original image set is provided with a unique image label in the original image set, and the image label of each dimensionality reduction image is the same as the image label of the original image corresponding to the dimensionality reduction image; the determining the retrieval image set from the original image database based on the dimensionality reduction retrieval images includes: Identifying the image label of the dimensionality reduction retrieval image; Obtaining the original image with the same image label as the dimensionality reduction retrieval image from the original image set, and determining the retrieval image set according to the original image.
5. The method according to claim 1, wherein The performing feature comparison on the retrieval image set according to the to-be-processed image and determining a target image from the retrieval images based on the comparison results includes: Obtaining the original image features of the to-be-processed image, where the original image features are the image features of the to-be-processed image without dimensionality reduction processing; Performing feature comparison on the retrieval image set with the original image features to obtain the target image with the highest similarity to the to-be-processed image.
6. The method according to any one of claims 1-5, characterized in that, The image database is determined according to the following method: For each original image in the original image library, perform dimensionality reduction processing on the original image to obtain a dimensionality-reduced image; wherein, the number of image features of the dimensionality-reduced image is less than the number of image features of the original image, and the ratio of the number of image features of the dimensionality-reduced image to the number of image features of the original image is a preset ratio; Perform quantization processing on the image features of the dimensionality-reduced image so that the number of bytes of the image features of each dimensionality-reduced image in the image database is less than the number of bytes before quantization processing.
7. The method according to claim 6, characterized in that, The method further includes: Before comparing the features of the image to be processed with the dimensionality-reduced images in the image database, perform inverse quantization processing on the dimensionality-reduced images, and the feature types of the image features of the dimensionality-reduced images after inverse quantization processing are the same as the feature types of the image features of the original images corresponding to the dimensionality-reduced images.
8. The method according to claim 6, wherein The image feature type of the dimensionality-reduced image after performing quantization processing on the image features of the dimensionality-reduced image is an integer type.
9. An image search device, characterized in that, The device includes: A dimensionality-reduced feature acquisition module, configured to: perform dimensionality reduction processing on each image to be processed in the image set to be processed, and acquire the dimensionality-reduced features of the image to be processed; A dimensionality-reduced image screening module, configured to: divide the image set to be processed into multiple groups; for any group of images to be processed, compare the features of the image to be processed with the dimensionality-reduced images in the image database to obtain the feature similarity between each image to be processed in the group of images to be processed and the dimensionality-reduced images; the image database is a set of dimensionality-reduced images obtained by dimensionality reduction processing of the original images in the original image library, and the number of image features of each dimensionality-reduced image in the image database is the same as the number of dimensionality-reduced features of the image to be searched; Based on the feature comparison results of each group of images to be processed, respectively select a second number of dimensionality-reduced images from each group of images to be processed; Based on the feature comparison results of the selected dimensionality-reduced images, select a first number of dimensionality-reduced images from the selected dimensionality-reduced images as dimensionality-reduced retrieval images; A retrieval image determination module, configured to: based on the dimensionality-reduced retrieval images, determine a retrieval image set from the original image library, and the retrieval image set is a set of original images of each dimensionality-reduced retrieval image; A target image determination module, configured to: compare the features of the retrieval image set according to the image to be processed, and determine a target image from the retrieval images based on the comparison results.
10. An electronic device, characterized in that, Includes at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1-8.
11. A computer storage medium, characterized in that, The computer storage medium stores a computer program, and the computer program is used to cause a computer to execute the method according to any one of claims 1-8.
Citation Information
Patent Citations
Image retrieval method and device
CN106886599A