Data annotation method and related device

By extracting defective data and calculating similarity of the labeled data, determining the data type and labeling, the problem of limited number of labelers and large amount of data is solved, improving data labeling efficiency and reducing resource consumption.

CN119862427APending Publication Date: 2025-04-22SUZHOU MEGAROBO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411890900.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

With the limited number of labelers and the increasing number of data and data types, how to improve data labeling efficiency has become a technical problem that needs to be solved urgently.

Method used

By extracting defect data to the labeled data, calculate the similarity between the defect data and the labeled data in the defect search library, determine the type of defect data, and label the labeled data based on this type.

Benefits of technology

This method can effectively improve data labeling efficiency, save resource consumption, reduce dependence on computing power, and reduce dependence on professional knowledge personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862427A_ABST
    Figure CN119862427A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data annotation method and a related device, and the method comprises the steps: carrying out the defect data extraction of to-be-annotated data, and obtaining the defect data in the to-be-annotated data; determining the type of the defect data according to the similarity between the defect data and labeled data in a defect retrieval library; the labeling data in the defect retrieval library is labeling type defect data; and based on the type of the defect data, labeling the to-be-labeled data to obtain labeled data. In the embodiment of the invention, even if the defect data extracted from the to-be-labeled data is different from the labeled defect data, the type of the defect data can be determined based on the similarity between the defect data and the labeled data in the defect retrieval library, so that the data labeling efficiency can be effectively improved, the resource consumption can be reduced, and the dependence on the computing power can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data annotation method and related devices. Background Art

[0002] Supervised learning refers to a deep learning method that uses labeled data of known types to train a model so that the model can classify or predict data of unknown types. In supervised learning, labeled data has an important impact on model performance.

[0003] Currently, labelers can label data based on their professional knowledge to obtain labeled data. However, with the advent of the big data era, the amount and type of data are increasing, which puts higher requirements on the professionalism of labelers.

[0004] Given that the number of labelers is limited while the amount and type of data are constantly increasing, how to improve data labeling efficiency has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] Based on the above problems, the present application provides a data labeling method and related devices.

[0006] The embodiments of the present application disclose the following technical solutions:

[0007] In the first aspect, the present application provides a data labeling method, including:

[0008] Extract defect data from the data to be annotated to obtain defect data in the data to be annotated;

[0009] Determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; the annotated data in the defect retrieval library is defect data of the annotated type;

[0010] Based on the type of the defect data, the data to be labeled is labeled to obtain labeled data.

[0011] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0012] Calculating the distance between the defect data and the annotated data in the defect retrieval library;

[0013] Sorting the annotated data in the defect retrieval library in ascending order of distance to obtain a sorted defect retrieval library;

[0014] The type of the defect data is determined according to the types of the first K labeled data in the sorted defect retrieval library; wherein K is a positive integer.

[0015] In a possible implementation, determining the type of the defect data according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0016] Determine the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library;

[0017] Filtering the K labeled data based on the distance thresholds corresponding to the types to obtain filtered labeled data;

[0018] The type of the defect data is determined according to the type of the filtered annotation data.

[0019] In a possible implementation, determining the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0020] For each type of the first K labeled data, calculate the distance between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0021] Determine the maximum value of the distances between the labeled data corresponding to the type and the cluster center as the first distance of the type;

[0022] Based on the proportion of the first type of labeled data in the K labeled data, the first distance of each type is adjusted to determine the distance threshold corresponding to each type; the first type of labeled data is the labeled data with the largest proportion in the K labeled data.

[0023] In a possible implementation, adjusting the first distance of each type based on the proportion of the first type of labeled data in the K labeled data to determine the distance threshold corresponding to each type includes:

[0024] Determining an adjustment coefficient based on a proportion of the first type of annotated data in the K annotated data;

[0025] The product of the adjustment coefficient and the first distance of each type is determined as the distance threshold corresponding to each type.

[0026] In a possible implementation, determining the type of the defect data according to the type of the filtered annotation data includes:

