Image retrieval method and device

By establishing a preset target two-dimensional array and similarity comparison algorithm, we quickly retrieve image similarity, solving the problem of high-dimensional feature vector computing resources in image retrieval is large and inefficient, and efficient and accurate image retrieval is achieved.

CN119248954APending Publication Date: 2025-01-03CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411273800.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Image retrieval takes up a lot of computing resources and is inefficient when processing high-dimensional feature vectors, and the prior art has failed to effectively solve this problem.

Method used

By establishing a preset target two-dimensional array, quickly retrieve similar images using image indexes, and when necessary, use a similarity comparison algorithm to determine similar images from the image database, reducing the computational requirement for high-dimensional feature vectors.

Benefits of technology

It improves the accuracy of image search results, reduces the use of computing resources, and improves the efficiency of image retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248954A_ABST
    Figure CN119248954A_ABST
Patent Text Reader

Abstract

The invention discloses an image retrieval method and device. The method comprises the steps that a first image index of a first image to be retrieved is obtained, a target array associated with the first image index is retrieved from a target two-dimensional array, and the target two-dimensional array comprises multiple arrays corresponding to multiple pairs of similar images in a preset image database; each array comprises image indexes of a pair of similar images; under the condition that the target array associated with the first image index exists in the target two-dimensional array, feeding back a target image which is indicated by the target array and is similar to the first image; and under the condition that the target array associated with the first image index does not exist in the target two-dimensional array, determining a target image similar to the first image from the image database by using a similarity comparison algorithm, and feeding back the target image. The technical problems that a related image retrieval scheme occupies many computing resources and is low in efficiency are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image retrieval technology, and in particular to an image retrieval method and device. Background Art

[0002] Static image search (also known as image retrieval) is a technique for finding similar images by comparing image feature vectors. With the explosive growth of image data on the Internet, image search has become increasingly important in multiple industries, including e-commerce, smart monitoring, and medical image analysis. However, one of the challenges facing image search is the computational requirements and efficiency issues when processing large amounts of image data. As each image is represented as a higher-dimensional feature vector, if a convolutional neural network (CNN) in deep learning is used to extract features, the dimension of the vector may increase significantly. For example, a common deep learning model may represent an image as a feature vector of hundreds to thousands of dimensions. In a vector database, finding the most similar vector requires efficient similarity calculations, which become very expensive as the number of vectors in the database increases and the dimension of the vector increases. Therefore, although static image search brings great application potential in multiple industries, the storage and computational challenges of processing high-dimensional feature vectors remain the main pain points faced by the industry, requiring technical innovation and performance optimization to solve.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide an image retrieval method and device to at least solve the technical problem that related image retrieval solutions occupy a lot of computing resources and have low efficiency.

[0005] According to one aspect of an embodiment of the present application, an image retrieval method is provided, comprising: obtaining a first image index of a first image to be retrieved, and retrieving a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images; in a case where there is a target array associated with the first image index in the target two-dimensional array, feeding back a target image similar to the first image indicated by the target array; in a case where there is no target array associated with the first image index in the target two-dimensional array, determining a target image similar to the first image from the image database using a similarity comparison algorithm, and feeding back the target image.

[0006] Optionally, after determining a target image similar to the first image from the image database using a similarity comparison algorithm, the method further comprises: adding an array corresponding to the first image and the target image to the target two-dimensional array.

[0007] Optionally, retrieving the target array associated with the first image index from the target two-dimensional array includes: synchronizing the target two-dimensional array from a standard relational database maintaining the target two-dimensional array to a cache, and retrieving the target array associated with the first image index from the cache.

[0008] Optionally, the image database stores multiple acquired images, an image index and a feature vector corresponding to each image, wherein the type of the image index includes at least one of the following: an image identifier, an image storage path.

[0009] Optionally, a target image similar to the first image is determined from an image database using a similarity comparison algorithm, including: extracting a first feature vector corresponding to the first image; sequentially calculating feature similarities between the first feature vector and second feature vectors of each second image in the image database, and sorting the obtained feature similarities from large to small, wherein the type of feature similarity includes at least one of the following: cosine similarity, Euclidean distance; and determining that the second images corresponding to a preset number of feature similarities that are ranked top are the target images.

