Image labeling method and device, storage medium and computer equipment
By calculating the feature similarity of images and category description text and automatically labeling image categories, the problems of low labeling efficiency and high cost in the prior art are solved, efficient and accurate image annotation is achieved, and the performance of image classifiers is improved.
Patent Information
- Application Number
- CN202510699818.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, the training data labeling of image classifiers is low and costly, making it difficult to take into account both high labeling efficiency and high labeling accuracy.
The pre-trained embedding model is used to obtain the feature vectors of the image and category description text, and the image categories are automatically labeled by calculating the feature similarity and analyzing the category labels.
It realizes efficient and accurate image annotation, taking into account both labeling efficiency and accuracy, and improving the performance of image classifiers.
Smart Images

Figure CN120544201A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image annotation method, apparatus, storage medium, and computer equipment. Background Art
[0002] With the development of deep learning technology, existing technologies have applied deep learning-based image classifiers to image analysis tasks such as image analysis, image retrieval, and image clustering to improve processing efficiency. However, before an image classifier can be put into use, it is necessary to use multiple sets of training data to train or fine-tune the model to ensure that the trained or fine-tuned image classifier achieves excellent classification performance. Each set of training data includes a training image and the corresponding classification label.
[0003] It's understandable that the accuracy of the classification labels in training data is a key factor influencing the performance of image classifiers. To ensure accurate labeling, existing techniques typically rely on manual annotation, which suffers from low efficiency and high costs. Therefore, there is an urgent need for an image annotation solution that balances high efficiency and accuracy. Summary of the Invention
[0004] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies, especially the technical deficiency in the prior art that it is impossible to achieve both high marking efficiency and high marking accuracy.
[0005] In a first aspect, an embodiment of the present application provides an image annotation method, comprising:
[0006] Obtain at least one image to be annotated and a plurality of category description texts; wherein the plurality of category description texts correspond to a plurality of category labels, and any of the category labels corresponds to at least two of the category description texts;
[0007] Using a pre-trained embedding model, respectively obtaining an image feature vector of each image to be annotated and a text feature vector of each category description text;
[0008] Calculating feature similarity between an image feature vector of a target image and each of the text feature vectors; wherein the target image is any one of the at least one image to be annotated;
[0009] Taking the category label as the statistical dimension, statistical analysis is performed based on the similarity of each feature to obtain the labeled category of the target image.
[0010] In some embodiments, the image to be annotated corresponds to an identity identifier;
[0011] The method of using the category label as a statistical dimension, performing statistical analysis based on the similarity of each feature, and obtaining the labeled category of the target image includes:
[0012] Determining an initial category of the target image based on the similarities of the features corresponding to the target image;
[0013] Using the category label as the statistical dimension, statistical analysis is performed on the initial categories of the same-category annotated images, and the number of occurrences of each category label is obtained; wherein the same-category annotated images are images to be annotated that have the same identity identifier as the target image;
[0014] The category label corresponding to the maximum number of occurrences is used as the labeled category of the target image; wherein the maximum number of occurrences is the maximum value among the respective numbers of occurrences.
[0015] In some embodiments, determining the initial category of the target image according to the similarities of the respective features corresponding to the target image includes:
[0016] Taking the category label as the statistical dimension, statistically analyzing the similarities of each feature corresponding to the target image, and obtaining the mean similarity corresponding to each category label;
[0017] The category label corresponding to the first maximum similarity is used as the initial category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
[0018] In some embodiments, determining the initial category of the target image according to the similarities of the respective features corresponding to the target image includes:
[0019] Determining a second maximum similarity among the feature similarities corresponding to the target image;
[0020] The category label corresponding to the second maximum similarity is used as the initial category of the target image.
[0021] In some embodiments, the statistical analysis is performed based on the similarity of each feature using the category label as the statistical dimension to obtain the labeled category of the target image, including:
[0022] Taking the category label as the statistical dimension, statistically analyzing the similarities of each feature corresponding to the target image, and obtaining the mean similarity corresponding to each category label;
[0023] The category label corresponding to the first maximum similarity is used as the labeled category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
[0024] In some embodiments, the target description text includes a label text corresponding to a category label, and the target description text also includes a role identity text and / or a status description text; the target description text is any one of the multiple category description texts;
[0025] And / or, the plurality of type description texts include texts in at least two languages.
[0026] In some embodiments, obtaining multiple category description texts includes:
[0027] The plurality of category description texts are randomly generated using a pre-trained text generation model.
[0028] In a second aspect, an embodiment of the present application provides an image annotation device, comprising:
[0029] A data acquisition module is configured to acquire at least one image to be annotated and a plurality of category description texts; wherein the plurality of category description texts correspond to a plurality of category labels, and any category label corresponds to at least two of the category description texts;
[0030] A vector acquisition module is used to use a pre-trained embedding model to respectively acquire an image feature vector of each image to be annotated and a text feature vector of each category description text;
[0031] A similarity calculation module, configured to calculate a feature similarity between an image feature vector of a target image and each of the text feature vectors; wherein the target image is any one of the at least one image to be annotated;
[0032] The labeling module is used to perform statistical analysis based on the similarity of each feature using the category label as a statistical dimension, and obtain the labeling category of the target image.
[0033] In a third aspect, an embodiment of the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image annotation method described in any of the above embodiments.
[0034] In a fourth aspect, an embodiment of the present application provides a computer device, the computer device comprising: one or more processors, and a memory;
[0035] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image annotation method described in any one of the above embodiments are performed.
[0036] In the image annotation methods, devices, storage media, and computer devices provided in some embodiments of the present application, a pre-trained embedding model can be used to obtain the image feature vector of each image to be annotated and the text feature vector of each text in multiple category description texts, and calculate the feature similarity between the image feature vector and each text feature vector. By using the category label as the statistical dimension and performing statistical analysis on the similarities of each feature, the annotation category of the image to be annotated can be accurately determined, thereby achieving automatic annotation. In this way, high annotation efficiency and high annotation accuracy can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0038] Figure 1 1 is a flow chart of an image annotation method in one embodiment;
[0039] Figure 2 In one embodiment, the present invention is a flowchart of a step of performing statistical analysis based on the similarity of each feature using the category label as a statistical dimension to obtain the category of the target image;
[0040] Figure 3 This is a second flow chart of the step of obtaining the target image's category labeling by using the category label as a statistical dimension and performing statistical analysis based on the similarity of each feature in one embodiment;
[0041] Figure 4 1 is a schematic structural diagram of an image annotation device in one embodiment;
[0042] Figure 5 FIG. 1 is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0044] In some embodiments, this application provides an image annotation method. The following embodiments illustrate this method using a computer device as an example. It should be understood that the computer device described herein refers to a device with data acquisition and data processing capabilities, and may include, but is not limited to, a desktop computer, a notebook computer, a laptop computer, a notebook computer, a smartphone, a wearable device, an IoT device, a server, and the like.
[0045] like Figure 1 As shown, the image annotation method of the present application may include the following steps:
[0046] S102: Obtain at least one image to be labeled and multiple category description texts.
[0047] The category description text can be used to describe the label information of a category label. And a category description text can only be used to describe the label information of one category label. The image to be labeled refers to the image whose category label is to be determined.
[0048] In the present application, a computer device may obtain at least one image to be annotated and multiple category description texts, and the multiple category description texts correspond to multiple category labels. It can be understood that the total number of multiple category labels and the specific label information of each category label can be determined according to the application field of the classification task, and this application does not impose specific restrictions on this. For example, in the field of animal classification, multiple category description texts may correspond to 4 category labels, and the 4 category labels are cat, dog, rabbit, and turtle. For another example, in the field of food classification, multiple category description texts may correspond to 5 category labels, and the 5 category labels are convenience food, beverages, snacks, fresh food, and others. For another example, in the field of male and female classification, multiple category description texts may correspond to 2 category labels, and the 2 category labels are male and female.
[0049] For ease of description, the present application embodiment is described using the field of gender classification as an example. It should be understood that in addition to the field of gender classification, the image annotation method provided by the present application can also be applied to other image classification fields.
[0050] Each of the multiple category labels corresponds to multiple category descriptions. In other words, each category label is described by at least two category descriptions with different textual content. For example, the category label "male" can correspond to the category descriptions "male doctor" and "male driver," and the category label "female" can correspond to the category descriptions "female doctor" and "female driver."
[0051] It should be noted that any two category labels can correspond to the same or different number of category description texts, and this application does not impose any specific restrictions on this. For example, the category label "male" can correspond to 2 category description texts, and the category label "female" can correspond to 2, 3, or 5 category description texts.
[0052] S104: Using the pre-trained embedding model, respectively obtain the image feature vector of each image to be annotated and the text feature vector of each category description text.
[0053] Among them, the embedding model refers to a model that can map high-dimensional discrete data (such as images, sentences, etc.) to the feature vector space, and the more similar the data content of the high-dimensional discrete data is, the more similar the feature vectors obtained after mapping are.
[0054] In this step, the computer device can input each image to be annotated and each category description text into the pre-trained embedding model, and obtain the image feature vector and text feature vector output by the embedding model. It is understood that the present application can use any type of embedding model to obtain feature vectors, such as the CLIP model, ViT model, ResNet model, etc., and the present application does not make any specific restrictions.
[0055] S106: Calculate the feature similarity between the image feature vector of the target image and each text feature vector; wherein the target image is any one of the at least one image to be annotated.
[0056] In this step, for each image to be annotated, the computer device calculates the feature similarity between the image feature vector of the image to be annotated and the text feature vector of each category description text. For example, if the computer device obtains two images to be annotated and four category description texts, the computer device can calculate the similarity between the image feature vector of the first image to be annotated and the four text feature vectors, and obtain the four feature similarities corresponding to the first image to be annotated. Similarly, the computer device can calculate the similarity between the image feature vector of the second image to be annotated and the four text feature vectors, and obtain the four feature similarities corresponding to the second image to be annotated.
[0057] S108: Using the category label as a statistical dimension, perform statistical analysis based on the similarity of each feature, and obtain the labeled category of the target image.
[0058] The annotation category refers to the category label corresponding to the image to be annotated.
[0059] In this step, for each image to be annotated, once the similarities of multiple features of the image are obtained, the computer device can perform a statistical analysis based on the similarities of the multiple features of the image to be annotated, using the category label as the statistical dimension, to obtain statistical analysis results corresponding to each category label. The computer device can then determine the category label corresponding to the image to be annotated from the multiple category labels based on the statistical analysis results, thereby achieving automatic labeling.
[0060] In this application, a pre-trained embedding model is used to obtain the image feature vector of each image to be annotated and the text feature vector of each text in multiple category description texts. The feature similarity between the image feature vector and each text feature vector is then calculated. By statistically analyzing the feature similarities using the category label as the statistical dimension, the annotation category of the image to be annotated can be accurately determined, enabling automatic annotation. This achieves both high annotation efficiency and high annotation accuracy.
[0061] In some embodiments, the image to be annotated is associated with an identity identifier. The identity identifier is used to uniquely identify the image's origin. For example, different images of the same person may be associated with the same identity identifier, while different images of different people may be associated with different identity identifiers. For another example, different images of the same product may be associated with the same identity identifier, while different images of different products may be associated with different identity identifiers.
[0062] In order to further improve the accuracy of automatic labeling, for N images to be labeled with the same identity attribution, this application can integrate the initial categories corresponding to the N images to be labeled and finally determine the labeling category corresponding to the N images to be labeled.
[0063] like Figure 2 As shown in the figure, we use the category label as the statistical dimension, perform statistical analysis based on the similarity of each feature, and obtain the labeled category of the target image, including:
[0064] S202: Determine the initial category of the target image based on the similarities of the features corresponding to the target image.
[0065] In this step, the computer device may preliminarily determine the initial category corresponding to the target image from among multiple category labels based on the feature similarity between the image feature vector of the target image and the text feature vectors of multiple category description texts.
[0066] For example, if a computer device receives two images to be annotated and four category label texts, the computer device can determine the initial category corresponding to the first image to be annotated based on the feature similarity between the first image to be annotated and the four category label texts. Similarly, the computer device can determine the initial category corresponding to the second image to be annotated based on the feature similarity between the second image to be annotated and the four category label texts.
[0067] S204: Using the category label as a statistical dimension, statistical analysis is performed on the initial categories of the same labeled images, and the number of occurrences corresponding to each category label is obtained.
[0068] The same-category annotated images are images to be annotated that have the same identity identifier as the target image. In this step, after obtaining the initial category corresponding to each image to be annotated, the computer device can perform a statistical analysis of the initial categories of each of the same-category annotated images based on the identity identifier to determine the number of occurrences of the same identity identifier under different category labels.
[0069] For example, the first identity attribution identifier corresponds to four images to be labeled, and the initial categories of the four images to be labeled are male, male, male, and female. In this case, the computer device can perform statistical analysis on the initial categories of the four images to be labeled and find that the category label male appears three times and the category label female appears once.
[0070] For example, the second identity attribution identifier corresponds to three images to be labeled, and the initial categories of the three images to be labeled are female, female, and male, respectively. In this case, the computer device can perform statistical analysis on the initial categories of the three images to be labeled and determine that the category label male appears once and the category label female appears twice.
[0071] S206: Using the category label corresponding to the maximum number of occurrences as the labeled category of the target image; wherein the maximum number of occurrences is the maximum value among all the numbers of occurrences.
[0072] In this step, for each identity attribution identifier, the computer device can determine the maximum value among the occurrence counts corresponding to the identity attribution identifier, and use the category label corresponding to the maximum value as the labeling category of all images to be labeled under the identity attribution identifier.
[0073] For example, in the above example, the first attribution identifier corresponds to four images to be labeled, and the category label "male" appears three times, and the category label "female" appears once. In this case, the computer device may label all four images to be labeled corresponding to the first identity attribution identifier as "male."
[0074] For example, in the above example, the second identity attribution identifier corresponds to three images to be labeled, and the category label "male" appears once, and the category label "female" appears twice. In this case, the computer device may label all three images to be labeled corresponding to the second identity attribution identifier as "female."
[0075] It is understood that in step S202, the computer device may use any method to determine the initial category of the image to be labeled. To further improve the accuracy of the initial category, in some embodiments, the present application may determine the initial category of the image to be labeled based on the average of multiple feature similarities.
[0076] Specifically, the initial category of the target image is determined based on the similarity of each feature corresponding to the target image, including:
[0077] Taking the category label as the statistical dimension, the similarity of each feature corresponding to the target image is statistically analyzed, and the mean similarity corresponding to each category label is obtained;
[0078] The category label corresponding to the first maximum similarity is used as the initial category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
[0079] In this embodiment, the target image has multiple feature similarities. The computer device can perform statistical analysis on the multiple feature similarities corresponding to the target image, using the category label as a statistical dimension, to determine the mean similarity corresponding to each category label. The computer device can determine the maximum value among the multiple mean similarities corresponding to the target image and use the category label corresponding to the maximum value as the initial category of the target image.
[0080] For example, when the category description text is "male doctor," "male driver," "female doctor," and "female driver," the computer device calculates through steps S102 to S106 that the feature similarity between the target image and "male doctor" is 0.45, the feature similarity between the target image and "male driver" is 0.55, the feature similarity between the target image and "female doctor" is 0.35, and the feature similarity between the target image and "female driver" is 0.25. In this case, the computer device can perform statistical analysis on the four feature similarities according to the category label and obtain the mean similarity corresponding to the category label "male" as (0.45 + 0.55) / 2 = 0.5, and the mean similarity corresponding to the category label "female" as (0.35 + 0.25) / 2 = 0.3. Since 0.5 is greater than 0.3, the category label "male" can be used as the initial category of the target image.
[0081] To further improve the labeling efficiency, in some embodiments, the present application may determine the initial category of the image to be labeled based on the maximum value of multiple feature similarities.
[0082] Specifically, the initial category of the target image is determined based on the similarity of each feature corresponding to the target image, including:
[0083] Determining a second maximum similarity among the feature similarities corresponding to the target image;
[0084] The category label corresponding to the second maximum similarity is used as the initial category of the target image.
[0085] In this embodiment, the computer device may determine the maximum value among the multiple feature similarities corresponding to the target image and use the category label corresponding to the maximum value as the initial category of the target image. For example, in the above example, the feature similarity between the target image and "male doctor" is 0.45, the feature similarity between the target image and "male driver" is 0.55, the feature similarity between the target image and "female doctor" is 0.35, and the feature similarity between the target image and "female driver" is 0.25. Among the four feature similarities, the maximum value is 0.55, so the category label corresponding to "male driver" (i.e., category label male) can be used as the initial category of the target image.
[0086] In some embodiments, as Figure 3 As shown in the figure, we use the category label as the statistical dimension, perform statistical analysis based on the similarity of each feature, and obtain the labeled category of the target image, including:
[0087] S302: Using the category label as a statistical dimension, statistically analyze the similarities of each feature corresponding to the target image, and obtain the mean similarity corresponding to each category label;
[0088] S304: Using the category label corresponding to the first maximum similarity as the labeled category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
[0089] In this embodiment, to achieve both high annotation accuracy and high annotation efficiency, the present application can determine the target image's annotation category based on the similarities of multiple features corresponding to the target image. Specifically, the target image has multiple feature similarities, and the computer device can perform statistical analysis on the multiple feature similarities corresponding to the target image using the category label as the statistical dimension to obtain the mean similarity corresponding to each category label. The computer device can determine the maximum value among the multiple mean similarities corresponding to the target image and use the category label corresponding to the maximum value as the annotation category of the target image.
[0090] For example, in the above example, the computer device can perform a statistical analysis of the similarities of the four features according to the category label and obtain the mean similarity corresponding to the category label "male" as (0.45 + 0.55) / 2 = 0.5, and the mean similarity corresponding to the category label "female" as (0.35 + 0.25) / 2 = 0.3. In this case, the computer device can directly use the category label "male" as the annotated category for the target image.
[0091] In some embodiments, any one of the plurality of category description texts is referred to as a target description text. The target description text may include a label text corresponding to a category label, such as "male" or "female".
[0092] In addition to the label text, the target description text may also include role identity text and / or status description text. Among them, the role identity text can be used to describe the identity role, which can be educational background, position in family relationships, age status description, etc. For example, the role identity text can be "doctor", "PhD", "father", "mother", "child", "middle school student", etc. The status description text can be used to describe the characteristics, movement conditions, and situations of people, things, systems or scenes at a specific time, such as "taking a walk", "appreciating flowers", "running", "wearing glasses", "taking off a necklace", "talking", etc. In this way, by adding role identity text and / or status description text to the category description text, the generalization ability can be improved to further improve the accuracy of subsequent automatic labeling.
[0093] In some embodiments, the multiple type description texts include texts in at least two languages, for example, some of the multiple category description texts are in Chinese and the rest are in English. This can improve generalization capabilities and further improve the accuracy of subsequent automatic annotation.
[0094] In some embodiments, obtaining multiple category description texts includes randomly generating multiple category description texts using a pre-trained large text generation model. The computer device can use the pre-trained large model to randomly generate multiple category description texts to further improve generalization capabilities and thereby improve the accuracy of automatic annotation.
[0095] The image annotation device provided in an embodiment of the present application is described below. The image annotation device described below and the image annotation method described above can be referenced to each other.
[0096] In some embodiments, as Figure 4 As shown, the present application provides an image annotation device 400, comprising:
[0097] The data acquisition module 402 is configured to acquire at least one image to be annotated and a plurality of category description texts; wherein the plurality of category description texts correspond to a plurality of category labels, and any category label corresponds to at least two of the category description texts;
[0098] A vector acquisition module 404 is configured to use a pre-trained embedding model to respectively acquire an image feature vector of each image to be annotated and a text feature vector of each category description text;
[0099] A similarity calculation module 406 is configured to calculate a feature similarity between an image feature vector of a target image and each of the text feature vectors; wherein the target image is any one of the at least one image to be annotated;
[0100] The labeling module 408 is configured to perform statistical analysis based on the similarities of the features using the category label as a statistical dimension, and obtain the labeling category of the target image.
[0101] In some embodiments, the image to be annotated corresponds to an identity identifier. The annotation module 408 of the present application includes:
[0102] an initial category determination unit, configured to determine an initial category of the target image based on the similarities of the features corresponding to the target image;
[0103] A first statistical analysis unit is configured to perform statistical analysis on the initial categories of the same-category annotated images using the category label as a statistical dimension, and obtain the number of occurrences of each category label; wherein the same-category annotated images are images to be annotated that have the same identity identifier as the target image;
[0104] The first labeling unit is configured to use the category label corresponding to the maximum number of occurrences as the labeling category of the target image; wherein the maximum number of occurrences is the maximum value among the respective numbers of occurrences.
[0105] In some embodiments, the initial category determination unit of the present application includes:
[0106] a mean similarity calculation unit, configured to perform statistical analysis on the similarities of the features corresponding to the target image using the category label as a statistical dimension, and obtain a mean similarity corresponding to each category label;
[0107] The first initial category screening unit is configured to use a category label corresponding to a first maximum similarity as an initial category of the target image; wherein the first maximum similarity is a maximum value among the mean similarities.
[0108] In some embodiments, the initial category determination unit of the present application includes:
[0109] a maximum similarity determination unit, configured to determine a second maximum similarity among the feature similarities corresponding to the target image;
[0110] The second initial category screening unit is configured to use the category label corresponding to the second maximum similarity as the initial category of the target image.
[0111] In some embodiments, the annotation module 408 of the present application includes:
[0112] A second statistical analysis unit is configured to perform statistical analysis on the similarities of the features corresponding to the target image using the category label as a statistical dimension, and obtain a mean similarity corresponding to each category label;
[0113] The second labeling unit is configured to use the category label corresponding to the first maximum similarity as the labeling category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
[0114] In some embodiments, the target description text includes a label text corresponding to a category label, and the target description text also includes a role identity text and / or a status description text; the target description text is any one of the multiple category description texts;
[0115] And / or, the plurality of type description texts include texts in at least two languages.
[0116] In some embodiments, the data acquisition module 402 of the present application includes:
[0117] A random generation unit is used to randomly generate the multiple category description texts using a pre-trained text generation model.
[0118] In one embodiment, the present application further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image annotation method in any embodiment.
[0119] In one embodiment, the present application further provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image annotation method in any embodiment.
[0120] Schematically, Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. In one example, the computer device may be a server. Figure 5 Computer device 900 includes a processing component 902, which further includes one or more processors, and a memory resource represented by memory 901 for storing instructions executable by processing component 902, such as an application. The application stored in memory 901 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 902 is configured to execute the instructions to perform the steps of the image annotation method described in any of the above embodiments.
[0121] The computer device 900 may further include a power supply component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input / output (I / O) interface 905. The computer device 900 may operate based on an operating system stored in the memory 901, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.
[0122] Those skilled in the art will understand that the internal structure of the computer device shown in the present application is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0123] Finally, it should be noted that, in this article, relational terms such as first and second are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. Without further restriction, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element. Herein, "one," "said," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. A plurality refers to at least two, such as 2, 3, 5, or 8. "And / or" includes any and all combinations of the relevant listed items.
[0124] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0125] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image annotation method, characterized in that: include: Obtain at least one image to be annotated and a plurality of category description texts; wherein the plurality of category description texts correspond to a plurality of category labels, and any of the category labels corresponds to at least two of the category description texts; Using a pre-trained embedding model, respectively obtaining an image feature vector of each image to be annotated and a text feature vector of each category description text; Calculating feature similarity between an image feature vector of a target image and each of the text feature vectors; wherein the target image is any one of the at least one image to be annotated; Taking the category label as the statistical dimension, statistical analysis is performed based on the similarity of each feature to obtain the labeled category of the target image.
2. The method according to claim 1, characterized in that The image to be annotated corresponds to an identity identifier; The method of using the category label as a statistical dimension, performing statistical analysis based on the similarity of each feature, and obtaining the labeled category of the target image includes: Determining an initial category of the target image based on the similarities of the features corresponding to the target image; Using the category label as the statistical dimension, statistical analysis is performed on the initial categories of the same-category annotated images, and the number of occurrences of each category label is obtained; wherein the same-category annotated images are images to be annotated that have the same identity identifier as the target image; The category label corresponding to the maximum number of occurrences is used as the labeled category of the target image; wherein the maximum number of occurrences is the maximum value among the respective numbers of occurrences.
3. The method according to claim 2, characterized in that The determining the initial category of the target image according to the similarities of the respective features corresponding to the target image includes: Taking the category label as the statistical dimension, statistically analyzing the similarities of each feature corresponding to the target image, and obtaining the mean similarity corresponding to each category label; The category label corresponding to the first maximum similarity is used as the initial category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
4. The method according to claim 2, characterized in that The determining the initial category of the target image according to the similarities of the respective features corresponding to the target image includes: Determining a second maximum similarity among the feature similarities corresponding to the target image; The category label corresponding to the second maximum similarity is used as the initial category of the target image.
5. The method according to claim 1, characterized in that The method of using the category label as a statistical dimension, performing statistical analysis based on the similarity of each feature, and obtaining the labeled category of the target image includes: Taking the category label as the statistical dimension, statistically analyzing the similarities of each feature corresponding to the target image, and obtaining the mean similarity corresponding to each category label; The category label corresponding to the first maximum similarity is used as the labeled category of the target image; wherein the first maximum similarity is the maximum value among the mean similarities.
6. The method according to any one of claims 1 to 5, characterized in that The target description text includes a label text corresponding to a category label, and the target description text also includes a role identity text and / or a status description text; the target description text is any one of the multiple category description texts; And / or, the plurality of type description texts include texts in at least two languages.
7. The method according to claim 6, characterized in that Get multiple category description texts, including: The plurality of category description texts are randomly generated using a pre-trained text generation model.
8. An image annotation device, characterized in that: include: A data acquisition module is configured to acquire at least one image to be annotated and a plurality of category description texts; wherein the plurality of category description texts correspond to a plurality of category labels, and any category label corresponds to at least two of the category description texts; A vector acquisition module is used to use a pre-trained embedding model to respectively acquire an image feature vector of each image to be annotated and a text feature vector of each category description text; A similarity calculation module, configured to calculate a feature similarity between an image feature vector of a target image and each of the text feature vectors; wherein the target image is any one of the at least one image to be annotated; The labeling module is used to perform statistical analysis based on the similarity of each feature using the category label as a statistical dimension, and obtain the labeling category of the target image.
9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the image annotation method according to any one of claims 1 to 7.
10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the image annotation method according to any one of claims 1 to 7 are performed.