[0027] Determining the type of the filtered labeled data as a candidate type;

[0028] According to the second distances corresponding to the types of the K labeled data, determining the candidate type with the largest proportion among the candidate types; the second distance corresponding to the type is the average value of the sum of distances between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0029] The candidate type with the largest proportion is determined as the type of the defect data.

[0030] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0031] Encoding the defect data to obtain a feature vector of the defect data;

[0032] The type of the defect data is determined according to the similarity between the feature vector of the defect data and the feature vector of the annotation data in the defect retrieval library; the feature vector of the annotation data is obtained by encoding the annotation data.

[0033] Second aspect: The embodiment of the present application provides a data labeling device, including:

[0034] Extraction unit, determination unit, and labeling unit;

[0035] The extraction unit is used to extract defect data from the data to be annotated, and obtain defect data from the data to be annotated;

[0036] The determining unit is used to determine the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; the annotated data in the defect retrieval library is defect data of the annotated type;

[0037] The labeling unit is used to label the data to be labeled based on the type of the defect data to obtain labeled data.

[0038] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0039] Calculating the distance between the defect data and the annotated data in the defect retrieval library;

[0040] Sorting the annotated data in the defect retrieval library in ascending order of distance to obtain a sorted defect retrieval library;

[0041] The type of the defect data is determined according to the types of the first K labeled data in the sorted defect retrieval library; wherein K is a positive integer.

[0042] In a possible implementation, determining the type of the defect data according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0043] Determine the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library;

[0044] Filtering the K labeled data based on the distance thresholds corresponding to the types to obtain filtered labeled data;

[0045] The type of the defect data is determined according to the type of the filtered annotation data.

[0046] In a possible implementation, determining the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0047] For each type of the first K labeled data, calculate the distance between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0048] Determine the maximum value of the distances between the labeled data corresponding to the type and the cluster center as the first distance of the type;

[0049] Based on the proportion of the first type of labeled data in the K labeled data, the first distance of each type is adjusted to determine the distance threshold corresponding to each type; the first type of labeled data is the labeled data with the largest proportion in the K labeled data.

[0050] In a possible implementation, adjusting the first distance of each type based on the proportion of the first type of labeled data in the K labeled data to determine the distance threshold corresponding to each type includes:

[0051] Determining an adjustment coefficient based on a proportion of the first type of annotated data in the K annotated data;

[0052] The product of the adjustment coefficient and the first distance of each type is determined as the distance threshold corresponding to each type.

[0053] In a possible implementation, determining the type of the defect data according to the type of the filtered annotation data includes:

[0054] Determining the type of the filtered labeled data as a candidate type;

[0055] According to the second distances corresponding to the types of the K labeled data, determining the candidate type with the largest proportion among the candidate types; the second distance corresponding to the type is the average value of the sum of distances between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0056] The candidate type with the largest proportion is determined as the type of the defect data.

[0057] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0058] Encoding the defect data to obtain a feature vector of the defect data;

[0059] The type of the defect data is determined according to the similarity between the feature vector of the defect data and the feature vector of the annotation data in the defect retrieval library; the feature vector of the annotation data is obtained by encoding the annotation data.

[0060] In a possible implementation manner, encoding the defect data to obtain a feature vector of the defect data includes:

[0061] According to the dimension of the feature vector of the annotated data in the defect retrieval library, the defect data is feature encoded to obtain the feature vector of the defect data, and the dimension of the feature vector of the defect data is the same as the dimension of the feature vector of the annotated data.

[0062] A third aspect: An embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory;

[0063] The memory is used to store program code and transmit the program code to the processor;

[0064] The processor is used to execute the steps of a data labeling method as described above according to the instructions in the program code.

[0065] Aspect 4: An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a data labeling method as described above are implemented.

[0066] Compared with the prior art, this application has the following beneficial effects:

[0067] The embodiment of the present application provides a data annotation method and related devices, which extracts defect data from the data to be annotated to obtain defect data in the data to be annotated; determines the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; the annotated data in the defect retrieval library is defect data of annotated type; annotates the data to be annotated based on the type of the defect data to obtain the annotated data. In the embodiment of the present application, even if the defect data extracted from the data to be annotated is different from the annotated defect data, the type of the defect data can be determined based on the similarity between the defect data and the annotated data in the defect retrieval library, which can effectively improve the efficiency of data annotation, save resource consumption, and reduce the dependence on computing power. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] 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, 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 creative labor.

[0069] Figure 1 A flowchart of a data labeling method provided in an embodiment of the present application;

[0070] Figure 2 A schematic diagram of a data labeling method provided in an embodiment of the present application;

[0071] Figure 3 A structural schematic diagram of a data labeling device is provided for an embodiment of the present application. DETAILED DESCRIPTION

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

[0073] In the model training process based on supervised learning, the model can adjust the model parameters according to the labeled data and its corresponding type, so that the trained model can classify or predict data of unknown types.

[0074] The efficiency of classifying or predicting data based on models is affected by the efficiency of data annotation. Currently, annotators can annotate data based on their own professional knowledge to obtain annotated data. However, with the advent of the big data era, the amount of data and the type of data are increasing, and data annotation has ushered in new challenges.

[0075] First, professional knowledge and experience require a certain amount of time to accumulate and are difficult to master in a short period of time; second, it is difficult for relevant technical personnel with professional knowledge background to have a lot of time to engage in labeling work, resulting in a small number of labelers. With a limited number of labelers and an increasing amount of data and data types, data labeling efficiency is low.

[0076] To improve the efficiency of data labeling, labelers can currently manually label small batches of data to obtain labeled data, and then train a deep learning model for data labeling based on the labeled data. Based on the deep learning model, the remaining large batches of unlabeled data can be predicted and classified, and then tested by relevant technical personnel to complete the labeling of all data.

[0077] However, this method relies on a deep learning model to label unlabeled data, and the deep learning model is trained based on a small batch of labeled data, and can only label data types that have appeared in the small batch of labeled data. If a new type of data appears, the labeler needs to label the new type of data to obtain newly labeled data, and retrain the model based on the newly labeled data to use the new deep learning model to label the data again. This series of steps leads to reduced data labeling efficiency.

[0078] Based on this, an embodiment of the present application provides a data labeling method, which extracts defect data from the data to be labeled to obtain defect data in the data to be labeled; performs feature encoding on the defect data to obtain a feature vector of the defect data; determines the type of the defect data based on the similarity between the feature vector of the defect data and the feature vector in a defect retrieval library; labels the data to be labeled based on the type of the defect data to obtain labeled data. Among them, the feature vector in the defect retrieval library is obtained by feature encoding the labeled defect data. In the embodiment of the present application, even if the defect data extracted from the data to be labeled is different from the labeled defect data, the type of the defect data can be determined based on the similarity between the feature vector of the defect data and the feature vector in the defect retrieval library. In this process, no model training process is involved, which can effectively improve the efficiency of data labeling.

[0079] The following is an introduction to a data labeling method provided in an embodiment of the present application.

[0080] like Figure 1As shown, the figure is a flow chart of a data labeling method provided in an embodiment of the present application, including S101-S103.

[0081] S101 , extract defect data from the data to be labeled to obtain defect data in the data to be labeled.

[0082] The data to be annotated may be an image, and the defect data may include but is not limited to the corresponding defect contour in the image.

[0083] For example, since there may be some defects on the surface or inside of the product, the types of defects may include but are not limited to scratches, spots, holes, color difference, indentation, inclusions, damage, stains, etc. In order to determine the type of defects in the product, the product can be photographed to obtain an image of the product, and the image of the product is used as the data to be annotated. By extracting defect data from the product image, data such as the defect outline in the product image can be extracted, so that the defect outline of the product can be annotated later.

[0084] In a possible implementation, defect data extraction may be performed on the data to be annotated based on semi-automatic annotation to obtain defect data in the data to be annotated.