[0010] Optionally, a target image similar to the first image is determined from an image database using a similarity comparison algorithm, including: sequentially calculating the target similarities between the first image and each second image in the image database, and sorting the obtained target similarities from large to small, wherein the type of target similarity includes at least one of the following: structural similarity, peak signal-to-noise ratio, pixel mean square error; and determining that the second images corresponding to a preset number of target similarities that are ranked top are the target images.

[0011] Optionally, each array in the target two-dimensional array also includes the similarity of a pair of similar images; when there is a target array associated with the first image index in the target two-dimensional array, the target image indicated by the target array that is similar to the first image is fed back, including: obtaining a first number of preset target images to be fed back, and determining a second number of retrieved target arrays; when the second number is not less than the first number, sorting each target array from large to small according to the similarity in each target array, determining that the images indicated by the first number of target arrays with the highest sorting are similar to the first image as the target image, and feeding back the target image; when the second number is less than the first number, using a feature similarity comparison algorithm to determine a first number of target images similar to the first image from an image database, and feeding back the target image.

[0012] According to another aspect of an embodiment of the present application, an image retrieval device is also provided, including: a first retrieval module, used to obtain a first image index of a first image to be retrieved, and retrieve a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images; a feedback module, used to feedback a target image similar to the first image indicated by the target array when there is a target array associated with the first image index in the target two-dimensional array; and a second retrieval module, used to determine a target image similar to the first image from the image database using a similarity comparison algorithm when there is no target array associated with the first image index in the target two-dimensional array, and feedback the target image.

[0013] According to another aspect of an embodiment of the present application, a computer program product is further provided, the computer program product comprising: a computer program, wherein the above-mentioned image retrieval method is implemented when the computer program is executed by a processor.

[0014] According to another aspect of an embodiment of the present application, an electronic device is further provided. The electronic device includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned image retrieval method through the computer program.

[0015] In an embodiment of the present application, a first image index of a first image to be retrieved is obtained, and a target array associated with the first image index is retrieved from a target two-dimensional array, wherein the target two-dimensional array includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, and each array includes a pair of image indexes of similar images; in the case where a target array associated with the first image index exists in the target two-dimensional array, a target image similar to the first image indicated by the target array is fed back; in the case where a target array associated with the first image index does not exist in the target two-dimensional array, a target image similar to the first image is determined from the image database using a similarity comparison algorithm, and the target image is fed back. In this way, an image similar to the image to be retrieved can be quickly retrieved using a preset target two-dimensional array using an image retrieval method, and a target image highly similar to the first image can be quickly found using a similarity comparison algorithm. By directly feeding back similar images, users do not need to perform complex operations or in-depth database queries, which not only improves the accuracy of image search results, but also reduces the computing resources required to process high-dimensional feature vectors, thereby solving the technical problem that related image retrieval schemes occupy a lot of computing resources and are inefficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 is a flowchart of an optional image retrieval method according to an embodiment of the present application;

[0018] Figure 2 is a schematic structural diagram of an optional image retrieval device according to an embodiment of the present application;

[0019] Figure 3 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0021] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] Example 1

[0023] According to an embodiment of the present application, an image retrieval method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0024] Figure 1 is a flow chart of an image retrieval method provided according to an embodiment of the present application, such as Figure 1As shown, the method comprises the following steps:

[0025] Step S102, obtaining a first image index of a first image to be retrieved, and retrieving a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes a plurality of arrays corresponding to a plurality of pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images;

[0026] Step S104, when there is a target array associated with the first image index in the target two-dimensional array, feeding back a target image similar to the first image indicated by the target array;

[0027] Step S106: when there is no target array associated with the first image index in the target two-dimensional array, a target image similar to the first image is determined from the image database using a similarity comparison algorithm, and the target image is fed back.

[0028] The following describes each step of the image retrieval method in conjunction with a specific implementation process.

[0029] First, in order to achieve efficient image retrieval, it is necessary to first establish an image database, which stores multiple acquired images, the image index and feature vector corresponding to each image, wherein the type of image index includes at least one of the following: image identification, image storage path.

