Image annotation method, device, equipment, storage medium and computer program product
Through the image annotation method, image processing model and deep learning model are used to automatically label image data, solving the problem of time-consuming and laborious manual annotation and lack of basic models in the prior art, and achieving fast and efficient image annotation.
Patent Information
- Application Number
- CN202411860507.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-04
AI Technical Summary
In the prior art, conventional machine vision algorithms require a large amount of manual marking data when facing new business scenarios, and lack basic models, resulting in an increase in time and resource costs.
An image annotation method is proposed. By inputting the initial image data to be marked into the preset image processing model for segmentation, obtaining the foreground entity and recording the position coordinates; then selecting samples, extracting the feature matrix through the deep learning model, using the content annotation algorithm for annotation, and correlating the position coordinates to achieve object detection annotation.
After a small amount of labeling guidance, data from new tasks and new scenarios can be quickly and automatically marked, reducing manual workload and improving labeling efficiency.
Smart Images

Figure CN119762914A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to an image annotation method, apparatus, device, storage medium and computer program product. Background Art
[0002] Conventional deep learning classification or detection models can only reason about fixed labeling tasks when faced with new labeling tasks, lacking flexibility and versatility. For new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, manual labeling is time-consuming and laborious, and there is no basic model, so it is necessary to start from scratch, further increasing time and resource costs. Summary of the invention
[0003] The main purpose of this application is to provide an image annotation method, device, equipment, storage medium and computer program product, aiming to solve the technical problem that for new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, while manual labeling is time-consuming and labor-intensive, and there is no basic model, so it needs to start from scratch, further increasing time and resource costs.
[0004] To achieve the above objectives, the present application proposes an image annotation method, which includes:
[0005] Inputting the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity, and recording the position coordinates of the foreground entity in the initial image data;
[0006] Selecting a first specified number of first category samples from the foreground entities;
[0007] Transmitting the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity;
[0008] The remaining entity images in the foreground entity are labeled according to the first category samples and the feature matrix through a content labeling algorithm, and the position coordinates are associated to obtain a target detection labeling result.
[0009] Optionally, the step of annotating the remaining entity images in the foreground entity by a content annotation algorithm according to the first category samples and the feature matrix, and associating the position coordinates to obtain the target detection annotation result includes:
[0010] Constructing a content scoring matrix based on the first category samples and the feature matrix;
[0011] Determine the score vectors of the remaining entity images in the foreground entity based on the content score matrix, and calculate the similarity between the score vector and the score matrix;
[0012] Determine the category of the entity image according to the similarity, and mark the category on the corresponding entity image to obtain an initial marking result;
[0013] The initial annotation result is associated with the initial image data based on the position coordinates to obtain a target detection annotation result.
[0014] Optionally, the step of determining the category of the entity image according to the similarity, and marking the category on the corresponding entity image to obtain an initial marking result includes:
[0015] Sorting the similarities, and counting the number of image categories corresponding to the top N first category samples with the highest similarities according to the sorting results, where N is a preset similarity threshold, which can be adjusted according to historical annotation data;
[0016] When the number of the image categories exceeds the preset number of categories, the image category is used as the category of the entity picture and annotated to obtain an initial annotation result.
[0017] Optionally, after the step of inputting the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity, and recording the position coordinates of the foreground entity in the initial image data, the method further includes:
[0018] Selecting a second specified number of second category samples from the foreground entities;
[0019] Labeling the second category samples according to the attributes of the second category samples, and constructing an attribute scoring matrix according to the labeling results;
[0020] Calculating an attribute similarity matrix of the foreground entity based on the attribute scoring matrix;
[0021] The unlabeled attributes in the foreground entity are labeled according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result.
[0022] Optionally, the step of labeling the unlabeled attributes in the foreground entity according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result includes:
[0023] Determine an attribute vector of an unlabeled attribute in the foreground entity in the attribute similarity matrix according to a collaborative filtering algorithm, wherein the attribute vector represents a similarity relationship between the unlabeled attribute and the labeled attribute;
[0024] Selecting the first M labeled attributes with the highest similarity to the unlabeled attribute according to the attribute vector, and obtaining the label values corresponding to the labeled attributes in the attribute scoring matrix;
[0025] The unlabeled attributes are labeled based on the labeled values to obtain a multi-attribute labeling result.
[0026] Optionally, the step of labeling the unlabeled attributes based on the label values to obtain a multi-attribute labeling result includes:
[0027] The attribute vector is set as a weight, and a weighted average calculation is performed on the annotation value to obtain a target annotation value;
[0028] The unlabeled attributes are labeled based on the target labeling value to obtain a multi-attribute labeling result.
[0029] In addition, to achieve the above-mentioned purpose, the present application also proposes an image annotation device, which includes:
[0030] An image segmentation module, used for inputting the initial image data to be annotated into a preset image processing model for segmentation, obtaining a foreground entity, and recording the position coordinates of the foreground entity in the initial image data;
[0031] A sample selection module, configured to select a first specified number of first category samples from the foreground entity according to the category of the foreground entity;
[0032] A feature extraction module, used to transmit the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity;
[0033] The target labeling module is used to label the remaining entity images in the foreground entity according to the first category samples and the feature matrix through a content labeling algorithm, and associate the position coordinates to obtain a target detection labeling result.
[0034] In addition, to achieve the above objectives, the present application also proposes an image annotation device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the image annotation method described above.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the image annotation method described above are implemented.
[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the image annotation method described above are implemented.
[0037] The present application discloses the input of the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity, and record the position coordinates of the foreground entity in the initial image data; select a first specified number of first category samples from the foreground entity; transmit the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity; annotate the remaining entity images in the foreground entity through a content annotation algorithm based on the first category samples and the feature matrix, and associate the position coordinates to obtain the target detection annotation result. By leveraging the general knowledge capabilities of the large model and the collaborative integration with the dedicated small model, the data of new tasks and new scenes can be quickly and automatically annotated after a small amount of annotation guidance. Compared with the traditional method of completely manual annotation or the method of training the model after a large amount of manual annotation, it greatly reduces the manual workload and improves the annotation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 This is a schematic diagram of the process of the first embodiment of the image annotation method of the present application;
[0041] Figure 2 This is a flow chart of the target detection and annotation task of the image annotation method of this application;
[0042] Figure 3 This is a flow chart of the second embodiment of the image annotation method of the present application;
[0043] Figure 4 This is a schematic diagram of the algorithm based on content annotation for this application;
[0044] Figure 5 This is a schematic diagram of the process of the third embodiment of the image annotation method of the present application;
[0045] Figure 6 This is a multi-attribute annotation task flow chart of the image annotation method of this application;
[0046] Figure 7 This is a schematic diagram of the algorithm based on collaborative filtering annotation for this application;
[0047] Figure 8 This is a schematic diagram of the module structure of the image annotation device according to an embodiment of the present application;
[0048] Fig. 9 Schematic diagram of the device structure of the hardware operating environment involved in the image annotation method in the embodiment of the present application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution of the embodiment of the present application is: input the initial image data to be labeled into a preset image processing model for segmentation to obtain a foreground entity, and record the position coordinates of the foreground entity in the initial image data; select a first specified number of first category samples from the foreground entity; transmit the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity; label the remaining entity images in the foreground entity through a content labeling algorithm based on the first category samples and the feature matrix, and associate the position coordinates to obtain a target detection labeling result.
[0053] As artificial intelligence technology is changing with each passing day, it has brought great progress to various fields. Image annotation, as the basic work content in the field of computer vision, can improve model performance and enhance model robustness, and has an important impact on the implementation of algorithm models. However, traditional image annotation methods mainly rely on manual annotation, which consumes a lot of manpower costs and time. With the advancement of technology, there are various methods to try to reduce the dependence of artificial intelligence on manual annotation, including transforming supervised learning to semi-supervised or self-supervised, or using active learning and model pre-labeling methods to improve annotation efficiency.
[0054] Therefore, this application combines large model technology and related mature algorithms of similar recommendation systems to realize single-task multi-category target detection and labeling and multi-task multi-category attribute labeling tasks. After a small amount of manual labeling guidance, it can quickly and automatically label data for new tasks and new scenes, thereby realizing a more convenient and efficient automated labeling solution.
[0055] It should be noted that the execution subject of this embodiment can be a computing service device, a computer, etc., with data processing, network communication and program running functions, or an electronic device capable of realizing the above functions, etc. The following takes the automatic annotation system as an example to illustrate this embodiment and the following embodiments.
[0056] Based on this, the present application embodiment provides an image annotation method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the image annotation method of the present application.
[0057] In this embodiment, the image annotation method includes:
[0058] Step S10: input the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity, and record the position coordinates of the foreground entity in the initial image data.
[0059] It should be noted that the initial image data is the original image information that needs to be annotated and is the source of input data for the image annotation task. For example, in a medical image annotation project, the initial image data to be annotated can be the patient's X-ray, CT scan image, etc.; in an autonomous driving scenario, it can be a road scene image taken by a vehicle camera. The preset image processing model is a pre-set model for performing specific processing on an image (such as image segmentation), such as the SAM (Segment Anything Model) large model, the U-Net model, etc., which can segment the image into different areas according to its features. The foreground entity is an object or area that is in a primary position in the image and needs to be annotated and identified.
[0060] It should be understood that the position coordinates may determine information about the specific position of the foreground entity in the initial image data, such as the horizontal coordinate and the vertical coordinate, so as to subsequently accurately associate the annotation information with the initial image data.
[0061] In one example, when the SAM large model is used to segment the initial image data, the image reading function is used to load the initial image data to be annotated. The initial image data is the original image file that actually needs to be segmented, and the image format of the initial image data is converted to RGB format (sequential storage of the three color channels of blue, green, and red). By calling the automatic mask generator and associating the instantiated SAM large model, the converted image is passed into the automatic mask generator. According to the features and patterns learned by the SAM large model on a large-scale data set, the image is automatically analyzed to try to find all possible foreground entities in the image, and a corresponding mask is generated for each identified foreground entity. By checking the image area covered by each mask, the approximate distribution of the foreground entities considered by the model is understood, and the mask with the highest confidence is selected as the segmentation result that best meets the expectations. The initial image data is segmented and the position data before segmentation is recorded.
[0062] Step S20: selecting a first specified number of first category samples from the foreground entities.
[0063] It should be noted that the first specified number is a specific value that is pre-set to specify the number of samples to be selected from the foreground entities. It can be determined based on the actual labeling task requirements, image data characteristics, and subsequent algorithm processing requirements. For example, in a simple image classification labeling task, the first specified number can be set to 10, indicating that 10 samples are to be selected from all segmented foreground entities; in complex, multi-category labeling scenarios, this number may increase accordingly. The first category samples are representative samples selected from the foreground entities, which are used as a reference for labeling the remaining foreground entities.
[0064] It is understandable that the first specified number of first category samples can be selected from the foreground entity by random selection, which simply extracts the first specified number of samples as the first category samples from all the segmented foreground entities in a completely random manner. It is also possible to adopt a category-balanced selection method, first classify and count the foreground entities according to their preliminary characteristics or known approximate categories, and understand the proportion of foreground entities of different categories. Then, according to the proportion of each category in the total, a corresponding number of samples are selected from each category, so that the selected first category samples can be relatively balanced in category. It is also possible to adopt a manual selection method, relying on manual experience and professional knowledge, to select samples with typical characteristics, which can clearly represent different categories and are helpful for subsequent labeling work from the foreground entities as the first category samples.
[0065] Step S30, transmitting the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity.
[0066] It should be noted that the target deep learning model is a deep learning model that is pre-set according to the specific image annotation task and data characteristics, such as a convolutional neural network or a lightweight network specially designed for image feature extraction.
[0067] It can be understood that each row of the calculated feature matrix can correspond to a foreground entity, and each column represents features of different dimensions, such as a certain value representing a texture feature, a specific parameter reflecting a shape feature, etc.
[0068] Step S40: annotate the remaining entity images in the foreground entity using a content annotation algorithm according to the first category samples and the feature matrix, and associate the position coordinates to obtain a target detection annotation result.
[0069] It should be noted that the remaining entity images are images corresponding to foreground entities other than the first category samples previously selected. These images have not yet been labeled and are waiting to be determined by comparing with the first category samples.
[0070] It is understandable that when the remaining entity images in the foreground entity are annotated according to the first category samples and the feature matrix, the feature matrix of the first category samples and the feature matrix of the remaining entity images can be used to calculate the similarity between the remaining entity images and the first category samples one by one according to the selected similarity calculation method (such as the cosine similarity mentioned above) to construct a scoring matrix. For each remaining entity image, its similarity data in the scoring matrix is analyzed, and its category is determined by sorting, statistics, etc. according to preset judgment rules (such as similarity threshold, category quantity threshold, etc.). After determining the category of the remaining entity image, according to its corresponding position coordinates, the category annotation information is added to the corresponding position of the original image in an appropriate manner (such as text annotation, icon annotation, etc.), and the annotation results of all foreground entities are integrated to form a complete target detection annotation result.
[0071] In one example, reference Figure 2 , Figure 2This is a flow chart of the target detection and annotation task of the image annotation method of this application. The picture collection in the figure is the initial image data, and the picture collection is input into the SAM large model. The SAM large model can segment the objects in the picture to obtain segmented entities, and these segmented entities are not classified. After obtaining the segmented entities, the coordinate position of each segmented entity in the original picture is recorded. Then, based on manual selection, a small number of representative category samples are selected from the segmented entities to provide a reference for subsequent classification. The segmented entity is input into the small model to obtain the feature matrix of each entity picture and store it in the form of a dictionary. According to the feature matrix and a small number of category samples, the segmented entities are classified and labeled to determine the category of each segmented entity. The results of the classification and annotation are associated with the original picture according to the previously recorded coordinate position table, and finally the target detection and annotation results of the original picture are obtained, completing the target detection and annotation task for the picture collection.
[0072] In this embodiment, the initial image data to be annotated is input into a preset image processing model for segmentation to obtain a foreground entity, and the position coordinates of the foreground entity in the initial image data are recorded; a first specified number of first category samples are selected from the foreground entity; the foreground entity is transmitted to a preset target deep learning model to obtain a feature matrix of the foreground entity; the remaining entity images in the foreground entity are annotated by a content annotation algorithm based on the first category samples and the feature matrix, and the position coordinates are associated to obtain the target detection annotation result. By leveraging the general knowledge capabilities of the large model and the collaborative integration with the dedicated small model, the data of new tasks and new scenes can be quickly and automatically annotated after a small amount of annotation guidance. Compared with the traditional method of completely manual annotation or the method of training the model after a large amount of manual annotation, it greatly reduces the manual workload and improves the annotation efficiency.
[0073] Reference Figure 3 , Figure 3 This is a flow chart of the second embodiment of the image annotation method of the present application. Based on the above-mentioned first embodiment, the second embodiment of the image annotation method of the present application is proposed.
[0074] In the second embodiment, the step S40 includes:
[0075] Step S401: construct a content scoring matrix according to the first category samples and the feature matrix.
[0076] It should be noted that the content scoring matrix is a matrix used to represent the similarity between the first category samples and other entities in terms of content features. The elements in the matrix are scoring values calculated based on the feature matrix, which are used to measure the similarity between different entities, thereby assisting classification and labeling operations.
[0077] It can be understood that constructing the content scoring matrix according to the first category samples and the feature matrix can be performed by calculating the similarity between the first category samples and the remaining entity images respectively and taking the average value as the value of each item of the content scoring matrix.
[0078] In one example, the content score matrix Q has a shape of m*n rows and n columns, where n is the number of categories to be labeled and m is the number of sub-image samples manually selected for each category. The matrix value is avg(sim(img_j,class_i_img)), and the calculation process is as follows:
[0079]
[0080] Where j∈m*n, i∈n, cos(img_j,img_class_i_jj) is the cosine similarity between the feature matrix of image j and the feature vector of image jj in category class_i. The average of the similarities between image j and m images in category i is taken as the value of row j and column i in the score matrix Q.
[0081] Step S402: determining the score vectors of the remaining entity images in the foreground entity based on the content score matrix, and calculating the similarity between the score vector and the score matrix.
[0082] It should be noted that the rating vector is a similarity rating calculated based on the relationship between each remaining entity image and the first category sample in the content rating matrix.
[0083] Step S403, determining the category of the entity image according to the similarity, and marking the category on the corresponding entity image to obtain an initial marking result.
[0084] Furthermore, in order to avoid incorrect labeling due to individual abnormal samples, the step S403 may include:
[0085] The similarities are sorted, and according to the sorting results, the number of image categories corresponding to the top N first category samples with the highest similarities is counted, where N is a preset similarity threshold, which can be adjusted according to historical annotation data; when the number of image categories exceeds the preset number of categories, the image category is used as the category of the entity picture and annotated to obtain an initial annotation result.
[0086] It should be noted that N is the preset similarity threshold, which means that when making category judgments, the top N first-category samples with the highest similarity to the remaining entity images are considered. This value can be adjusted based on historical annotation data to optimize the classification effect. The preset number of categories is used to determine whether the number of a certain image category is sufficient among the top N first-category samples with the highest similarity, so as to determine whether to use the image category as the category of the entity image.
[0087] In one example, for the remaining images to be labeled, after calculating the score vector x of the image according to the content score matrix Q, the similarity between x and Q is calculated to obtain the similarity between the image to be labeled and the labeled image, and the number of categories corresponding to the top N images with the highest similarity values is counted. If the number of categories exceeds a certain threshold, the image is labeled as this category. N can be modified based on experience and can be equal to m (the number of sub-image samples manually selected for each category), and the threshold is also an adjustable value, generally set to int(m / 2).
[0088] Step S404: Associating the initial annotation result with the initial image data based on the position coordinates to obtain a target detection annotation result.
[0089] In one example, reference Figure 4 , Figure 4 This is a schematic diagram of the algorithm based on content annotation for this application. When annotating based on content, it is necessary to calculate the scoring matrix, and generate a scoring matrix R with m*n rows based on the determined n (number of annotated categories) and m (number of entity images selected for each category). Each element in the matrix is obtained by calculating the correlation between the image img_i and the category calss_j. The specific technical method is avg(sim(img_j,class_i_img)), where the sim function is used to calculate the similarity, and the avg function is used to find the average value. For the unknown category image img_x, its scoring vector x is calculated in a similar way to the calculation of the scoring matrix elements. After completing the calculation of the scoring vector, the category corresponding to the highest similarity is obtained by sorting by similarity. Here, the similarity is calculated based on the scoring vector of the image img_x and the scoring matrix R, and these similarities are sorted to find the top N categories with the highest similarity. Finally, from the top N categories with the highest similarity obtained, the category with more than the specified number NUM occurrences is selected and determined as the final category of the unknown image, so as to realize the content-based annotation of the unknown category image.
[0090] In this embodiment, a content scoring matrix is constructed based on the first category samples and the feature matrix; the scoring vectors of the remaining entity images in the foreground entity are determined based on the content scoring matrix, and the similarity between the scoring vector and the scoring matrix is calculated; the category of the entity image is determined based on the similarity, and the category is marked on the corresponding entity image to obtain an initial marking result; the initial marking result is associated with the initial image data based on the position coordinates to obtain a target detection marking result. The scoring matrix can be used to systematically compare the feature similarity between the remaining entity images and the first category samples, thereby providing a more scientific basis for accurately marking the category of the entity images. The marking effect of the target detection marking task for new scenes and new tasks is suggested.
[0091] Reference Figure 5 , Figure 5 This is a flow chart of the third embodiment of the image annotation method of the present application. Based on the above second embodiment, the third embodiment of the image annotation method of the present application is proposed.
[0092] In the third embodiment, after step S10, the method further includes:
[0093] Step S101 : selecting a second specified number of second category samples from the foreground entities.
[0094] It should be noted that the second specified number is a pre-set integer, which specifies the number of samples to be selected from the foreground entity. The second specified number depends on the subsequent attribute labeling task requirements, the amount of model training data, etc. The second category samples are samples of a specific category (categories can be divided based on different attributes) selected from the foreground entity, for example, they can be divided into categories according to the type of fruit (such as apples, bananas, etc.), or according to attributes such as the maturity of the fruit.
[0095] It is understandable that the second specified number of second category samples can be selected from the foreground entities according to a pre-set rule. For example, if it is known that some foreground entities in the image have specific visual features (such as specific shapes, colors, etc.), they can be selected according to these features. It is also possible to manually and randomly select a second specified number of samples from the foreground entities as second category samples. It is also possible to stratify according to certain attributes (such as stratification by gender), and then extract a certain number of samples from each layer in proportion as second category samples.
[0096] Step S102: labeling the second category samples according to the attributes of the second category samples, and constructing an attribute scoring matrix according to the labeling results.
[0097] It should be noted that the attributes of the second category samples refer to the characteristics or properties of the second category samples, which may include visual features such as shape, color, texture, size, etc., and may also include semantic features, such as animal species and behavior. The attribute scoring matrix is used to quantify and represent the similarity or conformity between the second category samples in different attributes. The rows and columns in the matrix correspond to the second category samples, and the elements in the matrix represent the scores of the samples on specific attributes.
[0098] In one example, the value of the rating matrix R is the category value of a certain attribute of the image (such as the i-th attribute of image j). Assuming the attribute task is age, the age is divided into 5 categories, namely 0-15, 16-30, 30-45, 45-60, and above 60. If the attribute category value is 3, it means that the age is between 45 and 60. In this way, an R matrix with m rows and n columns is obtained, where m is the number of labeled images and n is the number of attribute tasks.
[0099] Step S103: calculating the attribute similarity matrix of the foreground entity based on the attribute scoring matrix.
[0100] It should be noted that the attribute similarity matrix is a matrix used to represent the similarity between foreground entities in various attributes. The rows and columns of the attribute similarity matrix usually correspond to foreground entities, and the element values in the matrix reflect the attribute similarity between the corresponding foreground entities. For example, in the attribute similarity matrix of a fruit foreground entity, the element value represents the similarity between the two objects in attributes such as shape and color.
[0101] It is understandable that the calculation of the attribute similarity matrix needs to select an appropriate calculation method based on the data characteristics and application requirements, such as the weighted average method or the distance measurement method. If the weighted average method is selected, the weights of each attribute need to be reasonably determined; if the distance measurement method is selected, the range of attribute scores and data distribution need to be considered, and an appropriate distance measurement formula and similarity conversion method need to be selected.
[0102] Step S104: labeling the unlabeled attributes in the foreground entity according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result.
[0103] It should be noted that the collaborative filtering algorithm is an algorithm for recommendation based on user behavior data. In this attribute labeling task, attribute labeling is performed based on the attribute similarity between foreground entities. Unlabeled attributes are unlabeled features or characteristics of foreground entities.
[0104] It should be understood that for multi-attribute tasks, the application goal of this application is to solve the situation where certain attribute values are already available but not fully labeled. Taking a group of people pictures as an example, the task is to label a series of attributes in this batch of pictures, such as "gender, age, hairstyle, top style, top color, whether smoking, expression, whether carrying items, whether wearing a hat, etc.", and some of the attribute values of these attributes in this batch of pictures have been obtained in some way. When all the above attribute values need to be completed, this method can be used.
[0105] In one example, reference Figure 6 , Figure 6 This is a multi-attribute labeling task flow chart for the image labeling method of this application. The figure starts with the segmentation operation of the image, and the segmented entities are obtained, but at this time these entities are not classified. Then, a small number of samples are selected from these segmented entities by manual selection, and these small samples are labeled by category. Subsequently, all segmented entity images are input into the small model, which processes these entity images, generates a feature matrix for each entity image, and stores these feature matrices in the form of a dictionary. After that, enter the multi-attribute classification link based on collaborative filtering. In this step, the feature matrix dictionary obtained previously is used, combined with a small number of manually labeled samples, to classify all segmented entities by multi-attributes through collaborative filtering technology. Then, according to the results of the multi-attribute classification, each segmented entity is labeled. Finally, the category information of the labeled segmented entity is associated with the original image, so that each object or area in the original image can correspond to the accurate attribute labeling. The final result is the original image with target detection and multi-attribute labeling, that is, the position of each object and their multi-attribute category information are clearly displayed on the original image, completing the entire multi-attribute labeling task.
[0106] Furthermore, in order to specifically refer to the information of the marked attributes and improve the accuracy and reliability of the marking, the step S104 may include:
[0107] According to the collaborative filtering algorithm, the attribute vector of the unlabeled attribute in the foreground entity in the attribute similarity matrix is determined, wherein the attribute vector represents the similarity relationship between the unlabeled attribute and the labeled attribute; according to the attribute vector, the first M labeled attributes with the highest similarity to the unlabeled attribute are selected, and the labeling values corresponding to the labeled attributes in the attribute scoring matrix are obtained; the unlabeled attributes are labeled based on the labeling values to obtain a multi-attribute labeling result.
[0108] It should be noted that the attribute vector is the representation vector of the unlabeled attribute in the attribute similarity matrix. It reflects the similarity relationship between the unlabeled attribute and other labeled attributes. M is the selection quantity threshold, which represents the number of labeled attributes selected from the most similar unlabeled attributes. If the M value is large, it means that more labeled attributes will be considered to determine the value of the unlabeled attribute, which will make the labeling result more accurate, but the amount of calculation will also increase accordingly. When the M value is small, the labeling process mainly depends on a small number of labeled attributes that are most similar to the unlabeled attribute, which may cause the labeling result to be greatly affected by individual similar attributes.
[0109] It is understandable that when determining the attribute vector of the unlabeled attribute, the vector corresponding to the unlabeled attribute can be found in the attribute similarity matrix according to the collaborative filtering algorithm. For example, if there are foreground entities A, B, C, etc., for the unlabeled attribute in A, the similarity vector between the unlabeled attribute and the labeled attributes of entities A, B, C, etc. is determined in the attribute similarity matrix through the collaborative filtering algorithm. According to the attribute vector obtained above, the first M labeled attributes with the highest similarity to the unlabeled attribute are selected. Assuming that the attribute vector represents that the similarity values of the unlabeled attribute and other labeled attributes are 0.2, 0.5, 0.3, etc., respectively, the labeled attributes corresponding to the largest M values are selected. Finally, the label values corresponding to the first M labeled attributes are found in the attribute scoring matrix, and the unlabeled attributes are labeled based on the obtained label values. For example, the label value of the unlabeled attribute can be calculated by weighted average or other methods. Assuming that the label values of the first M labeled attributes are 3, 4, and 5, and the corresponding similarities are 0.4, 0.3, and 0.3, respectively, then the label value of the unlabeled attribute may be (3×0.4+4×0.3+5×0.3), thus obtaining a multi-attribute labeling result.
[0110] Furthermore, in order to make the final labeling result more inclined to the information of the labeled attribute that is most similar to the unlabeled attribute, the step of labeling the unlabeled attribute based on the label value to obtain the multi-attribute labeling result may include:
[0111] The attribute vector is set as a weight, and the labeled value is weighted averaged to obtain a target labeled value; the unlabeled attribute is labeled based on the target labeled value to obtain a multi-attribute labeling result.
[0112] In one example, reference Figure 7 , Figure 7This is a schematic diagram of the algorithm based on collaborative filtering annotation in this application. The overall process of collaborative filtering annotation includes building a scoring matrix, calculating attribute similarity, inferring the category of unlabeled images, and weighted averaging, and finally obtaining the predicted category of unlabeled images. First, manually label the entity images and build a scoring matrix R with m (number of entity images) rows and n (number of attribute tasks) columns. The R in the matrix R ij The element represents the score of the i-th image (img_i) on the j-th attribute (attr_j). For example, img_0 has a score of 3 on attr_0 and a score of 1 on attr_1, etc. Calculate the similarity between attributes (attr) based on the score matrix R, and construct an attribute similarity matrix with n rows and n columns, where the similarity between attr_i and attr_j can be calculated by cosine similarity. For each attribute attr_i, determine the N attributes with the highest similarity from the attribute similarity matrix. Perform category inference on the attributes of the unlabeled image based on the attributes, and perform weighted average of the scores of the first N similar attributes corresponding to the unlabeled image in the score matrix based on the attribute vector to determine the category of the attribute.
[0113] In this embodiment, a second specified number of second category samples are selected from the foreground entity; the second category samples are labeled according to the attributes of the second category samples, and an attribute scoring matrix is constructed according to the labeling results; the attribute similarity matrix of the foreground entity is calculated based on the attribute scoring matrix; the unlabeled attributes in the foreground entity are labeled according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result. After completing the foreground entity segmentation, a multi-attribute labeling process is further introduced to select second category samples from the foreground entity and construct a correlation matrix, which adds multi-attribute dimensional information to the image labeling. The characteristics of the image in multiple attributes are fully reflected.
[0114] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the image annotation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0115] This application also provides an image annotation device, please refer to Figure 8 , the image annotation device comprises:
[0116] An image segmentation module 10 is used to input the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity and record the position coordinates of the foreground entity in the initial image data;
[0117] A sample selection module 20, configured to select a first specified number of first category samples from the foreground entities according to the category of the foreground entities;
[0118] A feature extraction module 30, used to transmit the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity;
[0119] The target labeling module 40 is used to label the remaining entity images in the foreground entity according to the first category samples and the feature matrix through a content labeling algorithm, and associate the position coordinates to obtain a target detection labeling result.
[0120] The image annotation device provided by the present application adopts the image annotation method in the above embodiment, which can solve the technical problem that for new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, while manual labeling is time-consuming and labor-intensive, and there is no basic model, so it is necessary to start from scratch, further increasing time and resource costs. Compared with the prior art, the beneficial effects of the image annotation device provided by the present application are the same as the beneficial effects of the image annotation method provided by the above embodiment, and the other technical features in the image annotation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0121] The present application provides an image annotation device, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the image annotation method in the above-mentioned embodiment 1.
[0122] Reference below Fig. 9 , which shows a schematic diagram of the structure of an image annotation device suitable for implementing an embodiment of the present application. The image annotation device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The image annotation device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0123] like Fig. 9As shown, the image annotation device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the image annotation device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the image annotation device to communicate with other devices wirelessly or by wire to exchange data. Although the image annotation device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0124] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0125] The image annotation device provided by the present application adopts the image annotation method in the above embodiment, which can solve the technical problem that for new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, while manual labeling is time-consuming and labor-intensive, and there is no basic model, so it is necessary to start from scratch, further increasing time and resource costs. Compared with the prior art, the beneficial effects of the image annotation device provided by the present application are the same as the beneficial effects of the image annotation method provided by the above embodiment, and the other technical features in the image annotation device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0126] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0127] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0128] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the image annotation method in the above-mentioned embodiment.
[0129] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0130] The computer-readable storage medium may be included in the image annotation device; or may exist independently without being assembled into the image annotation device.
[0131] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the image annotation device, the image annotation device executes the image annotation method described above.
[0132] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0133] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0134] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0135] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned image annotation method, which can solve the technical problem that for new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, while manual labeling is time-consuming and labor-intensive, and there is no basic model, so it is necessary to start from scratch, further increasing time and resource costs. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the image annotation method provided by the above-mentioned embodiment, which will not be repeated here.
[0136] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned image annotation method when executed by a processor.
[0137] The computer program product provided by this application can solve the technical problem that for new business scenarios, conventional machine vision algorithms usually require a large amount of labeled data, while manual labeling is time-consuming and labor-intensive, and there is no basic model, so it is necessary to start from scratch, which further increases time and resource costs. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the image annotation method provided by the above embodiment, and will not be repeated here.
[0138] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. An image annotation method, characterized in that: The image annotation method comprises: Inputting the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity, and recording the position coordinates of the foreground entity in the initial image data; Selecting a first specified number of first category samples from the foreground entities; Transmitting the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity; The remaining entity images in the foreground entity are labeled according to the first category samples and the feature matrix through a content labeling algorithm, and the position coordinates are associated to obtain a target detection labeling result.
2. The image annotation method according to claim 1, characterized in that: The step of annotating the remaining entity images in the foreground entity by a content annotation algorithm according to the first category samples and the feature matrix, and associating the position coordinates to obtain the target detection annotation result includes: Constructing a content scoring matrix based on the first category samples and the feature matrix; Determine the score vectors of the remaining entity images in the foreground entity based on the content score matrix, and calculate the similarity between the score vector and the score matrix; Determine the category of the entity image according to the similarity, and mark the category on the corresponding entity image to obtain an initial marking result; The initial annotation result is associated with the initial image data based on the position coordinates to obtain a target detection annotation result.
3. The image annotation method according to claim 2, characterized in that: The step of determining the category of the entity image according to the similarity, and marking the category on the corresponding entity image to obtain an initial marking result includes: Sorting the similarities, and counting the number of image categories corresponding to the top N first category samples with the highest similarities according to the sorting results, where N is a preset similarity threshold, which can be adjusted according to historical annotation data; When the number of the image categories exceeds the preset number of categories, the image category is used as the category of the entity picture and annotated to obtain an initial annotation result.
4. The image annotation method according to claim 1, characterized in that: After the step of inputting the initial image data to be annotated into a preset image processing model for segmentation to obtain a foreground entity and recording the position coordinates of the foreground entity in the initial image data, the method further includes: Selecting a second specified number of second category samples from the foreground entities; Labeling the second category samples according to the attributes of the second category samples, and constructing an attribute scoring matrix according to the labeling results; Calculating an attribute similarity matrix of the foreground entity based on the attribute scoring matrix; The unlabeled attributes in the foreground entity are labeled according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result.
5. The image annotation method according to claim 4, characterized in that: The step of labeling the unlabeled attributes in the foreground entity according to the collaborative filtering algorithm and the attribute similarity matrix to obtain a multi-attribute labeling result includes: Determine an attribute vector of an unlabeled attribute in the foreground entity in the attribute similarity matrix according to a collaborative filtering algorithm, wherein the attribute vector represents a similarity relationship between the unlabeled attribute and the labeled attribute; Selecting the first M labeled attributes with the highest similarity to the unlabeled attribute according to the attribute vector, and obtaining the label values corresponding to the labeled attributes in the attribute scoring matrix; The unlabeled attributes are labeled based on the labeled values to obtain a multi-attribute labeling result.
6. The image annotation method according to claim 5, characterized in that: The step of labeling the unlabeled attributes based on the label values to obtain a multi-attribute labeling result includes: The attribute vector is set as a weight, and a weighted average calculation is performed on the annotation value to obtain a target annotation value; The unlabeled attributes are labeled based on the target labeling value to obtain a multi-attribute labeling result.
7. An image annotation device, characterized in that: The device comprises: An image segmentation module, used for inputting the initial image data to be annotated into a preset image processing model for segmentation, obtaining a foreground entity, and recording the position coordinates of the foreground entity in the initial image data; A sample selection module, configured to select a first specified number of first category samples from the foreground entity according to the category of the foreground entity; A feature extraction module, used to transmit the foreground entity to a preset target deep learning model to obtain a feature matrix of the foreground entity; The target labeling module is used to label the remaining entity images in the foreground entity according to the first category samples and the feature matrix through a content labeling algorithm, and associate the position coordinates to obtain a target detection labeling result.
8. An image annotation device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the image annotation method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the image annotation method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the image annotation method according to any one of claims 1 to 6 are implemented.