[0085] Among them, semi-automatic annotation is a data annotation technology that combines manual and machine annotation methods. Using the semi-automatic annotation method to extract defect data from the annotated data can effectively improve the extraction efficiency and accuracy of defect data and adapt to various types of defect data extraction needs.

[0086] S102: Determine the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library.

[0087] The annotated data in the defect retrieval library is defect data of annotated type.

[0088] Exemplarily, a labeler may label a batch of data, label the types of defect data in the data, obtain defect data of the labeled type, and build a defect retrieval library of known defect types based on the defect data of the labeled type, so as to provide a reference for determining the type of defect data of unknown defect types in the future.

[0089] In a possible implementation, after obtaining the defect data in the data to be labeled, the defect data can be encoded to obtain a feature vector of the defect data; and the type of the defect data can be determined based on the similarity between the feature vector of the defect data and the feature vector of the labeled data in the defect retrieval library.

[0090] The feature vector of the labeled data is obtained by encoding the labeled data.

[0091] Exemplarily, in an embodiment of the present application, after a labeler labels a batch of data and obtains defect data of the labeled type, the defect data of the labeled type can be encoded based on an encoder to obtain a feature vector of the labeled data.

[0092] After obtaining the defect data in the data to be annotated, the defect data can be encoded based on the encoder to obtain a feature vector of the defect data, wherein the feature vector of the defect data has the same dimension as the feature vector of the annotated data.

[0093] On this basis, the type of the defect data may be determined according to the similarity between the feature vector of the defect data and the feature vector of the annotated data in the defect retrieval library.

[0094] In a possible implementation, the above S102 may be implemented by the following steps:

[0095] Step 21: Calculate the distance between the defect data and the annotated data in the defect retrieval library.

[0096] The distance in the embodiment of the present application may include but is not limited to at least one of Euclidean distance, Manhattan distance, and Minkowski distance.

[0097] The distance between the defect data and the annotated data in the defect retrieval library may represent the similarity between the defect data and the annotated data in the defect retrieval library. For example, the smaller the distance, the higher the similarity between the defect data and the annotated data.

[0098] Step 22: sort the annotated data in the defect retrieval library in ascending order of distance to obtain a sorted defect retrieval library.

[0099] Step 23: Determine the type of the defect data according to the types of the first K labeled data in the sorted defect retrieval library, where K is a positive integer.

[0100] For example, in the embodiment of the present application, the distance between the defect data and the annotated data in the defect retrieval library can be calculated based on K-Nearest Neighbors (KNN), and K annotated data closest to the defect data can be obtained, as shown in formula (1):

[0101] A={(fν1, label1, d1), (fν2, label2, d2), (fν3, label3, d3), ..., (fνk , label k ,

[0102] d k )}=TOPK(distance(fν q , fν i )) K∈V (1)

[0103] in, f q represents the feature vector from the defect data; fν i The feature vector representing the annotation data in the defect retrieval library; distance(fν q , fν i ) represents the distance between the defect data and the annotated data; A is the set of K annotated data closest to the defect data; TOPK(distance(fν q , fν i )) indicates that the K labeled data closest to the defect data are determined in the defect retrieval library; fν1, fν2, fν3, ..., fν k They represent the feature vectors of K labeled data respectively; label1, label2, label3, ..., label k They represent the types of K labeled data, d1, d2, d3, ..., d k are the distances between the K labeled data and the defect data respectively.

[0104] In a possible implementation, step 23 may be implemented through steps 311 to 313.

[0105] Step 311: Determine the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library.

[0106] In the embodiment of the present application, different types of annotation data may correspond to different distance thresholds.

[0107] For each type of the first K labeled data types, the distance between the labeled data corresponding to the type in the defect retrieval library and the cluster center is calculated.

[0108] The cluster center corresponding to this type can be expressed as follows based on formula (2):

[0109]

[0110] In formula (2), μ k is the cluster center; N k Indicates the number of annotation data of this type in the defect retrieval library; x iThe feature vector representing this type of annotation data in the defect retrieval library.