[0030] For example, a portrait database is established, and the feature vector of each face image and its corresponding identification information (such as image ID, image path) are stored in the portrait database. These feature vectors are usually used for subsequent face retrieval, recognition and verification. In specific implementation, a dedicated face recognition system or database management system (such as Milvus, OpenFace, FaceNet, etc.) can be used to manage and index these feature vectors. These systems provide efficient indexing mechanisms and retrieval algorithms, which can better support the management and retrieval of large-scale image datasets.

[0031] In order to efficiently manage and retrieve similar images and their similarity information, it is necessary to generate a target two-dimensional array, which includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, each array including image indexes of a pair of similar images and the similarity of a pair of similar images.

[0032] Optionally, after obtaining the first image index of the first image to be retrieved, when retrieving the target array associated with the first image index from the target two-dimensional array, the target two-dimensional array is synchronized from the standard relational database that maintains the target two-dimensional array to the cache, and the target array associated with the first image index is retrieved in the cache. The standard relational database of the target two-dimensional array is a relational database specifically used to store and maintain the target two-dimensional array, which stores a large number of image indexes and their similarity information. Since the data access speed in the cache is much faster than that in the relational database, synchronizing the target two-dimensional array from the relational database to the cache can significantly improve the retrieval speed.

[0033] As an optional implementation, when there is a target array associated with the first image index in the target two-dimensional array, the target image indicated by the target array that is similar to the first image can be directly fed back. Specifically: a first number of preset target images to be fed back is obtained, and a second number of retrieved target arrays is determined, and the first number and the second number are compared and judged. If the second number is not less than the first number, each target array is sorted from large to small according to the similarity in each target array, and the image indicated by the first number of target arrays with a higher sorting is determined to be the target image, and the target image is fed back; if the second number is less than the first number, a feature similarity comparison algorithm is used to determine a first number of target images similar to the first image from the image database, and the target image is fed back.

[0034] Optionally, in the case that there is no target array associated with the first image index in the target two-dimensional array, a target image similar to the first image is determined from the image database using a similarity comparison algorithm, specifically: extracting a first feature vector corresponding to the first image; then calculating the feature similarity between the first feature vector and the second feature vectors of each second image in the image database in turn, and sorting the obtained feature similarities from large to small, determining that the second image corresponding to a preset number of feature similarities ranked first is the target image, and feeding back the target image. The type of feature similarity includes at least one of the following: cosine similarity and Euclidean distance.

[0035] Among them, cosine similarity is a method to measure the cosine value of the angle between two vectors in space, which is used to measure the similarity between them. Its value range is from -1 to 1, where 1 means the vectors are in exactly the same direction, -1 means the vectors are in completely opposite directions, and 0 means the vectors are orthogonal, that is, there is no correlation. The larger the cosine similarity value, the higher the similarity between the images. Euclidean distance measures the true distance between two points in Euclidean space. It is one of the most intuitive distance measurements. Its value is always non-negative. The smaller the value, the closer the two points are and the higher the similarity.

[0036] In the case that there is no target array associated with the first image index in the target two-dimensional array, another similarity comparison algorithm can also be used to determine a target image similar to the first image from the image database, specifically: sequentially calculate the target similarity between the first image and each second image in the image database, and sort the obtained target similarities from large to small, determine the second image corresponding to the preset number of target similarities ranked first as the target image, and feed back the target image. The type of target similarity includes at least one of the following: structural similarity, peak signal-to-noise ratio, and pixel mean square error.

[0037] Among them, structural similarity is an indicator to measure the visual similarity of two images. It takes into account the brightness, contrast and structural information of the image. A structural similarity index value close to 1 indicates that the images are very similar. Peak signal-to-noise ratio is an error-based similarity measure that calculates the maximum possible signal-to-noise ratio of image reconstruction quality. The higher the peak signal-to-noise ratio value, the better the image quality and the more similar the two images are. Pixel mean square error is another error-based measure that calculates the average of the squares of the differences in the corresponding pixel values ​​of the two images. The lower the pixel mean square error value, the more similar the two images are.

[0038] Optionally, after determining a target image similar to the first image from the image database using a similarity comparison algorithm, an array corresponding to the first image and the target image may be added to the target two-dimensional array.

