Intelligent labeling method, model training and measurement method, device, equipment and medium
By generating and adjusting the initial labels for the image measuring instrument using an edge detection model, the problem of low labeling efficiency in the training of the image measuring instrument AI model is solved, and the rapid generation and improved accuracy of labels are achieved.
Patent Information
- Application Number
- CN202511527789.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2045-10-24
AI Technical Summary
Traditional image measurement instruments have low efficiency in labeling sample images during AI model training, requiring a large amount of manual operation.
An edge detection model is used to detect edges in the image to be identified, generating initial labels. The initial labels are then adjusted based on the actual edge conditions of the image to obtain the target labels.
It enables rapid label generation and improves label accuracy, reduces repetitive manual labeling work, and improves labeling efficiency and label accuracy.
Smart Images

Figure CN120997621B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to an intelligent labeling method, a model training method and a measuring method, device, computer equipment, computer readable storage medium and computer program product. BACKGROUND
[0002] An image measuring device (such as an image measuring instrument or a flash measuring instrument) can realize precise measurement of surface size, contour, angle, position and geometric tolerance of various complex parts. In actual application, the geometric features (such as planes, lines and points) of a workpiece can be extracted by the image measuring instrument, the length or angle information of the geometric features is calculated, and then it can be judged whether the machining precision of the workpiece meets the requirements. With the rapid development of artificial intelligence technology, image measurement can be carried out based on an artificial intelligence (AI) model. However, when training the AI model in the image measuring instrument, a large number of sample images are often required, and each sample image needs to be labeled.
[0003] In the traditional technology, when labeling the sample images, it is often drawn one by one by manual work, which requires a lot of repetitive labor, and the efficiency of label generation is low. SUMMARY
[0004] Therefore, it is necessary to provide an intelligent labeling method, device, computer equipment, computer readable storage medium and computer program product capable of improving the efficiency of label generation.
[0005] In a first aspect, the present application provides an intelligent labeling method, comprising:
[0006] performing edge detection on the to-be-recognized image based on an edge detection model to obtain an edge detection result;
[0007] generating an initial label of the to-be-recognized image according to the edge detection result;
[0008] adjusting the initial label according to the real edge condition of the to-be-recognized image to obtain a target label of the to-be-recognized image.
[0009] In a second aspect, the present application further provides an intelligent labeling device, comprising:
[0010] an edge detection module, configured to perform edge detection on a to-be-recognized image based on an edge detection model to obtain an edge detection result;
[0011] a label generation module, configured to generate an initial label of the to-be-recognized image according to the edge detection result;
[0012] a label adjustment module configured to adjust the initial label according to a real edge condition of the image to be recognized, to obtain a target label of the image to be recognized.
[0013] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the intelligent labeling method according to the first aspect when executing the computer program.
[0014] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the intelligent labeling method according to the first aspect when executed by a processor.
[0015] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and the computer program implements the steps of the intelligent labeling method according to the first aspect when executed by a processor.
[0016] In a sixth aspect, the present application provides a model training method, comprising:
[0017] obtaining a sample image with a label generated according to the intelligent labeling method;
[0018] training an initial detection model based on the sample image and the label of the sample image until a training condition is reached, to obtain a target detection model for edge detection.
[0019] In a seventh aspect, the present application provides a model training device, comprising:
[0020] a sample image obtaining module configured to obtain a sample image with a label generated according to the intelligent labeling method;
[0021] a model training module configured to train an initial detection model based on the sample image and the label of the sample image until a training condition is reached, to obtain a target detection model for edge detection.
[0022] In an eighth aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the model training method according to the sixth aspect when executing the computer program.
[0023] In a ninth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the model training method according to the sixth aspect when executed by a processor.
[0024] In a tenth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the model training method of the sixth aspect.
[0025] In an eleventh aspect, the present application provides a measurement method comprising:
[0026] obtaining a target image corresponding to a to-be-measured object;
[0027] performing edge detection on the target image by using a target detection model obtained based on the model training method to obtain a target edge;
[0028] determining a target size of the target edge, and determining a measurement result of the to-be-measured object based on the target size.
[0029] In a twelfth aspect, the present application provides a measurement device comprising:
[0030] an image obtaining module configured to obtain a target image corresponding to a to-be-measured object;
[0031] an edge detection module configured to perform edge detection on the target image by using a target detection model obtained based on the model training method to obtain a target edge;
[0032] a result determining module configured to determine a target size of the target edge, and determine a measurement result of the to-be-measured object based on the target size.
[0033] In a thirteenth aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the measurement method of the eleventh aspect when executing the computer program.
[0034] In a fourteenth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the measurement method of the eleventh aspect.
[0035] In a fifteenth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the measurement method of the eleventh aspect.
[0036] The intelligent labeling method, the model training method, the measuring method, the device, the computer device, the computer readable storage medium, and the computer program product can obtain an edge detection result by performing edge detection on the to-be-identified image based on an edge detection model, generate an initial label of the to-be-identified image according to the edge detection result, and adjust the initial label according to a real edge condition of the to-be-identified image to obtain a target label of the to-be-identified image. The intelligent labeling method can realize fast generation of the label and improve the label generation efficiency without manually labeling the labels of the sample images one by one. Meanwhile, the initial label generated by the model is further adjusted according to the real edge condition of the image, which can improve the accuracy of the label. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0038] Figure 1 An application environment diagram of the intelligent labeling method in an embodiment;
[0039] Figure 2 A flowchart of the intelligent labeling method in an embodiment;
[0040] Figure 3 An initial label generation flowchart in an embodiment;
[0041] Figure 4 A schematic diagram of different sample images of the same category in an embodiment;
[0042] Figure 5 A schematic diagram of marking points and marking lines in an embodiment;
[0043] Figure 6 A schematic diagram of different label categories on the same sample image in an embodiment;
[0044] Figure 7 A flowchart of the label generated by backstepping in an embodiment;
[0045] Figure 8 An adjusted label schematic diagram in an embodiment;
[0046] Figure 9 A structural block diagram of the intelligent labeling device in an embodiment;
[0047] Figure 10 An internal structure diagram of the computer device in an embodiment. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0049] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0050] The intelligent annotation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed in the cloud or on another network server. Server 104 acquires the image to be recognized sent by terminal 102, performs edge detection on the image based on an edge detection model, obtains the edge detection result, generates an initial label for the image to be recognized based on the edge detection result, adjusts the initial label according to the actual edge condition of the image to be recognized, and obtains the target label for the image to be recognized. Server 104 can return the target label of the image to be recognized to terminal 102. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, image measuring instruments, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, image measuring instruments, projection equipment, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. It should be noted that the intelligent annotation method provided in this application embodiment is not only applicable to the above-mentioned application scenarios involving interaction between the server and the terminal, but also to application scenarios with a single server or a single terminal.
[0051] In one exemplary embodiment, such as Figure 2As shown, a label generation method (also referred to as a smart labeling method, an automatic labeling method, etc.) is provided, which can reduce the operation of the labeling process and improve the labeling speed. The method is applied to Figure 1 The server in the method is taken as an example for illustration, including the following steps 202 to 206. Among them:
[0052] In step 202, an edge detection model is used to perform edge detection on a to-be-identified image to obtain an edge detection result.
[0053] The to-be-identified image refers to an image to be subjected to edge detection. The to-be-identified image can be a sample image to be labeled. The sample image can be obtained by photographing a sample to be measured by an image measuring device (such as an image measuring instrument or a flash measuring instrument). The sample image can be an image obtained by photographing the entire sample, or an image obtained by photographing a local area of the sample. The sample image can be an image obtained by capturing a target area of the sample, which can cover the edge to be measured by the user. In other words, the sample image can be an image obtained by capturing a local area of the sample, and the sample image includes at least a target edge feature in the local area of the sample, which corresponds to the edge (also referred to as a target edge) to be measured by the user. In an embodiment, the number of target edges in the same sample image can be one or more. The same target edge corresponds to a local edge in a theoretical drawing, which is a continuous edge and only includes one shape (such as a straight line, an arc, or a circle).
[0054] The edge detection model refers to an artificial intelligence model capable of detecting edge features. The edge detection model can be a model obtained by training, or an existing model capable of identifying edge features of an image. The edge detection result refers to the detection result of the edge feature in the to-be-identified image.
[0055] In an example, the edge detection model is obtained by training a labeled sample image. The sample image can be obtained by photographing the sample by an image measuring instrument or a flash measuring instrument. The sample image can be labeled by manual labeling or a label labeling algorithm to obtain a labeled label of the sample image. Optionally, the labeled label corresponds to a target edge, and the labeled label is a closed contour, rather than a line or a point. In some embodiments, the same labeled label includes one target edge, i.e., one-to-one correspondence. Optionally, the closed contour of the same labeled label does not cover other edges except the target edge, thereby reducing the influence of other edges on the identification of the target edge, especially when used to train a target detection model, which can effectively improve the identification accuracy of the target edge feature of the trained target detection model.
[0056] For example, a suitable label drawing style (such as a line, an arc, a circle, or a curve, etc.) can be selected by a person through a drawing interface in the training software to draw a mark line on the target edge of the sample image to form a label, and a region with a preset width is formed around the mark line, and the border of the region is the annotation label of the sample image. The preset width can be set according to the actual application scenario. Alternatively, the sample image can also be annotated by automatic annotation. For example, the target edge in the sample image is detected by an edge detection algorithm, and the detected target edge is annotated in the form of a mark point. The mark points are connected to form a mark line, and a region with a preset width is formed around the mark line, and the border of the region is the annotation label of the sample image. The target edge can be a partial edge, that is, a part of a complete edge. After obtaining the annotation label of the sample image, the sample image including the annotation label can be input into an initial detection model to obtain a predicted edge feature predicted by the initial detection model. The parameters of the initial detection model are adjusted according to the difference between the predicted edge feature and the target edge feature corresponding to the annotation label, until the difference between the predicted edge feature and the target edge feature is less than a difference threshold, and an edge detection model is obtained. The initial detection model is used to represent a model that has not been trained. The edge detection model is used to represent a model that has been trained. The initial detection model can be, for example, a convolutional neural network architecture for edge detection, such as U-Net, FCN, Mask R-CNN, or a generative adversarial network (GAN).
[0057] In some actual application scenarios, a small amount of sample images can be annotated by a person or a label annotation algorithm to obtain sample images including annotation labels, and then the initial detection model is trained by using the small amount of sample images to obtain an edge detection model. The small amount means that the number of sample images is less than a threshold, and the threshold can represent the number of sample images required for model training under normal circumstances. For example, 10 sample images can be annotated, and the initial detection model can be trained by using the 10 annotated sample images to obtain an edge detection model. Based on this, an initial edge detection model that can identify the target edge in the sample image can be obtained, which can quickly identify the to-be-annotated image to generate an initial label, and then the target label can be obtained by adjusting the initial label. Compared with starting from zero to annotate the label, the annotation efficiency can be greatly improved.
[0058] In step 204, an initial label of the to-be-identified image is generated according to the edge detection result.
[0059] The initial label refers to a label generated based on the edge detection result. The edge detection result can be marked in the form of a marker point, a marker line is formed according to the fitting of the marker point, and the initial label is generated according to the marker line.
[0060] It should be noted that the label involved in the embodiments of the present application is used to represent the target edge feature in the image, the label is a closed contour, not just a line or a point, and the label corresponds to a region including the target edge feature. In other words, the label can be regarded as a closed contour capable of selecting the region where the target edge feature in the image is located. The target edge corresponding to the target edge feature is usually an edge that needs to be measured by a user. The target edge feature can be a local edge feature.
[0061] In step 206, the initial label is adjusted according to the actual edge situation of the to-be-recognized image to obtain a target label of the to-be-recognized image.
[0062] The actual edge situation refers to the actual edge feature. The initial label is adjusted based on the actual edge feature of the to-be-recognized image, so that a target label that is more consistent with the actual edge feature can be obtained. The initial label can be adjusted according to the actual edge situation of the to-be-recognized image by manual or device to obtain the target label of the to-be-recognized image.
[0063] For example, the marker points in the initial label can be adjusted according to the actual edge situation of the to-be-recognized image, so that the similarity between the label and the actual edge situation of the to-be-recognized image is greater than or equal to a threshold, and the target label of the to-be-recognized image is obtained.
[0064] In the above label generation method, the edge detection model is used to detect the edge of the to-be-recognized image to obtain an edge detection result, the initial label of the to-be-recognized image is generated according to the edge detection result, and the initial label is adjusted according to the actual edge situation of the to-be-recognized image to obtain the target label of the to-be-recognized image. Without manually labeling the labels of sample images one by one, the label can be quickly generated, and the label generation efficiency is improved. At the same time, since the initial label generated by the model is further adjusted according to the actual edge situation of the image, the accuracy of the label can be improved.
[0065] In some embodiments, the initial label of the to-be-recognized image is generated according to the edge detection result in step 204, including:
[0066] The target marker point is determined according to the edge detection result; the target marker line is obtained by fitting the target marker point; and the initial label of the to-be-recognized image is generated based on the target marker line and a preset label width.
[0067] The edge detection result detected based on the edge detection model can be marked by a marker point. The target marker point can be an edge feature point corresponding to the edge detection result. The number of target marker points is at least 2, for example, 4, 8, 10 or more, and the number of target marker points can be set according to the actual application scenario. The target marker line is fitted by the target marker point, and the target marker line can be a straight line or a curve. The shape of the target marker line is determined according to the edge feature corresponding to the edge detection result. The preset label width can be set according to the actual application scenario.
[0068] In some application scenarios, the edge detection result detected by the edge detection model can be presented in the form of a contour line. If the label generation function is selected to be turned on, a marker point is generated according to the contour line, that is, after the label generation function is turned on, the result presented can be a plurality of marker points generated along the contour line. Alternatively, the marker points can be generated at a preset interval. These marker points can be directly used as target marker points; or a part of them can be selected as target marker points, for example, the selected marker points are as close to the target edge in the sample image as possible. It can be understood that if the number of selected target marker points is large, the similarity between the generated initial label and the real edge condition can be higher than a threshold, and then there is no need to perform label adjustment in step 206.
[0069] Exemplarily, the target marker points can be determined according to the edge detection result, two adjacent target marker points are connected by a straight line to obtain a target marker line, and an initial label of a preset label width is generated based on the target marker line. It is easy to understand that the overall shape trajectory of the initial label is the same as that of the target marker line. That is, a bounding box of the preset label width is generated around the target marker line according to the trajectory of the target marker line, and the initial label is obtained. The target marker line can be at the center position or the edge position of the initial label.
[0070] Exemplarily, the target marker points can be determined according to the edge detection result, a plurality of target marker points are fitted by a curve fitting algorithm to obtain a target marker line, and an initial label of a preset label width is generated based on the target marker line.
[0071] In this embodiment, the target marker points are determined according to the edge detection result, the target marker line is obtained by fitting the target marker points, and the initial label of the to-be-recognized image is generated based on the target marker line and the preset label width, so that the initial label that matches the edge detection result more can be generated, and the accuracy of the initial label is improved.
[0072] In some embodiments, generating the initial label of the to-be-recognized image based on the target marker line and the preset label width comprises:
[0073] A first boundary line and a second boundary line are respectively generated on two sides of the target marking line with the target marking line as the center, and a distance between the first boundary line and the second boundary line is a preset label width; and a frame of a region formed by the first boundary line and the second boundary line is taken as an initial label of the to-be-recognized image.
[0074] The first boundary line and the second boundary line on two sides of the target marking line are respectively parallel to the target marking line. Assuming that the preset label width is L, a distance between the first boundary line or the second boundary line and the target marking line can be L / 2.
[0075] Exemplarily, as shown in FIG. 3, Figure 3 a plurality of target marking points 302 are fitted to obtain a target marking line 304, a first boundary line 306 and a second boundary line 308 are respectively generated on two sides of the target marking line 304 with the target marking line 304 as the center, a distance between the first boundary line 306 and the second boundary line 308 is a preset label width, and a frame of a region formed by the first boundary line 306 and the second boundary line 308 is an initial label. It should be noted that in the embodiment of the present application, each label is only used to represent one edge feature, which can be a complete edge or a part of the complete edge. That is, one label cannot represent multiple edge features. For example, Figure 3 as shown in FIG. 4, the initial label is only used to represent an inner side edge of a “U”-shaped component in a sample image, and does not include an outer side edge.
[0076] In the embodiment, by taking the target marking line as the center, the first boundary line and the second boundary line are respectively generated on two sides of the target marking line, and a frame of a region formed by the first boundary line and the second boundary line is taken as the initial label of the to-be-recognized image, the initial label of the to-be-recognized image can be more accurately generated.
[0077] In some embodiments, the adjusting of the initial label according to the real edge situation of the to-be-recognized image in step 206 to obtain the target label of the to-be-recognized image includes:
[0078] According to the real edge situation of the to-be-recognized image, the position and / or the number of the marking points corresponding to the initial label are adjusted until a similarity between the initial label and the real edge situation of the to-be-recognized image is higher than a threshold value, and the target label of the to-be-recognized image is obtained.
[0079] It is easy to understand that the initial label generated based on the edge detection result recognized by the edge detection model can have errors, and if the initial label does not match the real edge situation of the to-be-recognized image, the initial label needs to be adjusted so that the label matches the real edge situation of the corresponding to-be-recognized image. If the similarity between the label and the real edge situation in the image reaches a threshold value, it means that the label matches the real edge feature in the corresponding image.
[0080] Exemplarily, the number of marking points of the initial label can be increased or decreased, or the position of the marking points can be moved, according to the real edge condition of the image to be identified, so that the similarity between the label and the real edge condition of the image to be identified is higher than a threshold, to obtain a target label of the image to be identified. The threshold can be set according to actual application scenarios, for example, 85%, 90% or 99%, and the like. It is easy to understand that after the position of the marking points or the number of the marking points is adjusted, that is, the marking points are changed, the marking line is also changed, and the label is changed along with the marking line according to the predetermined rule, so as to realize the adjustment of the label based on the marking points.
[0081] In actual application scenarios, all marking points of the initial label can be moved as a whole to cover the real edge feature according to the real edge condition of the image to be identified, and then the number of the marking points can be increased or decreased, so that the similarity between the label and the real edge feature is higher than a threshold, to obtain a target label.
[0082] In the embodiment, by adjusting the position of the marking points and / or the number of the marking points corresponding to the initial label according to the real edge condition of the image to be identified, until the similarity between the real edge condition of the image to be identified and the target label is higher than a threshold, a target label that is more matched with the real edge condition can be obtained, and the accuracy of the generated image label is further improved.
[0083] It can be understood that the edge detection model in step 202 can be iterated step by step. After each time a preset number of sample images are selected to draw a label, the edge detection model is used for additional training to optimize iteration. With the step-by-step optimization of the edge detection model, the accuracy of the generated label in step 204 is higher and higher, and the action of adjusting the label in step 206 is gradually reduced, thereby improving the efficiency of drawing the label. In this case, the iteration optimization can be stopped until the edge detection model meets the requirements of the target detection model described later.
[0084] In one exemplary embodiment, the embodiment of the present application provides a model training method, comprising:
[0085] A sample image with a label generated according to the above intelligent annotation method is obtained; and a candidate detection model is trained based on the sample image and the label of the sample image, until a training condition is reached, to obtain a target detection model for edge detection.
[0086] The sample images can include multiple images, and each sample image can be an image acquired by an image measuring instrument or a flash measuring instrument. The acquired sample images are images without label annotation, and the labels of the sample images can be generated by the intelligent annotation method described above to obtain sample images with labels. The candidate detection model can be, for example, a convolutional neural network architecture for edge detection, such as U-Net, FCN, Mask R-CNN, or a generative adversarial network (GAN), etc. The candidate detection model can be an untrained model or a trained model. For example, the candidate detection model can be an edge detection model in the above embodiments.
[0087] For example, the candidate detection model can be trained based on the sample images and the labels of the sample images until a training condition is met to obtain a target detection model for edge detection. The training condition can be, for example, that the difference between the label and the predicted edge is less than a preset difference threshold, or that the number of training reaches a preset number. The predicted edge is an edge obtained by predicting the sample image based on the candidate detection model. In the process of training the candidate detection model, the sample image is input into the candidate detection model, the edge features in the sample image are identified based on the candidate detection model to obtain a predicted edge, the parameters of the candidate detection model are adjusted based on the difference between the predicted edge and the target edge represented by the label of the corresponding sample image, until the difference between the predicted edge and the target edge represented by the label of the sample image is less than the difference threshold, or until the number of training reaches the preset number, that is, the target detection model for edge detection is obtained. It should be noted that the difference between the predicted edge and the target edge represented by the label of the sample image can be represented by the similarity between the two, or can be represented by the training loss.
[0088] In some examples, the labels of the sample images can be classified according to the edge features represented by the labels to obtain at least one label category. For example, labels corresponding to edge features with a similarity higher than a threshold are classified into the same category. The candidate detection model can be trained by the sample images corresponding to each label category in turn until the prediction results (i.e., predicted edges) of the model for the sample images corresponding to each label category all meet a preset condition to obtain a target detection model. The target detection model obtained in this way can accurately identify edge features of more categories. In actual application scenarios, the candidate detection model can also be trained by the sample images corresponding to the target category label to obtain a target detection model. The target detection model obtained in this way is more accurate in identifying edge features of the target category. The target category can be any label category, for example, a label category specified by a user.
[0089] The model training method can quickly and accurately obtain a large number of sample images with labels to train the model, and improve model training efficiency and training accuracy.
[0090] In an example embodiment, the application provides a measurement method, comprising:
[0091] Obtaining a target image corresponding to the object to be measured; performing edge detection on the target image by using the target detection model obtained by the model training method to obtain a target edge; determining a target size of the target edge, and determining a measurement result of the object to be measured based on the target size.
[0092] The target image can be an overall image or a partial image of the object to be measured. For example, only the part of the object to be measured that needs to be measured can be photographed to obtain the target image.
[0093] For example, the target image corresponding to the object to be measured can be obtained by using an image measurement instrument, and the edge detection on the target image can be performed by using the target detection model embedded in the image measurement instrument to obtain the target edge. The size of the target edge can be measured according to the measurement requirement to obtain the target size, and the measurement result of the object to be measured can be calculated according to the target size. In an actual application scenario, the target detection model obtained by training can be loaded into the measurement software of the image measurement instrument. After the user selects a feature measurement region in the target image by using a feature selection tool, the target detection model can identify the edge features in the selected feature measurement region to obtain the target edge. The image measurement instrument can measure the size of the target edge to obtain the target size, and the measurement result of the object to be measured can be obtained according to the target size.
[0094] For example, the process of identifying the edge features in the target image by using the target detection model can include obtaining the target image based on the feature measurement region. The target detection model can analyze the information in the target image based on the knowledge obtained by training to identify the potential target edge, and display the target edge in the form of a contour line or a point set in the measurement software. The target image can be obtained by appropriately expanding the image contained in the feature measurement region to the outside. The appropriate expansion to the outside can mean that a certain region is expanded outside the feature measurement region, but the target image formed after the expansion does not increase the edge features in the image too much, which can ensure the complete identification of the edge features (i.e., the target edge) in the feature measurement region, and also reduce the influence of other edges (except the target edge) on the target detection model, thereby improving the identification efficiency and accuracy.
[0095] In this embodiment, the target detection model is used to perform edge detection on the target image corresponding to the object to be measured, to obtain a target edge, and the target size based on the target edge is used to obtain a measurement result, so that the target detection model can be used to accurately detect the edge in the target image, thereby improving the accuracy of the measurement result.
[0096] In an actual application scenario, when performing label drawing, the target edge of a sample image (i.e., a sample image) is manually labeled each time, that is, the edge in the sample image is manually drawn from scratch by using a line or arc tool, which requires a large amount of repetitive labor, greatly reduces the label drawing efficiency, and increases the labor cost and production cost. Based on this, the embodiments of the present application provide an intelligent labeling method, which can first select part of the sample images for label drawing, train an initial AI model (i.e., an edge detection model) based on the sample images with drawn labels, use the initial AI model to recognize other sample images to obtain inference results (i.e., edge detection results), generate inference labels (i.e., initial labels) according to the inference results, and participate in training. The number of sample images is relatively small, and there may be differences between the inference labels and the actual edge conditions, so the inference labels are adjusted according to the actual edge conditions to obtain optimized labels (i.e., target labels). Based on the sample images with drawn labels, the initial AI model (i.e., the edge detection model) can be further trained to obtain a more perfect AI model (target detection model). The initial labels can be generated based on the model inference results, the label generation efficiency is improved, and the initial labels are adjusted based on the actual edge conditions to obtain target labels, which can improve the accuracy of the generated labels. The following describes a specific implementation process, and the related operations described in steps S1-S4 below can also be applied to the intelligent labeling method, the model training method, and the measurement method, without further limitation. Specifically, the steps include:
[0097] S1: Prepare a plurality of sample images to be trained
[0098] The plurality of sample images can be obtained by an image measuring instrument for a plurality of samples with the same or similar detection requirements. The sample image does not reflect the entire sample, and can be an image corresponding to a region (feature measurement region) of the sample that the user is interested in, for example, the region includes an edge that the user wants to measure.
[0099] The plurality of sample images to be labeled can be classified. For example, the plurality of sample images with the same or highly similar edge features can be classified into the same class, i.e., the sample images of the same class can share the same or similar target edges to be labeled. The same image class is distinguished by the same naming rule. Specifically, the sample images belonging to the same image class are images corresponding to the approximately same region on the plurality of samples, or the sample images with a plurality of edge features with high similarity on the same sample, and the images taken in the regions with the edge features with high similarity can also be classified into the same image class. For example, different sample images of the same class are as shown in FIG. 8. Figure 4
[0100] S2: Selecting a part of sample images to draw labels, and training an initial AI model (edge detection model) based on the images with the drawn labels
[0101] S2.1 Selecting a plurality of sample images to draw labels manually
[0102] The sample images are imported into the training software, and a plurality of sample images are selected to draw labels one by one. The selected sample images can include a plurality of image classes, and the number of sample images of each image class should not be less than a minimum training threshold (e.g., 10 images) to avoid insufficient training due to too few images.
[0103] When drawing a label on a sample image, a suitable label drawing style (e.g., a line, an arc, a circle, or a curve style) is selected in the drawing software to draw a mark line that fits the target edge on the selected sample image, and a region with a certain width range is formed around the center line of the mark line, which is the generated label. The specific width can be set artificially.
[0104] In the embodiment, the label is set as a closed contour, and the region corresponding to the label includes the target edge feature, rather than only an edge line. By determining a range through the label, even if there is a small error on the boundary when drawing the mark line, the judgment of the overall characteristics of the target edge will not be affected to a certain extent, which can effectively reduce the labeling error. Of course, the more the mark line fits the target edge, the more the label region formed can more accurately cover the target edge, and the higher the edge recognition accuracy of the AI model trained subsequently.
[0105] The process of manually drawing a label is as follows: after the prepared multiple sample images are imported into the training software, the image information is displayed in the corresponding image list interface in a preset order, for example, the image information displayed in the image list interface includes image sequence number, sample image name, label type drawn, label width, whether to participate in training, etc. The corresponding sample image can be displayed on the display interface by clicking the image information in the image list interface. The sample images can also be configured in batches in the image list interface, such as whether to participate in training, batch setting of label width, etc.
[0106] After selecting a sample image, the appropriate label drawing style can be selected in the label setting interface according to the target edge shape to be drawn, wherein the label setting interface can include label drawing style, label width, label transparency (adjusting the transparency of the displayed label, which can facilitate the observation of the edge drawn below the label, and is beneficial to drawing and adjusting the label), etc. For example, if the edge shape to be drawn is a straight line, the label drawing style can be selected as a line in the label setting interface; if the edge shape to be drawn is a standard arc or a circle, the label drawing style can be selected as an arc or a circle in the label setting interface. Then, on the display interface, the mouse is clicked at the location of the target edge to form a rough drawing mark point. If the label drawing style is selected as a line, a straight line can be determined by every two rough drawing mark points. If the label drawing style is selected as an arc or a circle, an arc or a circle can be determined by every three rough drawing mark points.
[0107] Because the connection between points is a straight line by default due to the limitation of the software itself, in order to reflect the corresponding drawing shape, multiple fine drawing mark points will be formed between the adjacent two rough drawing mark points along the determined shape path. The rough drawing mark points and the fine drawing mark points are collectively referred to as mark points. The mark points are connected in sequence to form a mark line with a corresponding shape. The schematic diagram of the mark points and the mark line is shown in FIG. 1. Figure 5
[0108] When drawing each target edge, it can be drawn in segments. The mark lines of each segment can better match the edge and adapt to complex edge shapes. That is, each segment can correspond to two or three rough drawing mark points. In order to ensure that the adjacent two segments are connected, the end of the previous segment and the beginning of the next segment can share one rough drawing mark point. Until the mark line covers the selected target edge, the drawing is completed. Of course, if the edge shape to be drawn is regular and clear, it can be drawn directly without segmentation.
[0109] It should be noted that the above-mentioned center line, arc or circle are suitable for relatively regular edge shapes in the sample image, and a curve with stronger applicability is also given to meet more complex boundary conditions. If the label drawing style is selected as a curve, one end of the curve can be determined by every three rough drawing mark points. Specifically, every three rough drawing mark points form a group, and the size and curvature of the curve are determined by adjusting the position of the third rough drawing mark point. When a curve is drawn, the first rough drawing mark point of the next curve can be the third rough drawing mark point of the previous curve. Even if the edge condition is complex, the mark line formed can cover the target edge. According to the drawn mark line and the set label width, the label can be directly generated, and the label (such as in the form of mark point coordinates and corresponding label width information) is saved to the corresponding training file. The label generated in the embodiment of the present application only covers the target edge, and compared with the existing label drawing which at least covers the region of a closed loop boundary, the label drawing of the embodiment of the present application is relatively easy, and the coverage of the formed label on the sample image is small, which is more conducive to the observation of the user on the boundary condition of the image, and can facilitate subsequent label adjustment.
[0110] Further, the label as a whole can be moved so that the position of the mark line coincides with the target edge. The label as a whole can also be deleted. Each mark point in the label can be deleted or moved to adjust the position of the mark point that does not match, for example, an additional mark point can be added at the selected position. The mark point can be added between the generated mark points to enrich the internal details and make the mark line as a whole more match the target edge, or the mark point can be added outward on both sides of the head and tail of the mark line along the original shape track (such as the original arc), so that the mark line can cover the selected target edge as a whole.
[0111] In step S2.1, in addition to completely manually drawing the label, a semi-automatic labeling method can also be used to draw the label, that is, the training software can also use a method assisted by a traditional algorithm to generate the label, for example, selecting a suitable frame selection shape (such as a fan shape, a rectangular shape or a circular shape) in the corresponding label selection interface to frame the target edge in the display interface, and then the software automatically detects the edge in the framed region by using a configured algorithm such as Canny edge detection to label in the form of mark points and connect to form a mark line, thereby forming an initial label. Due to the complex situation of the image edge, the accuracy of the edge detection algorithm may not meet the requirements, so after automatic labeling, the mark points are manually adjusted to make the mark line fit the target edge, and an optimized label is obtained to better meet the training requirements.
[0112] In the embodiment, the labels can also be classified, wherein the labels corresponding to the same or highly similar target edges in the sample images can be classified into a class. Whether two target edges are the same or highly similar can be determined by comparing the edge conditions such as edge shape contour, edge texture, or edge intensity of the two target edges, and the edges with close edge conditions belong to the same class of edges, and the labels corresponding to the same class of edges belong to the same class of labels. The labels classified into the same class jointly participate in the training of the subsequent AI model, so that the AI model trained can realize the recognition of edges with similar edge conditions. In the training of the same AI model, the sample images of the same image class are preferably used for training, so as to ensure the recognition accuracy of the AI model for edges with similar edge conditions. Of course, it is not limited to this, if different image classes of sample images are used to train the same AI model, the AI model can recognize a wider type of edges, but the recognition accuracy is lower than that of the AI model trained by using a single image class. The same AI model can have multiple classes of labels participating in the training thereof, so as to improve the applicability of the AI model and enable the AI model to recognize multiple edges with different edge conditions. Among them, the classes of the multiple classes of labels can be different label classes corresponding to different target edges on the same sample image, such as Figure 6 The number of sample images participating in the training at least meets the minimum training requirement, such as no less than 10 images. Different classes of labels can be distinguished by different colors. For example, in the same sample image, two different edges may need to be focused on, so different colors can be used to depict the two edges when drawing the labels, so as to correspond to different classes of labels respectively. The labels on different sample images belonging to the same class of labels can be displayed in the same color. The drawing type of the labels of each sample image in the image list interface can be displayed as the corresponding color.
[0113] The training software can also be provided with a label list interface, which can include label color, label name, label width, image quantity, etc. The labels can be managed in batches in the label list interface, such as adjusting the label width and the label name, etc. The label color corresponds to the corresponding label class, and the image quantity corresponds to the number of sample images with this class of labels.
[0114] S2.2 Training based on the images with the currently drawn labels to obtain an initial AI model (edge detection model)
[0115] The sample images required to participate in the training are set in the image list interface, and the selected sample images are all labeled. The prepared sample image data and corresponding label data are input into the selected model architecture (initial detection model) as an initial training set for training, so as to obtain an initial AI model (edge detection model) for feature recognition. The model architecture (initial detection model) can be selected as a convolutional neural network architecture for edge detection, such as U-Net, FCN, MaskR-CNN, or some architectures based on a generative adversarial network (GAN), and the present embodiment does not make too many limitations.
[0116] S3: drawing inference labels (initial labels) on other sample images by using the initial AI model, and adjusting the inference labels to obtain optimized labels (target labels)
[0117] S3.1: performing edge recognition on other sample images based on the initial AI model (edge detection model) to obtain inference results (edge detection results), and generating inference labels (initial labels) according to the inference results
[0118] After obtaining the initial AI model, it is directly loaded in the training software. The initial AI model is used to recognize and infer other sample images without labels, so as to obtain inference results. Specifically, when the inference function is started in the corresponding interface, the sample images without labels are processed by the initial AI model. The initial AI model automatically extracts the features of each input sample image. In this stage, the initial AI model uses the knowledge learned by itself to analyze the information in each sample image, such as color, texture, brightness change, etc., so as to identify the potential target edge, and display the contour line in the display interface (i.e., the inference result). Similarly, when the label reverse function is started, the sample images without labels (to-be-recognized images) can all generate labels according to the inference results (without selecting the pictures, and as long as there are no labels, the pictures will automatically generate labels after the label reverse function is selected). Of course, in addition to directly labeling all images without labels, the AI model can also be configured to recognize only one or more sample images selected in the image list interface, so as to obtain the inference results of the selected sample images.
[0119] The potential target edge here refers to the edge features that the initial AI model can recognize. That is, the initial AI model can only recognize the edge categories participating in the training in step S2. If the edge category does not exist in the sample image, it may not be recognized. Of course, because the number of initial training sets in step S2 is small, even if the edge category exists in the sample image, the initial AI model may fail to recognize it. After obtaining the inference result (edge detection result) of the selected sample image (to-be-recognized image), the inference label (initial label) can be generated by backstepping. Specifically, a plurality of marking points can be generated along the contour line corresponding to the inference result, the plurality of marking points are connected to generate a marking line, and the inference label (initial label) is generated according to the default label width with the marking line as the center line. The flowchart of backstepping to generate the label is shown in Figure 7 .
[0120] S3.2 Adjusting the inference label (initial label) according to the actual target edge in the sample image to obtain an optimized label (target label)
[0121] Because the number of initial training sets participating in the training is small, there may be some differences between the inference result recognized by the initial AI model and the actual target edge, resulting in differences between the inference label (initial label) generated by backstepping and the actual target edge. Therefore, the generated inference label (initial label) is adaptively adjusted according to the actual target edge on the display interface, such as moving / deleting the label (may be misrecognized, and if a non-target edge is recognized, the corresponding inference label is directly deleted), deleting the marking point, adjusting the position of the marking point, and the like, so that the optimized label (target label) can better fit the target edge on the current sample image. The schematic diagram of the adjusted label (target label) is shown in Figure 8 .
[0122] S4: Training the required AI model (target detection model) based on the newly added sample image with the label drawn
[0123] In the image list interface, sample images that need to participate in training are selected, and the selected sample images are all labeled (i.e., sample images with labels). Of course, sample images that have not participated in training are preferentially selected, i.e., sample images with labels added in step S3. The prepared sample image data and corresponding label data are input as a new training set to the initial AI model (edge detection model) previously trained for training, so as to obtain a target AI model (target detection model) with higher recognition accuracy. This process is to train and optimize the initial AI model using the new training set based on the initial AI model, which can significantly improve the training speed compared to retraining an AI model. Of course, there is no limitation, and the initial training set obtained previously can also be combined together as a training set and output to the set model architecture (initial detection model) to retrain the AI model, which may require more training time and computing resources.
[0124] After the AI model training is completed, the AI model can be loaded in the training software to perform recognition inference on sample images to obtain inference results, and the accuracy of the AI model is evaluated according to the inference results. If the accuracy of the AI model is still low, it means that the number of training sets participating in training is still too small, and sample images can be added or sample images that have not participated in training can be selected to repeat step S3, so that the added sample image data and corresponding label data are added to the training set to perform additional training on the AI model, i.e., training based on the original AI model to improve the accuracy of the AI model, until the required AI model (target detection model) is obtained, i.e., the recognition accuracy of the AI model meets the requirements and is evaluated as qualified.
[0125] It can be understood that the AI model can be iterated gradually, and each time in step S3, a preset number of sample images are selected to draw labels for additional training of the AI model for optimization and iteration until the AI model meets the requirements. With the gradual optimization of the AI model, the accuracy of the inference label generated by backstepping in step S3 is higher and higher, and the action of manually adjusting the label is gradually reduced, thereby reducing the labor cost and improving the efficiency of drawing labels. Of course, a large number of sample images with labels can also be directly obtained in step S3 to train the required AI model as much as possible at one time.
[0126] After the AI model is evaluated to be qualified, the AI model (target detection model) can be loaded into the measurement software of the video measuring instrument. After a user selects a feature measurement area by using a feature selection tool (such as a circle, a sector, or a rectangle), the AI model (target detection model) can identify edges according to the selected feature measurement area, and label the sizes to be measured according to the identified features, so as to complete feature measurement. Compared with the edge recognition algorithm provided by the measurement software, the AI model can achieve more accurate feature recognition, and can identify edges that cannot be identified by the traditional edge recognition algorithm. For example, the edge recognition algorithm provided by the measurement software is prone to errors, and the identified edge features deviate from the actual target edges, and the two cannot be matched and can only be manually adjusted. Moreover, for some complex edges, only manual point selection can be performed. After the AI model (target detection model) is loaded, even if the edge situation is complex, the AI model can still accurately identify the features in the feature measurement area.
[0127] It should be understood that, although each step in the flowchart involved in the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps. It can be understood that the steps in different embodiments can be freely combined as needed, and various non-contradictory schemes formed by the combination are within the scope of protection of the present application.
[0128] Based on the same inventive concept, the embodiments of the present application also provide an intelligent labeling device for implementing the above-mentioned intelligent labeling method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more intelligent labeling device embodiments provided below can refer to the limitations of the intelligent labeling method in the above text, which will not be described here.
[0129] In one exemplary embodiment, as shown in Figure 9 An intelligent labeling device is provided, comprising an edge detection module 902, a label generation module 904, and a label adjustment module 906, wherein:
[0130] The edge detection module 902 is configured to perform edge detection on the to-be-identified image based on an edge detection model to obtain an edge detection result.
[0131] The label generation module 904 is configured to generate an initial label of the image to be recognized according to the edge detection result.
[0132] The label adjustment module 906 is configured to adjust the initial label according to the actual edge condition of the image to be recognized, to obtain a target label of the image to be recognized.
[0133] In some embodiments, the label generation module 904 is further configured to: determine a target marking point according to the edge detection result; fit the target marking point to obtain a target marking line; and generate the initial label of the image to be recognized based on the target marking line and a preset label width.
[0134] In some embodiments, the label generation module 904 is further configured to: generate a first boundary line and a second boundary line on both sides of the target marking line with the target marking line as the center, a distance between the first boundary line and the second boundary line being the preset label width; and take a frame of a region formed by the first boundary line and the second boundary line as the initial label of the image to be recognized.
[0135] In some embodiments, the label adjustment module 906 is further configured to: adjust a marking point position and / or a marking point quantity corresponding to the initial label according to the actual edge condition of the image to be recognized, until a similarity between the initial label and the actual edge condition of the image to be recognized is higher than a threshold, to obtain the target label of the image to be recognized.
[0136] Based on the same inventive concept, the embodiments of the present application also provide a model training device for implementing the model training method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more model training device embodiments provided below can be referred to the limitations of the model training method described above, which will not be repeated here.
[0137] In an exemplary embodiment, a model training device is provided, comprising:
[0138] A sample image acquisition module is configured to acquire a sample image with a label generated according to the intelligent labeling method described above;
[0139] A model training module is configured to train a candidate detection model based on the sample image and the label of the sample image, until a training condition is reached, to obtain a target detection model for edge detection.
[0140] Based on the same inventive concept, the embodiments of the present application also provide a measurement device for implementing the measurement method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more measurement device embodiments provided below can be referred to the limitations of the measurement method described above, which will not be repeated here.
[0141] In one example embodiment, a measurement device is provided, comprising:
[0142] an image acquisition module configured to acquire a target image corresponding to the object to be measured;
[0143] an edge detection module configured to perform edge detection on the target image based on the target detection model obtained by the model training method to obtain a target edge;
[0144] a result determination module configured to determine a target size of the target edge, and determine a measurement result of the object to be measured based on the target size.
[0145] The various modules in the above intelligent labeling device, model training device or measurement device can be implemented in whole or in part by software, hardware and combinations thereof. The various modules described above can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the above various modules.
[0146] In one example embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as shown in Figure 10 The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store related data of the intelligent labeling method. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement an intelligent labeling method.
[0147] Those skilled in the art can understand that Figure 10 the structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0148] In an example embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above method embodiments when executing the computer program.
[0149] In an example embodiment, a computer readable storage medium is provided, storing a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.
[0150] In an example embodiment, a computer program product is provided, comprising a computer program, and the computer program implementing the steps in the above method embodiments when executed by a processor.
[0151] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.
[0152] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0153] The technical features of the above embodiments can be combined in any manner. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.
[0154] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. An intelligent labeling method, characterized in that, The method comprises: performing edge detection on the image to be recognized based on an edge detection model to obtain an edge detection result; determining a target marker point according to the edge detection result; fitting the target marker point to obtain a target marker line; generating a bounding box of a preset label width around the target marker line according to the trajectory of the target marker line to obtain an initial label of the image to be recognized; adjusting the initial label according to the actual edge condition of the image to be recognized to obtain a target label of the image to be recognized.
2. The method of claim 1, wherein, The method comprises: generating a first boundary line and a second boundary line on both sides of the target marker line with the target marker line as the center, and the distance between the first boundary line and the second boundary line is a preset label width; taking the bounding box of the area formed by the first boundary line and the second boundary line as the initial label of the image to be recognized.
3. The method of claim 1, wherein, The method comprises: adjusting the position and / or number of marker points corresponding to the initial label according to the actual edge condition of the image to be recognized until the similarity between the initial label and the actual edge condition of the image to be recognized is higher than a threshold value to obtain the target label of the image to be recognized.
4. The method of claim 1, wherein, The method further comprises: obtaining a sample image obtained by shooting a sample through an image measuring instrument, and labeling the sample image to obtain a labeled label of the sample image; inputting the sample image including the labeled label into an initial detection model to obtain a predicted edge feature; adjusting the parameters of the initial detection model according to the difference between the predicted edge feature and a target edge feature corresponding to the labeled label until the difference between the predicted edge feature and the target edge feature is less than a difference threshold to obtain an edge detection model.
5. A model training method, comprising: The method comprises: obtaining a sample image with a label generated by the intelligent labeling method according to any one of claims 1 to 4; training a candidate detection model based on the sample image and the label of the sample image until a training condition is reached to obtain a target detection model for edge detection.
6. A method of measuring, characterized by, The method comprises: obtaining a target image corresponding to an object to be measured; performing edge detection on the target image through the target detection model obtained by the model training method according to claim 5 to obtain a target edge; determining a target size of the target edge and determining a measurement result of the object to be measured based on the target size.
7. An intelligent labeling apparatus, characterized by, The device comprises: an edge detection module configured to perform edge detection on an image to be recognized based on an edge detection model to obtain an edge detection result; a label generation module configured to determine a target marker point according to the edge detection result, fit the target marker point to obtain a target marker line, and generate a bounding box of a preset label width around the target marker line according to the trajectory of the target marker line to obtain an initial label of the image to be recognized. A label adjusting module is configured to adjust the initial label according to a real edge condition of the image to be recognized, so as to obtain a target label of the image to be recognized. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6. The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
Citation Information
Patent Citations
Model training method and device, electronic equipment and computer-readable storage medium
CN108921161A