[0111] The distance between each labeled data of this type and the cluster center can be expressed by formula (3) as follows:

[0112]

[0113] Among them, d(x i , μ k ) represents x i With μ k The distance between i1 , x i2 , ..., x id For x i The values ​​of each dimension; μ k1 , μ k2 , ..., μ k1 μ k The values ​​of each dimension.

[0114] Based on formula (2)-formula (3), the distance between the labeled data corresponding to each type and the cluster center can be determined. For each type, the maximum value of the distance between the labeled data corresponding to the type and the cluster center can be determined as the first distance of the type.

[0115] Exemplarily, the first distance (d max ) can be expressed by formula (4) as follows:

[0116] d max =max(d(x i , μ k )) (4)

[0117] After determining the first distance of each type, the first distance of each type can be adjusted based on the proportion of the first type of labeled data in the K labeled data to determine the distance threshold corresponding to each type. The first type of labeled data is the labeled data with the largest proportion in the K labeled data.

[0118] In a possible implementation, the adjustment coefficient may be determined based on the proportion of the first type of annotated data in the K annotated data, and the product of the adjustment coefficient and the first distance of each type may be determined as the distance threshold corresponding to each type.

[0119] Exemplarily, K labeled data are stored in the candidate list (A) corresponding to the defect data. The proportion of the labeled data with the largest proportion among the K labeled data can be expressed as follows by formula (5):

[0120] Purity=max_count(A) / len(A) (5)

[0121] Among them, Purity represents the proportion of the largest number of labeled data among the K labeled data, which can also be called the purity of the maximum category; max_count(A) represents the number of labeled data with the largest proportion in A; len(A) represents the number of all labeled data in A.

[0122] In the embodiment of the present application, after determining the proportion of the first type of annotated data in the K annotated data, the adjustment coefficient may be determined based on the proportion.

[0123] Exemplarily, if the purity of the largest category is greater than a first threshold, the initial adjustment coefficient is increased by a first value; if the purity of the largest category is greater than or equal to a second threshold and less than or equal to the first threshold, the initial adjustment coefficient is increased by a second value; if the purity of the largest category is greater than a third threshold and less than the second threshold, the initial adjustment coefficient is increased by a third value.

[0124] The first amplitude is greater than the second amplitude, and the second amplitude is greater than the third amplitude.

[0125] It can be understood that in the embodiments of the present application, there is no specific limitation on the sizes of the initial adjustment coefficient, the first threshold, the second threshold, the third threshold, the first amplitude, the second amplitude, and the third amplitude, and they can all be set according to actual needs.

[0126] Exemplarily, when the initial adjustment coefficient is 1, the first threshold is 0.99, the first amplitude is 0.27, the second threshold is 0.79, the second amplitude is 0.2, the third threshold is 0.59, and the third amplitude is 0.1, if Purity is greater than 0.99, the adjustment coefficient is adjusted from 1 to 1.27; if Purity is greater than or equal to 0.79 and less than or equal to 0.99, the adjustment coefficient is adjusted from 1 to 1.2; if Purity is greater than 0.59 and less than 0.79, the adjustment coefficient is adjusted from 1 to 1.1.

[0127] After determining the adjustment coefficient corresponding to each type, the distance threshold corresponding to each type can be determined based on the adjustment coefficient, as shown in formula (6):

[0128] d max_thresh =dist_factor×d max (6)

[0129] Among them, d max_thresh represents the distance threshold corresponding to each type; and dist_factor represents the adjustment coefficient corresponding to each type. After determining the distance threshold corresponding to each type, step 312 may be performed.

[0130] Step 312: Filter the K labeled data based on the distance thresholds corresponding to the types to obtain filtered labeled data.

[0131] In a possible implementation, when the distance between the labeled data among the K labeled data and the defect data is less than a distance threshold corresponding to the type of the labeled data, the labeled data is determined as filtered labeled data; otherwise, the type of the labeled data is directly filtered.

