Image search method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202510905499.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2045-06-30
AI Technical Summary
[0003]本发明实施例提供一种图像搜索方法,旨在解决现有方法存在数据库维护过程中,需要添加新的标签,在添加新的标签的同时增加了数据重新添加标签的工作量,使得数据库的维护困难的问题
[0039]本发明实施例中,向第一图像数据库中的图像添加新增标签时,获取新增标签的第一语义特征;基于第一语义特征,在第一图像数据库中进行图像检索,得到第一检索结果以及第一检索结果的置信度;若置信度小于预设置信度,则基于第一检索结果中的已有标签,在第一检索结果中进行二次检索,得到第二检索结果;基于第二检索结果,将新增标签添加到二次检索结果对应的图像中,得到第二图像数据库;获取到用户的图像搜索指令后,基于图像搜索指令在第二图像数据库进行图像检索。本发明解决了现有方法存在数据库维护过程中,需要添加新的标签,在添加新的标签的同时增加了数据重新添加标签的工作量,使得数据库的维护困难的问题,通过在检索过程中自动添加新增标签,有效降低了标签添加的工作量。
Smart Images

Figure CN120950717B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image management technology, and in particular to an image search method, apparatus, electronic device, and storage medium. Background Technology
[0002] In existing image search methods, the search scope can be narrowed by labeling image data. However, during database maintenance, new labels may need to be added, which increases the workload of re-labeling the data and makes database maintenance difficult. Therefore, there is an urgent need for an image search method that reduces the workload of label addition, addressing the problem that existing methods require adding new labels during database maintenance, thus increasing the workload of re-labeling the data and making database maintenance difficult. Summary of the Invention
[0003] This invention provides an image search method aimed at solving the problem that existing methods require adding new tags during database maintenance, increasing the workload of re-labeling data and making database maintenance difficult. This invention obtains the first semantic feature of the new tag when adding a new tag to an image in a first image database. Based on the first semantic feature, image retrieval is performed in the first image database to obtain a first retrieval result and its confidence level. If the confidence level is lower than a preset confidence level, a second retrieval is performed based on the existing tags in the first retrieval result to obtain a second retrieval result. The new tag is then added to the image corresponding to the second retrieval result using the second retrieval result, resulting in a second image database. After obtaining the user's image search command, image retrieval is performed in the second image database according to the image search command. This solves the problem of existing methods requiring new tags during database maintenance, which increases the workload of re-labeling data and makes database maintenance difficult. By automatically adding new tags during the retrieval process, the workload of tag addition is effectively reduced.
[0004] In a first aspect, embodiments of the present invention provide an image search method, the method comprising the following steps:
[0005] When adding a new label to an image in the first image database, the first semantic feature of the new label is obtained;
[0006] Based on the first semantic feature, an image retrieval is performed in the first image database to obtain a first retrieval result and the confidence level of the first retrieval result;
[0007] If the confidence level is less than the preset confidence level, a second search is performed on the first search result based on the existing tags in the first search result to obtain a second search result;
[0008] Based on the second search result, the newly added tag is added to the image corresponding to the second search result to obtain the second image database;
[0009] After obtaining the user's image search instruction, an image retrieval is performed in the second image database based on the image search instruction.
[0010] Optionally, the step of performing image retrieval in the first image database based on the first semantic feature to obtain a first retrieval result and the confidence level of the first retrieval result includes:
[0011] The first semantic feature is compared with the image semantic features of the images in the first image database to obtain the first similarity;
[0012] The N images with the highest first similarity are determined as the first search results, and the confidence level of the first search results is determined based on the first similarity.
[0013] Optionally, determining the confidence level of the first search result based on the first similarity includes:
[0014] The first similarity scores corresponding to N images are normalized to obtain the normalized first similarity scores.
[0015] Determine the average and maximum values of the normalized first similarity, and determine the ratio of the average to the maximum value as the confidence level of the first search result.
[0016] Optionally, the step of performing a secondary search on the first search result based on existing tags in the first search result to obtain a second search result includes:
[0017] For each image in the first result, obtain the existing labels for that image;
[0018] The second semantic feature of the existing tag is obtained, and a second search is performed in the first search result based on the second similarity between the first semantic feature and the second semantic feature to obtain the second search result.
[0019] Optionally, the step of performing a second search on the first search result based on the second similarity between the first semantic feature and the second semantic feature to obtain a second search result includes:
[0020] Existing labels with a second similarity greater than the preset value are identified as candidate existing labels;
[0021] For each candidate label, the target region corresponding to the candidate label is determined in the corresponding image;
[0022] A second search is performed based on the target region to obtain the second search result.
[0023] Optionally, the second search based on the target region to obtain a second search result includes:
[0024] Determine the image area of the target region;
[0025] If the area of the image is greater than or equal to the area threshold, a second search is performed within the target area to obtain a second search result;
[0026] If the image area of the target region corresponding to all candidate labels is less than the area threshold, a second search is performed in the target region to obtain a second search result.
[0027] Optionally, the image retrieval based on the image search instruction in the second image database includes:
[0028] Based on the image search instructions, the target tag to be searched is determined;
[0029] Based on the target label, candidate images matching the target label are filtered out from the second image database;
[0030] Image retrieval is performed on the candidate images.
[0031] Secondly, embodiments of the present invention provide an image search device, the image search device comprising:
[0032] The acquisition module is used to acquire the first semantic feature of the newly added label when adding a new label to an image in the first image database;
[0033] The first retrieval module is used to perform image retrieval in the first image database based on the first semantic feature, and obtain the first retrieval result and the confidence level of the first retrieval result;
[0034] The second retrieval module is used to perform a second retrieval in the first retrieval result based on the existing tags in the first retrieval result if the confidence level is less than the preset confidence level, so as to obtain the second retrieval result;
[0035] An addition module is used to add the new tags to the images corresponding to the secondary search results based on the second search results, thereby obtaining a second image database;
[0036] The third retrieval module is used to obtain the user's image search instruction and then perform image retrieval in the second image database based on the image search instruction.
[0037] Thirdly, embodiments of the present invention provide an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the image search method provided in embodiments of the present invention.
[0038] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the image search method provided in the embodiments of the present invention.
[0039] In this embodiment of the invention, when adding a new tag to an image in the first image database, the first semantic feature of the new tag is obtained; based on the first semantic feature, an image search is performed in the first image database to obtain a first search result and a confidence level of the first search result; if the confidence level is less than a preset confidence level, a second search is performed based on the existing tags in the first search result to obtain a second search result; based on the second search result, the new tag is added to the image corresponding to the second search result to obtain a second image database; after obtaining the user's image search instruction, an image search is performed in the second image database based on the image search instruction. This invention solves the problem in existing methods where adding new tags during database maintenance increases the workload of re-adding tags to the data, making database maintenance difficult. By automatically adding new tags during the search process, the workload of tag addition is effectively reduced. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart of an image search method provided in an embodiment of the present invention;
[0042] Figure 2 This is a schematic diagram of the structure of an image search device provided in an embodiment of the present invention;
[0043] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] like Figure 1 As shown, Figure 1 This is a flowchart of an image search method provided by an embodiment of the present invention. The image search method includes the following steps:
[0046] 101. When adding a new label to an image in the first image database, obtain the first semantic feature of the new label.
[0047] In this embodiment of the invention, the image search method described above can be applied to an image search platform, which can be built on a server-based or distributed platform. The image search platform includes a data interface (for sensors or users to upload data), a knowledge database, and a knowledge database construction program. The data interface can be used to obtain the first semantic features of the new tags when adding new tags to images in the first image database. The knowledge database construction program can be used to construct the knowledge database, which is specifically used to provide additional association information for the identified data entities, thereby improving the depth of the data recognition system's understanding of the content.
[0048] The aforementioned first image database is a database used for storing, retrieving, and managing image data; it is an image database that has not undergone retrieval with newly added tags.
[0049] The newly added tags mentioned above can be understood as new categories or attributes added in image search, used to expand or refine the original classification system.
[0050] The first semantic feature mentioned above can be understood as the linguistic features that the newly added label has in the language, such as color, shape, etc.
[0051] It should be noted that the first semantic features of newly added tags can be obtained through natural language processing (NLP) technology. NLP technology aims to enable computers to understand, interpret, and generate human language, thereby achieving effective communication between humans and machines. Its main tasks include language translation, sentiment analysis, and text summarization.
[0052] 102. Based on the first semantic feature, perform image retrieval in the first image database to obtain the first retrieval result and the confidence level of the first retrieval result.
[0053] In this embodiment of the invention, when the first semantic feature of the newly added tag is obtained, an image retrieval can be performed in the first image database using the first semantic feature, and a first retrieval result and the confidence level of the first retrieval result can be obtained.
[0054] The image retrieval described above can be understood as a process of retrieving images from a first image database using the first semantic features of newly added tags.
[0055] The aforementioned first search result can be understood as the search result obtained by performing an image search in the first image database using the first semantic feature of the newly added tag. The first search result includes image data related to the first semantic feature.
[0056] The confidence level of the first search result can be understood as the degree to which the first search result is considered a correct result. This confidence level is used to measure the degree to which the first search result is considered a correct result.
[0057] It should be noted that, based on the first semantic feature, image retrieval can be performed in the first image database to match the first retrieval result related to the first semantic feature and the confidence level of the first retrieval result.
[0058] 103. If the confidence level is less than the preset confidence level, a second search is performed based on the existing tags in the first search result to obtain the second search result.
[0059] In this embodiment of the invention, the aforementioned preset confidence level is a confidence threshold preset by the system, and the preset confidence level is used to determine whether the search results meet the requirements.
[0060] The existing tags in the first search results can be understood as keywords or topics related to the first semantic feature during image retrieval in the first image database using the first semantic feature of the newly added tags. These existing tags are used to describe the image content in the first search results; for example, if the image data is a cat, the existing tag would be "cat," etc.
[0061] The second search result is obtained by performing a secondary search based on the tags already present in the first search result.
[0062] In one possible implementation, for example, if the confidence level is preset to 0.8, and the confidence level of the first search result is only 0.6, then a second search can be performed on the first search result based on the existing tags in the first search result to obtain the second search result.
[0063] 104. Based on the second search result, add the new tags to the images corresponding to the second search result to obtain the second image database.
[0064] In this embodiment of the invention, new tags can be added to the images corresponding to the secondary search results based on the second search results, forming a new image database, namely the second image database.
[0065] The aforementioned second image database can be formed by adding new tags to the first image database, thus creating an image database containing richer information.
[0066] It should be noted that, based on the first image database, new labels are added to the images corresponding to the secondary search results to obtain the second image database. The second image database includes image data with existing labels as well as image data with newly added labels.
[0067] 105. After obtaining the user's image search instruction, perform image retrieval in the second image database based on the image search instruction.
[0068] In this embodiment of the invention, after obtaining the user's image search instruction, an image can be retrieved in the second image database according to the image search instruction.
[0069] The image search commands described above can be understood as instructions from the user to retrieve images. This can involve using text-based image search commands to retrieve images from a second image database. Text-based image search is a search method where users can find matching images by entering a text description.
[0070] It should be noted that users can search for images related to the text description by entering it into a search engine.
[0071] In this embodiment of the invention, when adding a new tag to an image in the first image database, the first semantic feature of the new tag is obtained; based on the first semantic feature, image retrieval is performed in the first image database to obtain a first retrieval result and a confidence level of the first retrieval result; if the confidence level is less than a preset confidence level, a second retrieval is performed based on the existing tags in the first retrieval result to obtain a second retrieval result; based on the second retrieval result, the new tag is added to the image corresponding to the second retrieval result to obtain a second image database; after obtaining the user's image search instruction, image retrieval is performed in the second image database based on the image search instruction. This invention solves the problem in existing methods where adding new tags during database maintenance increases the workload of re-adding tags to the data, making database maintenance difficult. By automatically adding new tags during the retrieval process, the workload of tag addition is effectively reduced, and the query accuracy is improved while reducing the difficulty of querying image data.
[0072] It is understood that in the specific implementation of this application, data such as image data, knowledge data, and user data are involved. When the embodiments in this application are applied to specific products or technologies, user permission or consent is required. Furthermore, the collection, use, and processing of related data, as well as the training, deployment, and invocation of algorithm models, must comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0073] Optionally, in the step of performing image retrieval in the first image database based on the first semantic feature to obtain the first retrieval result and the confidence level of the first retrieval result, the first semantic feature can be compared with the image semantic features of the images in the first image database to obtain the first similarity; the N images with the highest first similarity are determined as the first retrieval result, and the confidence level of the first retrieval result is determined according to the first similarity.
[0074] In this embodiment of the invention, the first semantic feature can be a linguistic feature of the newly added tag in the language, such as color, shape, etc.
[0075] The aforementioned first image database is a database used for storing, retrieving, and managing image data. The first image database is an image database that has not been retrieved after adding new tags.
[0076] The aforementioned image semantic features can be understood as the linguistic features that an image possesses in language. It should be noted that the first semantic feature and the image semantic features share the same vector space.
[0077] The aforementioned first similarity comparison can be a process for measuring the degree of similarity between the first semantic feature and the image semantic features of the images in the first image database.
[0078] Specifically, methods such as cosine similarity and Euclidean distance can be used to calculate the similarity between the first semantic feature and the image semantic features of the images in the first image database. For example, if cosine similarity is used, the smaller the angle between the first semantic feature vector and the image semantic feature vector, the larger the cosine similarity, indicating that the two vectors are more similar.
[0079] The aforementioned first similarity can be understood as the degree of similarity between the first semantic feature and the image semantic features of the images in the first image database.
[0080] The first search result can be the N images with the highest similarity between the first semantic feature and the image semantic features of the images in the first image database.
[0081] The N mentioned above is a quantifier, which can be 8, 10, 12, etc.
[0082] The confidence level of the first search result can be considered as a reliable result. This confidence level is used to measure the reliability of the first search result as a correct result.
[0083] Optionally, in the step of determining the confidence level of the first search result based on the first similarity, the first similarity corresponding to N images can be normalized to obtain the normalized first similarity; the average value and the maximum value of the normalized first similarity can be determined, and the ratio of the average value to the maximum value can be determined as the confidence level of the first search result.
[0084] In this embodiment of the invention, the normalization process described above is used to transform data of different magnitudes to the same scale, such as [0, 1] or [-1, 1]. The normalization process described above can be understood as transforming the first similarity corresponding to N images to the same scale, so that the value of the first similarity is within the range of [0, 1] or [-1, 1].
[0085] The above average values reflect the average of the first similarity.
[0086] The maximum value mentioned above can be understood as the maximum value of the first similarity.
[0087] It should be noted that by calculating the ratio of the average to the maximum value, an index can be obtained to measure the distribution of similarity, thereby obtaining the confidence level of the first search result.
[0088] In one possible embodiment, for example, the first search result includes N images, and the similarity of the N images is S1, S2, ..., SN. The similarity of the N images is normalized to obtain P1, P2, ..., PN. Then, the average and maximum values of the normalized similarity are calculated to obtain the average value M and the maximum value Max. The average value M is divided by the maximum value Max to obtain the confidence level of the first search result.
[0089] In another possible embodiment, for example, the first search result includes 5 images, and the first similarity scores corresponding to the 5 images are 0.2, 0.5, 0.8, 0.6, and 0.9, respectively. After normalizing the similarity scores of the 5 images, a normalized first similarity score is obtained, with the value range of the normalized first similarity score becoming 0 to 1. Then, the average value of the normalized first similarity score is calculated as (0.2+0.5+0.8+0.6+0.9) / 5 = 0.54, and the maximum value is 0.9. The ratio of the average value to the maximum value is calculated as 0.54 / 0.9 = 0.594, and this ratio of 0.594 is used as the confidence score of the first search result.
[0090] Optionally, in the step of performing a secondary search based on the existing tags in the first search result to obtain the second search result, for each image in the first result, the existing tags of the image can be obtained; the second semantic features of the existing tags can be obtained; and based on the second similarity between the first semantic features and the second semantic features, a secondary search can be performed in the first search result to obtain the second search result.
[0091] In this embodiment of the invention, the existing tags of the above-mentioned image can be understood as the tags that the image originally possesses. For example, if the image data is a cat, the existing tag is "cat".
[0092] The aforementioned second semantic feature can be understood as the linguistic features of the existing labels of the image in the first result in the language, such as color, shape, etc.
[0093] The aforementioned first semantic feature can be a linguistic feature of the newly added label in the language, such as color, shape, etc.
[0094] The second similarity between the first semantic feature and the second semantic feature can be obtained by comparing the similarity between the first semantic feature and the second semantic feature.
[0095] The first search result mentioned above can be the search result obtained by searching the first image database using the first semantic feature of the newly added tag. The first search result includes image data related to the first semantic feature.
[0096] The second search result can be obtained by performing a secondary search on the first search result based on the second similarity between the first semantic feature and the second semantic feature. The second search result includes image data that matches the first semantic feature and the second semantic feature.
[0097] It should be noted that secondary retrieval can more accurately find image data related to the newly added tags.
[0098] Optionally, in the step of performing a secondary search on the first search result based on the second similarity between the first semantic feature and the second semantic feature to obtain the second search result, existing labels with a second similarity greater than a preset value can be identified as candidate existing labels; for each candidate label, the target region corresponding to the candidate label is determined in the corresponding image; and a secondary search is performed based on the target region to obtain the second search result.
[0099] In this embodiment of the invention, the aforementioned preset existing tags are tags that are pre-set by the system and associated with the image content.
[0100] Furthermore, a candidate existing label can be determined if the second similarity between the first semantic feature and the second semantic feature is greater than a preset existing label.
[0101] The aforementioned candidate existing labels can be understood as the existing labels of the candidates.
[0102] The target region mentioned above can be the region in the image corresponding to the candidate label.
[0103] The aforementioned secondary search can be understood as a search process that involves performing image retrieval on the target region within the first search result.
[0104] The second search result is obtained by performing an image search on the first search result based on the target region. The second search result includes image data that matches the target region.
[0105] It should be noted that existing labels with a second similarity greater than a preset value can be identified as candidate existing labels. Then, for each candidate label, the target region corresponding to the candidate label is determined in the corresponding image, and a second search is performed based on the target region in the first search result to obtain the second search result. Through the second search, image data that is more consistent with the new label can be accurately found.
[0106] Optionally, in the step of performing a secondary search based on the target region to obtain the second search result, the image area of the target region can be determined; if the image area is greater than or equal to the area threshold, a secondary search is performed in the target region to obtain the second search result; if the image areas of the target regions corresponding to all candidate labels are less than the area threshold, a secondary search is performed in the target region to obtain the second search result.
[0107] In this embodiment of the invention, the image area of the target region can be the number of pixels occupied by the target region in the entire image. The image area of the target region is used to determine whether the image area of the target region is sufficient for secondary retrieval within the target region. The image area can be used to evaluate the importance of the target region in the entire image.
[0108] The area thresholds mentioned above are pre-set area thresholds for regional images by the system.
[0109] It should be noted that by determining the image area of the target region, and when the image area is greater than or equal to a preset area threshold, a secondary search is performed within the target region to obtain a second search result. If the image area of the target region corresponding to all candidate labels is less than the preset area threshold, a secondary search is performed within the target region to obtain a second search result, in order to find image data that better matches the newly added label.
[0110] Optionally, in the step of performing image retrieval in the second image database based on image search instructions, the target label to be searched can be determined based on the image search instructions; candidate images matching the target label can be filtered out in the second image database based on the target label; and image retrieval can be performed among the candidate images.
[0111] In this embodiment of the invention, the aforementioned image search instruction can be understood as a user conveying an instruction to retrieve an image. It can be performed in a second image database using a text-based image search instruction. The aforementioned text-based image search is a search method where matching images are found by inputting a text description.
[0112] The aforementioned second image database is formed by adding new tags to the first image database, resulting in an image database containing richer information.
[0113] The image retrieval described above can be understood as the process of searching for images among candidate images using image search commands.
[0114] It should be noted that users can enter text descriptions into the search engine and perform image searches in the second database to find images related to the text descriptions.
[0115] Specifically, based on the image search command input by the user, the target tag for the search can be determined. Based on the target tag, candidate images matching the target tag are filtered in the second image database. Image retrieval is then performed among the candidate images to determine the image data matching the target tag, effectively improving the accuracy of the query.
[0116] like Figure 2 As shown, an embodiment of the present invention provides an image search device, which includes:
[0117] The acquisition module 201 is used to acquire the first semantic feature of the newly added label when adding a new label to an image in the first image database;
[0118] The first retrieval module 202 is used to perform image retrieval in the first image database based on the first semantic feature, and obtain a first retrieval result and the confidence level of the first retrieval result;
[0119] The second retrieval module 203 is used to perform a second retrieval in the first retrieval result based on the existing tags in the first retrieval result if the confidence level is less than the preset confidence level, so as to obtain the second retrieval result;
[0120] The addition module 204 is used to add the new tag to the image corresponding to the secondary search result based on the second search result, so as to obtain the second image database;
[0121] The third retrieval module 205 is used to obtain the user's image search instruction and then perform image retrieval in the second image database based on the image search instruction.
[0122] Optionally, the first retrieval module 202 is further configured to perform a first similarity comparison between the first semantic feature and the image semantic features of the images in the first image database to obtain a first similarity; determine the N images with the highest first similarity as the first retrieval result, and determine the confidence level of the first retrieval result based on the first similarity.
[0123] Optionally, the first retrieval module 202 is further configured to normalize the first similarity corresponding to N images to obtain normalized first similarity; determine the average value and the maximum value of the normalized first similarity, and determine the ratio of the average value to the maximum value as the confidence level of the first retrieval result.
[0124] Optionally, the second retrieval module 203 is further configured to obtain existing labels for each image in the first result; obtain second semantic features of the existing labels; and perform a second retrieval in the first retrieval result based on the second similarity between the first semantic features and the second semantic features to obtain a second retrieval result.
[0125] Optionally, the second retrieval module 203 is further configured to identify existing labels with a second similarity greater than a preset value as candidate existing labels; for each candidate label, determine the target region corresponding to the candidate label in the corresponding image; and perform a second retrieval based on the target region to obtain a second retrieval result.
[0126] Optionally, the second retrieval module 203 is further configured to determine the image area of the target region; if the image area is greater than or equal to an area threshold, a second retrieval is performed in the target region to obtain a second retrieval result; if the image area of the target region corresponding to all candidate tags is less than the area threshold, a second retrieval is performed in the target region to obtain a second retrieval result.
[0127] Optionally, the third retrieval module 205 is further configured to determine the target tag to be searched based on the image search instruction; filter out candidate images that match the target tag in the second image database based on the target tag; and perform image retrieval in the candidate images.
[0128] like Figure 3 As shown, this embodiment of the invention also provides an electronic device, including a processor, which can execute any of the above-described image search methods.
[0129] Specifically, it includes a processor 301 and a memory 302, as well as a computer program stored in the memory 302 and capable of running on the processor 301 to execute the image search method, wherein:
[0130] Processor 301 executes the calculator program for the image search method stored in memory 302, performing the following steps:
[0131] When adding a new label to an image in the first image database, the first semantic feature of the new label is obtained;
[0132] Based on the first semantic feature, an image retrieval is performed in the first image database to obtain a first retrieval result and the confidence level of the first retrieval result;
[0133] If the confidence level is less than the preset confidence level, a second search is performed on the first search result based on the existing tags in the first search result to obtain a second search result;
[0134] Based on the second search result, the newly added tag is added to the image corresponding to the second search result to obtain the second image database;
[0135] After obtaining the user's image search instruction, an image retrieval is performed in the second image database based on the image search instruction.
[0136] Optionally, the step of processor 301 performing image retrieval in the first image database based on the first semantic feature to obtain a first retrieval result and the confidence level of the first retrieval result includes:
[0137] The first semantic feature is compared with the image semantic features of the images in the first image database to obtain the first similarity;
[0138] The N images with the highest first similarity are determined as the first search results, and the confidence level of the first search results is determined based on the first similarity.
[0139] Optionally, the process of determining the confidence level of the first search result based on the first similarity, performed by processor 301, includes:
[0140] The first similarity scores corresponding to N images are normalized to obtain the normalized first similarity scores.
[0141] Determine the average and maximum values of the normalized first similarity, and determine the ratio of the average to the maximum value as the confidence level of the first search result.
[0142] Optionally, the process executed by processor 301 to perform a second search based on existing tags in the first search result to obtain a second search result includes:
[0143] For each image in the first result, obtain the existing labels for that image;
[0144] The second semantic feature of the existing tag is obtained, and based on the second similarity between the first semantic feature and the second semantic feature, a second search is performed in the first search result to obtain the second search result.
[0145] Optionally, the processor 301 performs a second search based on the second similarity between the first semantic feature and the second semantic feature, within the first search result to obtain a second search result, including:
[0146] Existing labels with a second similarity greater than the preset value are identified as candidate existing labels;
[0147] For each candidate label, the target region corresponding to the candidate label is determined in the corresponding image;
[0148] A second search is performed based on the target region to obtain the second search result.
[0149] Optionally, the secondary search performed by processor 301 based on the target region to obtain a second search result includes:
[0150] Determine the image area of the target region;
[0151] If the area of the image is greater than or equal to the area threshold, a second search is performed within the target area to obtain a second search result;
[0152] If the image area of the target region corresponding to all candidate labels is less than the area threshold, a second search is performed in the target region to obtain a second search result.
[0153] Optionally, the image retrieval in the second image database based on the image search instruction executed by the processor 301 includes:
[0154] Based on the image search instructions, the target tag to be searched is determined;
[0155] Based on the target label, candidate images matching the target label are filtered out from the second image database;
[0156] Image retrieval is performed on the candidate images.
[0157] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the image search method provided in this invention and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0158] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0159] The above description discloses only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.
Claims
1. An image search method, characterized in that, The method includes the following steps: When adding a new label to an image in the first image database, the first semantic feature of the new label is obtained; Based on the first semantic feature, an image retrieval is performed in the first image database to obtain a first retrieval result and the confidence level of the first retrieval result; If the confidence level is less than a preset confidence level, a second search is performed on the first search result based on the existing tags in the first search result to obtain a second search result. Specifically, for each image in the first search result, the existing tags of the image are obtained; the second semantic features of the existing tags are obtained; based on the first semantic features and the second semantic features, a second similarity is determined, and existing tags with a second similarity greater than a preset threshold are determined as candidate tags; for each candidate tag, the target region corresponding to the candidate tag is determined in the corresponding image; a second search is performed based on the target region to obtain a second search result. Based on the second search result, the new tag is added to the image corresponding to the second search result to obtain the second image database; After obtaining the user's image search instruction, an image retrieval is performed in the second image database based on the image search instruction.
2. The image search method as described in claim 1, characterized in that, The step of performing image retrieval in the first image database based on the first semantic feature to obtain a first retrieval result and the confidence level of the first retrieval result includes: The first semantic feature is compared with the image semantic features of the images in the first image database to obtain the first similarity; The N images with the highest first similarity are determined as the first search results, and the confidence level of the first search results is determined based on the first similarity.
3. The image search method as described in claim 2, characterized in that, Determining the confidence level of the first search result based on the first similarity includes: The first similarity scores corresponding to N images are normalized to obtain the normalized first similarity scores. Determine the average and maximum values of the normalized first similarity, and determine the ratio of the average to the maximum value as the confidence level of the first search result.
4. The image search method as described in claim 1, characterized in that, The image retrieval based on the image search command in the second image database includes: Based on the image search instructions, the target tag to be searched is determined; Based on the target label, candidate images matching the target label are filtered out from the second image database; Image retrieval is performed on the candidate images.
5. An image search device, characterized in that, The image search device includes: The acquisition module is used to acquire the first semantic feature of the newly added label when adding a new label to an image in the first image database; The first retrieval module is used to perform image retrieval in the first image database based on the first semantic feature, and obtain the first retrieval result and the confidence level of the first retrieval result; The second retrieval module is configured to, if the confidence level is less than a preset confidence level, perform a secondary retrieval in the first retrieval result based on the existing labels in the first retrieval result to obtain a second retrieval result; specifically, for each image in the first retrieval result, obtain the existing labels of the image; obtain the second semantic features of the existing labels; determine the second similarity based on the first semantic features and the second semantic features; and determine the existing labels with the second similarity greater than a preset threshold as candidate labels; for each candidate label, determine the target region corresponding to the candidate label in the corresponding image; and perform a secondary retrieval based on the target region to obtain the second retrieval result; An adding module is used to add the new tag to the image corresponding to the second search result based on the second search result, thereby obtaining a second image database; The third retrieval module is used to obtain the user's image search instruction and then perform image retrieval in the second image database based on the image search instruction.
6. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the image search method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the image search method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Data processing method and apparatus, electronic device and storage medium
CN109522424A
Image data processing method and device, equipment and storage medium
CN112115996A