[0039] For example, after using the similarity comparison algorithm to determine the target image similar to the first image from the image database, the indexes (such as ID or storage path) of the first image and the target image are stored as an array in the current two-dimensional array. As the number of image searches increases, the image relationship data stored in the two-dimensional array will gradually increase. Each time a new similar image pair is found during a search, a new array is added to the two-dimensional array. When the image search reaches a certain scale, the image similarity data in the two-dimensional array will gradually stop growing, that is, after all possible similar image pairs are found and stored, the data in the two-dimensional array will no longer increase. In this process, each array in the two-dimensional array only contains the index information of the image, rather than the complete feature vector, so it takes up less space and is easier to perform efficient retrieval and comparison.

[0040] In an embodiment of the present application, a first image index of a first image to be retrieved is obtained, and a target array associated with the first image index is retrieved from a target two-dimensional array, wherein the target two-dimensional array includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, and each array includes a pair of image indexes of similar images; in the case where a target array associated with the first image index exists in the target two-dimensional array, a target image similar to the first image indicated by the target array is fed back; in the case where a target array associated with the first image index does not exist in the target two-dimensional array, a target image similar to the first image is determined from the image database using a similarity comparison algorithm, and the target image is fed back. In this way, an image similar to the image to be retrieved can be quickly retrieved using a preset target two-dimensional array using an image retrieval method, and a target image highly similar to the first image can be quickly found using a similarity comparison algorithm. By directly feeding back similar images, users do not need to perform complex operations or in-depth database queries, which not only improves the accuracy of image search results, but also reduces the computing resources required to process high-dimensional feature vectors, thereby solving the technical problem that related image retrieval schemes occupy a lot of computing resources and are inefficient.

[0041] Example 2

[0042] According to an embodiment of the present application, an image retrieval device for implementing the image retrieval method in embodiment 1 is also provided. Figure 2 As shown, the image retrieval device at least includes: a first retrieval module 21, a feedback module 22 and a second retrieval module 23, wherein:

[0043] A first retrieval module 21 is used to obtain a first image index of a first image to be retrieved, and retrieve a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes a plurality of arrays corresponding to a plurality of pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images;

[0044] A feedback module 22, configured to feed back a target image similar to the first image indicated by the target array when there is a target array associated with the first image index in the target two-dimensional array;

[0045] The second retrieval module 23 is used to determine a target image similar to the first image from the image database using a similarity comparison algorithm when there is no target array associated with the first image index in the target two-dimensional array, and feed back the target image.

[0046] The functions of each module of the image retrieval device are described below in conjunction with a specific implementation process.

[0047] First, in order to achieve efficient image retrieval, it is necessary to establish an image database, which stores multiple acquired images, image indexes and feature vectors corresponding to each image, wherein the type of image index includes at least one of the following: image identification, image storage path.

[0048] For example, a portrait database is established, and the feature vector of each face image and its corresponding identification information (such as image ID, image path) are stored in the portrait database. These feature vectors are usually used for subsequent face retrieval, recognition and verification. In specific implementation, a dedicated face recognition system or database management system (such as Milvus, OpenFace, FaceNet, etc.) can be used to manage and index these feature vectors. These systems provide efficient indexing mechanisms and retrieval algorithms, which can better support the management and retrieval of large-scale image datasets.

[0049] In order to efficiently manage and retrieve similar images and their similarity information, it is necessary to generate a target two-dimensional array, which includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, each array including image indexes of a pair of similar images and the similarity of a pair of similar images.

[0050] Optionally, after the first retrieval module obtains the first image index of the first image to be retrieved, when retrieving the target array associated with the first image index from the target two-dimensional array, the target two-dimensional array is synchronized from the standard relational database that maintains the target two-dimensional array to the cache, and the target array associated with the first image index is retrieved in the cache. The standard relational database of the target two-dimensional array is a relational database specifically used to store and maintain the target two-dimensional array, which stores a large number of image indexes and their similarity information. Since the data access speed in the cache is much faster than that in the relational database, synchronizing the target two-dimensional array from the relational database to the cache can significantly improve the retrieval speed.