[0132] Step 313: Determine the type of the defect data according to the type of the filtered annotation data.

[0133] In the embodiment of the present application, the type of the filtered annotation data can be determined as a candidate type.

[0134] Exemplarily, when the distance between the labeled data and the defect data is less than a distance threshold corresponding to the type of the labeled data, the type of the labeled data may be added to a type list, which may be represented as filtered_labels and used to store candidate types corresponding to the defect data.

[0135] After determining the candidate types, the candidate type with the largest proportion among the candidate types may be determined according to the second distances corresponding to the types of the K labeled data, and the candidate type with the largest proportion may be determined as the type of the defect data.

[0136] The second distance corresponding to the type is the average value of the sum of distances between the labeled data corresponding to the type in the defect retrieval library and the cluster center, as shown in formula (7).

[0137]

[0138] Among them, d mean Indicates the second distance corresponding to each type, based on which it can be determined whether each candidate type meets the preset condition.

[0139] In a possible implementation, the number of the largest number of types among the candidate types can be calculated based on formula (8).

[0140] comlabel=max_count(filtered_labels) (8)

[0141] Among them, comlabel represents the number of the largest type among the candidate types.

[0142] After calculating the number of the largest types among the candidate types, the largest type among the candidate types can be determined. On this basis, it can be determined whether the type meets the preset condition based on the second distance. If it is determined that the type meets the preset condition, the category with the most data among the current candidate types can be used as the type of the defect data.

[0143] Exemplarily, if there is at least one candidate type in filtered_labels, and the distance threshold of the first candidate type is less than the second distance, it means that the two are close enough, and the first candidate type is determined as the type of the defective data; if there are at least two candidate types in filtered_labels, and the first two candidate types are the same, then the candidate type is determined as the type of the defective data; if the above situation is not met, the category with the most data in the current candidate type is determined as the type of the defective data.

[0144] S103: label the data to be labeled based on the type of the defect data to obtain labeled data.

[0145] In summary, the method provided by the embodiment of the present application can determine the type of defect data based on the similarity between the defect data and the labeled data in the defect retrieval library, even if the defect data extracted from the data to be labeled is different from the labeled defect data. It has strong applicability and can be applied to data labeling processes of various types and industries. At the same time, the labeling process does not involve the model training process, which can effectively improve the efficiency of data labeling, save resource consumption, and reduce the dependence on computing power.

[0146] At the same time, the method provided in the embodiment of the present application reduces the reliance on personnel with professional knowledge in the process of labeling defect data, and can improve the efficiency of data labeling.

[0147] For ease of understanding, the following Figure 2 An overall introduction to the data labeling method provided in the embodiments of the present application is given.

[0148] like Figure 2 As shown, this figure is a schematic diagram of a data annotation method provided in an embodiment of the present application. The data annotation method provided in an embodiment of the present application can be divided into two stages, namely, a defect retrieval library construction stage and a data annotation stage for annotation.

[0149] In the defect retrieval library construction phase, a labeler labels a batch of data, labels the types of defect data in the data, and obtains defect data of the labeled type, i.e., labeled data. The labeled data is encoded with defect features based on the encoder to obtain a feature vector of the labeled data with the same dimension.

[0150] The feature vectors of the annotated data are stored in a defect retrieval library of known defect types, so as to provide a reference for determining the type of defect data of unknown defect types in the future.

[0151] After building the defect retrieval library, we can enter the data annotation stage. For a batch of data to be annotated, we can extract the defect data in the data to be annotated based on the semi-automatic annotation method. Based on each defect data, we can encode its defect features based on the encoder to obtain the feature vector of the defect data.

[0152] Based on the defect retrieval library, a candidate type list is obtained through neighbor feature retrieval, and the type corresponding to the defect data is determined from the candidate type list.

[0153] Exemplarily, in an embodiment of the present application, the distance between the feature vector of the defect data and the feature vector of the labeled data can be calculated based on KNN or other methods to obtain K labeled data with the smallest distance to the defect data, and the K labeled data can be stored in a candidate list corresponding to the defect data.

[0154] The annotated data in the candidate list is filtered based on the distance threshold corresponding to each category to obtain the filtered annotated data, and the type of the filtered annotated data is determined as the candidate type. The type with the largest proportion is determined from the candidate types, and it is determined whether the type meets the preset conditions. If it is determined that the type meets the preset conditions, the category with the most data in the current candidate type can be used as the type of the defect data.

[0155] After the type of defective data is determined, the data to be labeled may be labeled based on the type of defective data to obtain labeled data.

[0156] This application provides a data annotation device, see Figure 3 , this figure is a structural schematic diagram of a data labeling device provided in an embodiment of the present application. Its specific implementation method is consistent with the implementation method and the technical effect achieved in the embodiment of the above method, and some contents will not be repeated here.

[0157] A data labeling device 1100, comprising:

[0158] Extraction unit 1101, determination unit 1102, and labeling unit 1103;

[0159] The extraction unit 1101 is used to extract defect data from the data to be annotated, and obtain defect data from the data to be annotated;

[0160] The determining unit 1102 is used to determine the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; the annotated data in the defect retrieval library is defect data of annotated type;

[0161] The labeling unit 1103 is used to label the data to be labeled based on the type of the defect data to obtain labeled data.

[0162] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0163] Calculating the distance between the defect data and the annotated data in the defect retrieval library;

[0164] Sorting the annotated data in the defect retrieval library in ascending order of distance to obtain a sorted defect retrieval library;

[0165] The type of the defect data is determined according to the types of the first K labeled data in the sorted defect retrieval library; wherein K is a positive integer.

[0166] In a possible implementation, determining the type of the defect data according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0167] Determine the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library;

[0168] Filtering the K labeled data based on the distance thresholds corresponding to the types to obtain filtered labeled data;

[0169] The type of the defect data is determined according to the type of the filtered annotation data.

[0170] In a possible implementation, determining the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library includes:

[0171] For each type of the first K labeled data, calculate the distance between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0172] Determine the maximum value of the distances between the labeled data corresponding to the type and the cluster center as the first distance of the type;

[0173] Based on the proportion of the first type of labeled data in the K labeled data, the first distance of each type is adjusted to determine the distance threshold corresponding to each type; the first type of labeled data is the labeled data with the largest proportion in the K labeled data.

[0174] In a possible implementation, adjusting the first distance of each type based on the proportion of the first type of labeled data in the K labeled data to determine the distance threshold corresponding to each type includes:

[0175] Determining an adjustment coefficient based on a proportion of the first type of annotated data in the K annotated data;

[0176] The product of the adjustment coefficient and the first distance of each type is determined as the distance threshold corresponding to each type.

[0177] In a possible implementation, determining the type of the defect data according to the type of the filtered annotation data includes:

[0178] Determining the type of the filtered labeled data as a candidate type;

[0179] According to the second distances corresponding to the types of the K labeled data, determining the candidate type with the largest proportion among the candidate types; the second distance corresponding to the type is the average value of the sum of distances between the labeled data corresponding to the type in the defect retrieval library and the cluster center;

[0180] The candidate type with the largest proportion is determined as the type of the defect data.

[0181] In a possible implementation, determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes:

[0182] Encoding the defect data to obtain a feature vector of the defect data;

[0183] The type of the defect data is determined according to the similarity between the feature vector of the defect data and the feature vector of the annotation data in the defect retrieval library; the feature vector of the annotation data is obtained by encoding the annotation data.

[0184] In a possible implementation manner, encoding the defect data to obtain a feature vector of the defect data includes:

[0185] According to the dimension of the feature vector of the annotated data in the defect retrieval library, the defect data is feature encoded to obtain the feature vector of the defect data, and the dimension of the feature vector of the defect data is the same as the dimension of the feature vector of the annotated data.