[0051] When there is a target array associated with the first image index in the target two-dimensional array, the feedback module can directly feedback the target image similar to the first image indicated by the target array, specifically: obtain a first number of preset target images to be fed back, and determine a second number of retrieved target arrays, compare the first number and the second number to determine, if the second number is not less than the first number, sort each target array from large to small according to the similarity in each target array, determine that the image similar to the first image indicated by the first number of target arrays with a higher sorting is the target image, and feedback the target image; if the second number is less than the first number, use a feature similarity comparison algorithm to determine the first number of target images similar to the first image from the image database, and feedback the target image.

[0052] When there is no target array associated with the first image index in the target two-dimensional array, the second retrieval module uses a similarity comparison algorithm to determine a target image similar to the first image from the image database, specifically: extracting a first feature vector corresponding to the first image; then calculating the feature similarity between the first feature vector and the second feature vectors of each second image in the image database in turn, and sorting the obtained feature similarities from large to small, determining that the second image corresponding to a preset number of feature similarities ranked first is the target image, and feeding back the target image. The type of feature similarity includes at least one of the following: cosine similarity and Euclidean distance.

[0053] In the case that there is no target array associated with the first image index in the target two-dimensional array, the second retrieval module can also use another similarity comparison algorithm to determine a target image similar to the first image from the image database, specifically: sequentially calculate the target similarity between the first image and each second image in the image database, and sort the obtained target similarities from large to small, determine the second image corresponding to the preset number of target similarities ranked first as the target image, and feed back the target image. Wherein, the type of target similarity includes at least one of the following: structural similarity, peak signal-to-noise ratio, pixel mean square error.

[0054] Optionally, after determining a target image similar to the first image from the image database using a similarity comparison algorithm, an array corresponding to the first image and the target image may be added to the target two-dimensional array.

[0055] For example, after using the similarity comparison algorithm to determine the target image similar to the first image from the image database, the indexes (such as ID or storage path) of the first image and the target image are stored as an array in the current two-dimensional array. As the number of image searches increases, the image relationship data stored in the two-dimensional array will gradually increase. Each time a new similar image pair is found during a search, a new array is added to the two-dimensional array. When the image search reaches a certain scale, the image similarity data in the two-dimensional array will gradually stop growing, that is, after all possible similar image pairs are found and stored, the data in the two-dimensional array will no longer increase. In this process, each array in the two-dimensional array only contains the index information of the image, rather than the complete feature vector, so it takes up less space and is easier to perform efficient retrieval and comparison.

[0056] It should be noted that each module in the image retrieval device in the embodiment of the present application corresponds one-to-one to each implementation step of the image retrieval method in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be repeated here.

[0057] Example 3

[0058] According to an embodiment of the present application, a computer program product is also provided. The computer program product includes a computer program, wherein when the computer program is executed by a processor, the image retrieval method in Embodiment 1 is implemented.

[0059] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the image retrieval method in Example 1 by running the computer program.

[0060] According to an embodiment of the present application, a processor is further provided, which is used to run a computer program, wherein the image retrieval method in Example 1 is executed when the computer program is run.

[0061] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the image retrieval method in Example 1 through the computer program.

[0062] Specifically, when the computer program is running, the following steps are executed: obtaining a first image index of a first image to be retrieved, and retrieving a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes multiple arrays corresponding to multiple pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images; in a case where there is a target array associated with the first image index in the target two-dimensional array, feeding back a target image similar to the first image indicated by the target array; in a case where there is no target array associated with the first image index in the target two-dimensional array, determining a target image similar to the first image from the image database using a similarity comparison algorithm, and feeding back the target image.

[0063] As an optional implementation, the electronic device may be in the form of a mobile terminal, a computer terminal or a similar computing device. Figure 3 FIG. 1 shows a hardware structure block diagram of an electronic device for implementing an image retrieval method. Figure 3As shown, the electronic device 30 may include one or more (302a, 302b, ..., 302n are used to illustrate) processors 302 (the processor 302 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 304 for storing data, and a transmission device 306 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 3 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown.

[0064] It should be noted that the one or more processors 302 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the electronic device 30. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0065] The memory 304 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image retrieval method in the embodiment of the present application. The processor 302 executes various functional applications and data processing by running the software programs and modules stored in the memory 304, that is, realizing the vulnerability detection method of the above-mentioned application. The memory 304 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 304 may further include a memory remotely arranged relative to the processor 302, and these remote memories may be connected to the electronic device 30 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0066] The transmission device 306 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the electronic device 30. In one example, the transmission device 306 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 306 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0067] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 30 .