[0186] In summary, the device provided by the embodiment of the present application can determine the type of defect data based on the similarity between the defect data and the labeled data in the defect retrieval library, even if the defect data extracted from the data to be labeled is different from the labeled defect data. It has strong applicability and can be applied to data labeling processes of various types and industries. At the same time, the labeling process does not involve the model training process, which can effectively improve the efficiency of data labeling, save resource consumption, and reduce the dependence on computing power.

[0187] At the same time, the method provided in the embodiment of the present application reduces the reliance on personnel with professional knowledge in the process of labeling defect data, and can improve the efficiency of data labeling.

[0188] An embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory;

[0189] The memory is used to store program code and transmit the program code to the processor;

[0190] The processor is used to execute the steps of a data labeling method as described above according to the instructions in the program code.

[0191] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a data labeling method as described above are implemented.

[0192] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application 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.

Claims

1. A data labeling method, characterized in that: include: Extract defect data from the data to be annotated to obtain defect data in the data to be annotated; Determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; the annotated data in the defect retrieval library is defect data of the annotated type; Based on the type of the defect data, the data to be labeled is labeled to obtain labeled data.

2. The method according to claim 1, characterized in that: The determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes: Calculating the distance between the defect data and the annotated data in the defect retrieval library; Sorting the annotated data in the defect retrieval library in ascending order of distance to obtain a sorted defect retrieval library; The type of the defect data is determined according to the types of the first K labeled data in the sorted defect retrieval library; wherein K is a positive integer.

3. The method according to claim 2, characterized in that Determining the type of the defect data according to the types of the first K labeled data in the sorted defect retrieval library includes: Determine the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library; Filtering the K labeled data based on the distance thresholds corresponding to the types to obtain filtered labeled data; The type of the defect data is determined according to the type of the filtered annotation data.

4. The method according to claim 3, characterized in that Determining the distance threshold corresponding to each type according to the types of the first K labeled data in the sorted defect retrieval library includes: For each type of the first K labeled data, calculate the distance between the labeled data corresponding to the type in the defect retrieval library and the cluster center; Determine the maximum value of the distances between the labeled data corresponding to the type and the cluster center as the first distance of the type; Based on the proportion of the first type of labeled data in the K labeled data, the first distance of each type is adjusted to determine the distance threshold corresponding to each type; the first type of labeled data is the labeled data with the largest proportion in the K labeled data.

5. The method according to claim 4, characterized in that The first distance of each type is adjusted based on the proportion of the first type of labeled data in the K labeled data to determine the distance threshold corresponding to each type, including: Determining an adjustment coefficient based on a proportion of the first type of annotated data in the K annotated data; The product of the adjustment coefficient and the first distance of each type is determined as the distance threshold corresponding to each type.

6. The method according to claim 3, characterized in that The step of determining the type of the defect data according to the type of the filtered annotation data includes: Determining the type of the filtered labeled data as a candidate type; According to the second distances corresponding to the types of the K labeled data, determining the candidate type with the largest proportion among the candidate types; the second distance corresponding to the type is the average value of the sum of distances between the labeled data corresponding to the type in the defect retrieval library and the cluster center; The candidate type with the largest proportion is determined as the type of the defect data.

7. The method according to claim 1, characterized in that The determining the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library includes: Encoding the defect data to obtain a feature vector of the defect data; The type of the defect data is determined according to the similarity between the feature vector of the defect data and the feature vector of the annotation data in the defect retrieval library; the feature vector of the annotation data is obtained by encoding the annotation data.

8. A data labeling device, characterized in that: include: Extraction unit, determination unit, and labeling unit; The extraction unit is used to extract defect data from the data to be annotated, and obtain defect data from the data to be annotated; The determining unit is used to determine the type of the defect data according to the similarity between the defect data and the annotated data in the defect retrieval library; The annotated data in the defect retrieval library is defect data of annotated type; The labeling unit is used to label the data to be labeled based on the type of the defect data to obtain labeled data.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the steps of a data labeling method as described in any one of claims 1-7 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a data labeling method according to any one of claims 1 to 7 are implemented.