[0068] The serial numbers of the above embodiments are only for description and do not represent the advantages or disadvantages of the embodiments.

[0069] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0070] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0071] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0072] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0073] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0074] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An image retrieval method, characterized in that: include: Obtaining a first image index of a first image to be retrieved, and retrieving a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes a plurality of arrays corresponding to a plurality of pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images; In a case where a target array associated with the first image index exists in the target two-dimensional array, feeding back a target image similar to the first image and indicated by the target array; In the case that there is no target array associated with the first image index in the target two-dimensional array, a target image similar to the first image is determined from the image database using a similarity comparison algorithm, and the target image is fed back.

2. The method according to claim 1, characterized in that After determining a target image similar to the first image from the image database using a similarity comparison algorithm, the method further includes: Add an array corresponding to the first image and the target image to the target two-dimensional array.

3. The method according to claim 1 or 2, characterized in that: Retrieving a target array associated with the first image index from the target two-dimensional array includes: The target two-dimensional array is synchronized from a standard relational database maintaining the target two-dimensional array to a cache, and the target array associated with the first image index is retrieved from the cache.

4. The method according to claim 1 or 2, characterized in that: The image database stores a plurality of acquired images, an image index and a feature vector corresponding to each image, wherein the type of the image index includes at least one of the following: an image identifier and an image storage path.

5. The method according to claim 4, characterized in that Determining a target image similar to the first image from the image database using a similarity comparison algorithm includes: Extracting a first eigenvector corresponding to the first image; Calculating feature similarities between the first feature vector and the second feature vectors of each second image in the image database in sequence, and sorting the obtained feature similarities from large to small, wherein the type of the feature similarity includes at least one of the following: cosine similarity and Euclidean distance; The second images corresponding to the preset number of feature similarities ranked at the top are determined as the target images.

6. The method according to claim 1 or 2, characterized in that: Determining a target image similar to the first image from the image database using a similarity comparison algorithm includes: Calculating target similarities between the first image and each second image in the image database in sequence, and sorting the obtained target similarities from large to small, wherein the type of the target similarity includes at least one of the following: structural similarity, peak signal-to-noise ratio, and pixel mean square error; The second images corresponding to the preset number of target similarities ranked first are determined as the target images.

7. The method according to claim 1 or 2, characterized in that: Each array in the target two-dimensional array also includes a similarity of a pair of similar images; when there is a target array associated with the first image index in the target two-dimensional array, feeding back a target image similar to the first image indicated by the target array, comprising: Acquire a first number of preset target images to be fed back, and determine a second number of the retrieved target arrays; In the case where the second number is not less than the first number, sorting the target arrays from large to small according to the similarities in the target arrays, determining that the images indicated by the first number of target arrays with the highest sorting levels and similar to the first image are the target images, and feeding back the target images; In the case that the second number is smaller than the first number, a first number of target images similar to the first image are determined from the image database using a feature similarity comparison algorithm, and the target images are fed back.

8. An image retrieval device, characterized in that: include: A first retrieval module is used to obtain a first image index of a first image to be retrieved, and retrieve a target array associated with the first image index from a target two-dimensional array, wherein the target two-dimensional array includes a plurality of arrays corresponding to a plurality of pairs of similar images in a preset image database, and each array includes an image index of a pair of similar images; a feedback module, configured to feed back a target image similar to the first image and indicated by the target array, if a target array associated with the first image index exists in the target two-dimensional array; The second retrieval module is used to determine a target image similar to the first image from the image database using a similarity comparison algorithm when there is no target array associated with the first image index in the target two-dimensional array, and to feed back the target image.

9. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the image retrieval method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the image retrieval method according to any one of claims 1 to 7 through the computer program.

Citation Information

Cited By

  • Image processing method and device, equipment, medium and product

    CN120873218A