Training methods, devices, terminal equipment, and storage media for defect detection models
By establishing an industrial inspection dataset and updating the network structure using alternative inspection models, the problem of insufficient accuracy and generalization ability of existing models in industrial visual inspection is solved, and efficient training of industrial visual inspection models is achieved.
Patent Information
- Application Number
- CN202211579114.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-12-06
AI Technical Summary
Existing deep learning models based on ImageNet and JFT-300M datasets have poor accuracy and low generalization ability in industrial visual inspection, making them difficult to apply to industrial visual inspection.
By establishing an industrial inspection dataset, the backbone network of the initial inspection model is trained, and alternative inspection models are combined with the target detection network and semantic segmentation network. The model is updated based on the target detection prediction data and semantic segmentation prediction data, forming a target detection model with strong generalization ability and high accuracy.
It enables the rapid construction of industrial visual inspection models with strong generalization ability and high accuracy with a small amount of defect target data, and is suitable for a variety of industrial inspection scenarios.
Smart Images

Figure CN115760843B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of defect detection, in particular to a defect detection model training method and device, a terminal device and a storage medium. BACKGROUND
[0002] With the development of deep learning in the field of vision, image processing generally uses ImageNet dataset (14 million image data), JFT-300M dataset (300 million image data) and other datasets as pre-training models; these known datasets are image data in natural environment, covering most of the picture categories in life, and there is a big difference with the imaging characteristics of industrial vision images.
[0003] However, in the implementation of industrial visual detection, it is difficult to collect negative samples (defect data), which limits the model precision, generalization ability and other aspects of the pre-training model corresponding to the ImageNet dataset for industrial visual image detection, and is not suitable for industrial visual detection. SUMMARY
[0004] In order to solve the problem of poor precision and low generalization ability of the model of deep learning through known dataset for industrial visual detection, the present application provides a defect detection model training method, device, terminal device and storage medium.
[0005] Embodiments of the present application are implemented as follows:
[0006] The first aspect of the embodiments of the present application provides a defect detection model training method, comprising the following steps:
[0007] Based on the industrial detection dataset, the backbone network of the initial detection model is trained, and the industrial detection dataset is established according to the preset rules according to various detection images of industrial detection;
[0008] The first defect target data set is determined by the alternative detection model, and the target detection prediction data and the semantic segmentation prediction data of the first defect target are determined; wherein the alternative detection model is determined based on the backbone network, the target detection network and the semantic segmentation network, the first defect target data set is an image with the first defect target, and the number of images of the first defect target data set is less than the number of images of the industrial detection data set;
[0009] Based on the target detection prediction data and the semantic segmentation prediction data, the target detection model corresponding to the first defect target is determined, and the target detection model comprises the backbone network, the updated target detection network and the updated semantic segmentation network.
[0010] The second aspect of the embodiment of the application provides a training device of a defect detection model, comprising a first training module, a second training module and an updating module; wherein,
[0011] The first training module is configured to train a backbone network of an initial detection model based on an industrial detection data set, which is established according to a preset rule based on various detection images of industrial detection;
[0012] The second training module is configured to determine target detection prediction data and semantic segmentation prediction data of a first defect target by using an alternative detection model on a first target detection data set; wherein, the alternative detection model is determined based on the backbone network, a target detection network and a semantic segmentation network, the first target detection data set is an image with the first defect target, and the number of images of the first target detection data set is less than the number of images of the industrial detection data set;
[0013] The updating module is configured to determine a target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, wherein the target detection model comprises the backbone network, an updated target detection network and an updated semantic segmentation network.
[0014] The third aspect of the embodiment of the application provides a terminal device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the training method of the defect detection model of the first aspect in the invention when executing the computer program.
[0015] The fourth aspect of the embodiment of the application provides a computer storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to make the processor execute the steps of the training method of the defect detection model of the first aspect in the invention.
[0016] The beneficial effects of the application are as follows: various detection images of industrial detection are established into an industrial detection data set according to a preset rule; the backbone network of an initial detection model can be trained based on the industrial detection data set; target detection prediction data and semantic segmentation prediction data of a first defect target are determined by using an alternative detection model on a first target detection data set with the first defect target, wherein the alternative detection model comprises a backbone network, a target detection network and a semantic segmentation network; further, a target detection model corresponding to the first defect target can be determined based on the target detection prediction data and the semantic segmentation prediction data, wherein the target detection model comprises the backbone network, an updated target detection network and an updated semantic segmentation network; and a target detection model with strong generalization ability and high precision can be quickly realized by using a small amount of defect target data. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0018] Figure 1 A flowchart of a method for training a defect detection model is shown;
[0019] Figure 2 A flowchart of training an initial detection model is shown;
[0020] Figure 3 A network structure diagram of an initial detection model is shown;
[0021] Figure 4 A flowchart of a method for training a defect detection model is shown;
[0022] Figure 5 A flowchart of determining an alternative detection model is shown;
[0023] Figure 6 A network structure diagram of an alternative detection model is shown;
[0024] Figure 7 A network structure diagram of another alternative detection model is shown;
[0025] Figure 8 A flowchart of obtaining a first target data set to be detected is shown;
[0026] Figure 9 A flowchart of determining a target detection model is shown;
[0027] Figure 10 A flowchart of a method for training a defect detection model is shown;
[0028] Figure 11 A flowchart of a method for training a defect detection model is shown;
[0029] Figure 12 A structure diagram of a training device for a defect detection model is shown. DETAILED DESCRIPTION
[0030] For the purposes of the present application, embodiments and advantages, the following will be described in the present application with reference to the accompanying drawings of the exemplary embodiments of the present application, which are described clearly and completely. It is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, not all.
[0031] It should be noted that the brief description of the terms in the present application is only for the convenience of understanding the subsequent described embodiments, and is not intended to limit the embodiments of the present application. Unless otherwise specified, these terms should be understood according to their ordinary and general meanings.
[0032] The terms "first", "second", "third" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchanged under appropriate circumstances.
[0033] The terms "include" and "have" and any variations thereof are intended to cover but not exclusive inclusion, for example, a product or device including a series of components does not necessarily limit to all components clearly listed, but can include other components not clearly listed or inherent to these products or devices.
[0034] ImageNet dataset (1400 million image data), JFT-300M dataset (300 million image data) and the like are commonly used datasets in current image processing application field, these datasets are image data in natural environment, through huge image data covering most of the picture categories in life, by using these datasets as parameter initialization of pre-training model, improve the generalization ability of model.
[0035] And in the field of industrial vision detection, the imaging characteristics of the image are quite different from the imaging characteristics of the data of ImageNet dataset, JFT-300M dataset and the like. Some industrial image data are microscopic imaging data. If the model is still trained using these known datasets, the deep learning ability of the model will be reduced, and the model precision and generalization ability of the model for industrial vision image detection will be insufficient. Among them, the image data in industrial detection are for various machines, various industrial camera environments, various industrial product backgrounds and other conditions of various defect types.
[0036] Combined with the actual industrial generation environment, the difficulty of obtaining defect data, and the short cycle of each detection model online, we need a fast iterative defect detection model training method to meet the needs of defect detection in industrial production.
[0037] In order to solve the problem of poor accuracy and low generalization ability of the model of known data set deep learning for industrial visual inspection, the embodiment of the application provides a training method and device of a defect detection model, terminal equipment and a storage medium. The various detection images of industrial detection are established into an industrial detection data set according to a preset rule; the backbone network of an initial detection model can be trained based on the industrial detection data set; a first defect target data set with a first defect target is determined by a candidate detection model to determine target detection prediction data and semantic segmentation prediction data of the first defect target, wherein the candidate detection model includes a backbone network, a target detection network and a semantic segmentation network; further, the target detection model corresponding to the first defect target can be determined based on the target detection prediction data and the semantic segmentation prediction data, and the target detection model includes a backbone network, an updated target detection network and an updated semantic segmentation network; a target detection model with strong generalization ability and high precision can be quickly realized by a small amount of defect target data.
[0038] The training method, device, terminal equipment and storage medium of the defect detection model of the embodiment of the application are described in detail below with reference to the accompanying drawings.
[0039] Figure 1 A flowchart of a training method of a defect detection model provided by the embodiment of the application is shown, as shown in Figure 1 The training method of the defect detection model provided by the embodiment of the application is shown in
[0040] The training method of the defect detection model includes the following steps:
[0041] S110, training the backbone network of the initial detection model based on the industrial detection data set, wherein the industrial detection data set is established by various detection images of industrial detection according to a preset rule.
[0042] The ImageNet data set (14 million image data), JFT-300M data set (300 million image data) and the like are image data in a natural environment. In order to improve the deep learning ability of the model in the industrial detection field, an industrial detection data set suitable for the industrial detection environment can be established based on various existing industrial detection images.
[0043] The detection model is trained by establishing the industrial detection data set to improve the generalization ability of the model, that is, the detection equipment learns the rules behind each data in the industrial detection data set through the adaptability of the deep learning industrial detection data set, and the network model trained can also give the corresponding defect detection output for the data outside the learning set with the same rule.
[0044] Figure 2 A flowchart of training an initial detection model is shown, as shown inFigure 2 As shown, step 110 trains the backbone network of the initial detection model based on an industrial detection dataset, which is established according to a preset rule based on various detection images of industrial detection, and includes:
[0045] S101, an industrial detection dataset is established, which is divided into M large categories and N small categories according to a preset rule based on existing detection images.
[0046] The existing detection images can cover various detection machines, various industrial camera environments, various industrial product backgrounds, and various defect types of existing image data. For these existing detection images, target detection annotation and semantic segmentation annotation can be performed based on the target to be detected, so that these images can be divided into M large categories and N small categories according to the preset planning. The preset rule is determined based on the product qualification requirements of industrial defect detection.
[0047] For example, the industrial detection dataset can be defined as Big Industrial Datasets, abbreviated as BID; the industrial detection dataset can include 50 large categories such as mobile phone frames, displays, earphones, printing, wearable devices, 500 small categories such as camera modules, cavities, charging ports, earphone ports, SIM card slots, short sides, long sides, and a total of 1 million data sets.
[0048] S102, training an initial detection model based on the industrial detection dataset.
[0049] The existing model is pre-trained based on the established industrial detection dataset to determine the initial detection model, especially the pre-training of the backbone network of the initial detection model. The initial detection model includes a backbone network and an initial prediction network.
[0050] Taking EfficientRep in yolov6 as the backbone network as an example, Figure 3 The network structure diagram of the initial detection model is shown in the embodiment of the application, as shown in Figure 3 As shown, the initial detection model includes a backbone network (Backbone) and an initial prediction network (classification head, classification head).
[0051] The backbone network is a network for extracting features, and its function is to extract information in the image data of the industrial detection dataset for use by the subsequent network. The backbone network is usually a network designed in the existing model, and resnet, VGG, etc. are often used. These backbone networks already have strong feature extraction capabilities. By replacing the model parameters of these backbone networks with the industrial detection dataset, the existing model is pre-trained based on the industrial detection dataset to obtain the initial detection model.
[0052] The classification head is a network that obtains the output content of the network, and makes a prediction using the features extracted by the previous backbone network. For the industrial defect detection process, we also need to further build and train the initial detection model through a small amount of target detection image data to be detected. The specific process is as follows:
[0053] S120, the first target data set to be detected is determined by the alternative detection model, and the target detection prediction data and the semantic segmentation prediction data of the first defect target are determined.
[0054] Among them, the alternative detection model includes a backbone network, a target detection network and a semantic segmentation network.
[0055] Figure 4 The flowchart of the training method of the defect detection model provided by the embodiment of the application is shown, as shown in Figure 4 Before step 120, the first target data set to be detected is determined by the alternative detection model, and the target detection prediction data and the semantic segmentation prediction data of the first defect target are determined, the method further comprises:
[0056] S121, based on the initial detection model, the target detection network and the semantic segmentation network, the alternative detection model is determined.
[0057] In view of the environmental restrictions of the difficulty of industrial data set collection on site, long cycle, in the aspect of model selection, the target detection network and the semantic segmentation network are selected, the required annotation information is more abundant, and the dependence on data quantity can be reduced.
[0058] Figure 5 The flowchart of the determination of the alternative detection model provided by the embodiment of the application is shown, as shown in Figure 5 In step 121, based on the initial detection model, the target detection network and the semantic segmentation network, the alternative detection model is determined, and the specific steps include:
[0059] S2101, the initial prediction network connected to the output end of the backbone network in the initial detection model is replaced by a feature extraction structure, and the feature extraction structure is used to perform feature fusion on the feature map in the backbone network.
[0060] S2102, based on the backbone network, the feature extraction structure, the target detection network and the semantic segmentation network, the alternative detection model is determined.
[0061] The target detection network and the semantic segmentation network each have their application characteristics and advantages and disadvantages. The target detection network has disadvantages in detecting small targets, special angle targets and special shape targets, but can detect targets with certain area overlap; the semantic segmentation network is difficult to handle multiple target overlap areas, but can perform pixel-level classification on targets of any shape.
[0062] The output end of the backbone network is in communication connection with the input end of the feature extraction structure; the output end of the feature extraction structure is in communication connection with the input end of the target detection network and the input end of the semantic segmentation network.
[0063] Continuing to take the initial detection model shown in Figure 3 as an example, Figure 6 a network structure diagram of an alternative detection model of an embodiment of the present application is shown, Figure 7 a network structure diagram of another alternative detection model of an embodiment of the present application is shown. It should be noted that the alternative detection model includes a target detection network and a semantic segmentation network, and in order to show clearly, the target detection network and the semantic segmentation network are shown separately. Figure 6 and Figure 7 The two figures show that, as Figure 6 , Figure 7 shown, the alternative detection model includes a backbone network (Backbone), a feature extraction structure (Neck), a target detection network (detection head) and a semantic segmentation network (segmentation head).
[0064] The Neck functions to fuse features of different dimensions in the Backbone to obtain three scale features P3, P4 and P5, and the fused features are used as inputs of the target detection network and the semantic segmentation network.
[0065] Before S120, a first to-be-detected target data set corresponding to the first to-be-detected target also needs to be obtained. The first to-be-detected target data set is an image with a first defect target, and the number of images of the first to-be-detected target data set is less than the number of images of the industrial detection data set.
[0066] It should be understood that the number of images of the first to-be-detected target data set can be less than the number of images of the industrial detection data set. For example, the number of images of the first to-be-detected target data set can be 100.
[0067] In actual industrial defect detection, various defect detection will be encountered. In order to further improve the performance of detection, the embodiment of the present application further trains the alternative detection model by reducing the first to-be-detected target data set corresponding to the first to-be-detected target required for model convergence.
[0068] It should be understood that in the application of industrial defect detection, not only the first target to be detected, but also the second target to be detected,..., the Pth target to be detected, that is, the application can further train the candidate detection model according to the data set of a small amount of image data corresponding to each target to be detected.
[0069] For example, taking the scratch detection of the outer frame of a mobile phone as the first target to be detected, relevant scratch images of the outer frame of the mobile phone and good product data images without scratches need to be collected, and the number of collected scratch images is 100 or more.
[0070] Figure 8 The flowchart of the first target to be detected data set acquisition provided by the embodiment of the application is shown in FIG. 1. Figure 8 As shown in FIG. 1, the first target to be detected data set acquisition specifically includes the following steps:
[0071] S2201, performing target detection labeling and semantic segmentation labeling on the image data corresponding to the first target to be detected.
[0072] S2202, performing data enhancement on the labeled image data to determine the first target to be detected data set.
[0073] The data enhancement on the labeled image data can include but is not limited to copy-paste and mosaic data enhancement.
[0074] In combination with the establishment of the candidate detection model and the acquisition of the first target to be detected data set, step 120 is performed, that is, the first target to be detected data set passes through the candidate detection model to determine the target detection prediction data and the semantic segmentation prediction data of the first defect target.
[0075] The first target to be detected data set passes through the backbone network of the candidate detection model, enters the feature extraction structure, outputs the fused features, and then passes through the target detection network to determine the target detection prediction data of the first defect target; and the first target to be detected data set passes through the backbone network of the candidate detection model, enters the feature extraction structure, outputs the fused features, and then passes through the semantic segmentation network to determine the semantic segmentation prediction data of the first defect target.
[0076] For example, in the determination of the target detection prediction data, the detection head is as shown in FIG. 2. Figure 7 As shown in FIG. 2, the final feature dimension is 8400*(n+5), n represents the number of defect categories, and 5 represents the x, y, w, h coordinate positions and the width and height of the rectangular frame and the target confidence.
[0077] The segmentation head and the detection head are two parallel branch networks, which can be operated in parallel, and the two branches share the backbone and the neck.
[0078] As shown in Figure 1 S130, based on the target detection prediction data and the semantic segmentation prediction data, determining a target detection model corresponding to the first defect target, the target detection model comprising a backbone network, an updated target detection network, and an updated semantic segmentation network.
[0079] Figure 9 A flowchart of the target detection model determination provided by the embodiments of the present application is shown in Figure 9 S130, based on the target detection prediction data and the semantic segmentation prediction data, determining a target detection model corresponding to the first defect target, specifically comprising the following steps:
[0080] S301, based on the target detection prediction data, determining target detection loss data.
[0081] S302, based on the semantic segmentation prediction data, determining semantic segmentation loss data.
[0082] S303, performing reverse gradient propagation on the sum of the target detection loss data and the semantic segmentation loss data to determine update data.
[0083] S304, based on the update data, updating the target detection network and the semantic segmentation network.
[0084] In some embodiments, the target detection model further comprises an updated feature extraction structure.
[0085] Figure 10 A flowchart of another training method of a defect detection model provided by the embodiments of the present application is shown in Figure 10 After step 130, based on the target detection prediction data and the semantic segmentation prediction data, determining a target detection model corresponding to the first defect target, the training method of the defect detection model further comprises:
[0086] S140, based on a preset detection requirement of the first defect target, determining that the target detection model comprises the updated target detection network, or the updated semantic segmentation network, or the updated target detection network and the updated semantic segmentation network.
[0087] It should be understood that the trained target detection model can be used for the detection of the first defect target (for example, a scratch on the outer frame of a mobile phone) in actual applications.
[0088] The target detection model includes the updated target detection network, or the updated semantic segmentation network, or the updated target detection network and the updated semantic segmentation network based on preset detection requirements of the first defect target. It should be understood that only one branch of the double branch can be selected for defect detection, for example, if only the defect position needs to be located, only the target detection network branch can be selected, if the area size of the scratch area also needs to be known, the semantic segmentation network branch also needs to be selected.
[0089] Figure 11 A flowchart of a training method of another defect detection model provided by an embodiment of the application is shown, as shown in Figure 11 The training method of the defect detection model is applied to the model training of three defect targets, which are the first defect target, the second defect target and the third defect target. The training method of the defect detection model specifically includes the following steps:
[0090] S210, an industrial detection data set is established.
[0091] S220, a backbone network of an initial detection model is trained based on the industrial detection data set.
[0092] For the first defect target, S231, image data of a first to-be-detected target is obtained. S232, target detection labeling and semantic segmentation labeling are performed on the image data corresponding to the first to-be-detected target. S233, the labeled image data is subjected to data enhancement to determine a first to-be-detected target data set. S234, the first to-be-detected target data set is subjected to the alternative detection model to determine target detection prediction data and semantic segmentation prediction data of the first defect target. S235, a target detection model corresponding to the first defect target is determined based on the target detection prediction data and the semantic segmentation prediction data. S236, the target detection model is deployed based on preset detection requirements of the first defect target.
[0093] For the second defect target, S241, image data of a second to-be-detected target is obtained. S242, target detection labeling and semantic segmentation labeling are performed on the image data corresponding to the second to-be-detected target. S243, the labeled image data is subjected to data enhancement to determine a second to-be-detected target data set. S244, the second to-be-detected target data set is subjected to the alternative detection model to determine target detection prediction data and semantic segmentation prediction data of the second defect target. S245, a target detection model corresponding to the second defect target is determined based on the target detection prediction data and the semantic segmentation prediction data. S246, the target detection model is deployed based on preset detection requirements of the second defect target.
[0094] For the third defect target, S251, image data of the third to-be-detected target is acquired. S252, target detection labeling and semantic segmentation labeling are performed on the image data corresponding to the third to-be-detected target. S253, the labeled image data is subjected to data enhancement, and a third to-be-detected target data set is determined. S254, the third to-be-detected target data set passes through the candidate detection model, and target detection prediction data and semantic segmentation prediction data of the third defect target are determined. S255, based on the target detection prediction data and the semantic segmentation prediction data, a target detection model corresponding to the third defect target is determined. S256, based on a preset detection requirement of the third defect target, the target detection model is deployed.
[0095] It should be understood that the number of detection items is not limited to three as described in the above embodiments, but can also be one or other numbers, which is determined according to the defect detection requirement, and each detection item updates the corresponding candidate detection model according to the corresponding to-be-detected target data set to obtain the corresponding target detection model.
[0096] The embodiment of the application provides a defect detection model training method. Various detection images of industrial detection are established into an industrial detection data set according to a preset rule. The backbone network of an initial detection model can be trained based on the industrial detection data set. The first to-be-detected target data set with the first defect target passes through the candidate detection model to determine the target detection prediction data and the semantic segmentation prediction data of the first defect target, wherein the candidate detection model includes the backbone network, the target detection network and the semantic segmentation network. Further, the target detection model corresponding to the first defect target can be determined based on the target detection prediction data and the semantic segmentation prediction data, and the target detection model includes the backbone network, the updated target detection network and the updated semantic segmentation network. A target detection model with strong generalization ability and high precision can be quickly realized through a small amount of defect target data.
[0097] Figure 12 A structure diagram of a defect detection model training device provided by the embodiment of the application is shown in FIG. 12. Figure 12 As shown in FIG. 12, the defect detection model training device 1200 includes a first training module 1210, a second training module 1220 and an updating module 1230.
[0098] The first training module is configured to train the backbone network of the initial detection model based on the industrial detection data set, wherein the industrial detection data set is established by various detection images of industrial detection according to a preset rule.
[0099] The second training module is configured to determine target detection prediction data and semantic segmentation prediction data of the first defect target by using the first to-be-detected target data set and the alternative detection model.
[0100] The updating module is configured to determine the target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, and the target detection model comprises the backbone network, the updated target detection network, and the updated semantic segmentation network.
[0101] In some embodiments, the updating module further comprises a data processing unit and an updating unit, wherein,
[0102] The data processing unit is configured to determine target detection loss data based on the target detection prediction data.
[0103] The data processing unit is further configured to determine semantic segmentation loss data based on the semantic segmentation prediction data.
[0104] The data processing unit is further configured to perform back propagation of a sum value of the target detection loss data and the semantic segmentation loss data to determine updating data.
[0105] The updating unit is configured to update the target detection network and the semantic segmentation network based on the updating data.
[0106] In some embodiments, the training device of the defect detection model further comprises a model building module, and the model building module is configured to:
[0107] replace an initial prediction network connected to an output end of the backbone network in the initial detection model with a feature extraction structure, and the feature extraction structure is configured to perform feature fusion on feature maps in the backbone network.
[0108] determine the alternative detection model based on the backbone network, the feature extraction structure, the target detection network, and the semantic segmentation network.
[0109] In some embodiments, the updating unit is further configured to update the feature extraction structure.
[0110] In some embodiments, the model building module is further configured to:
[0111] The output end of the backbone network is in communication connection with the input end of the feature extraction structure.
[0112] The output end of the feature extraction structure is in communication connection with the input end of the target detection network and the input end of the semantic segmentation network.
[0113] In some embodiments, the training apparatus of the defect detection model further comprises a target data acquisition module, the target data acquisition module is configured to:
[0114] perform target detection labeling and semantic segmentation labeling on the image data corresponding to the first target to be detected;
[0115] perform data enhancement on the labeled image data to determine the first target data set to be detected.
[0116] In some embodiments, the training apparatus of the defect detection model further comprises a deployment module, the deployment module is configured to:
[0117] based on the preset detection requirement of the first defect target, determine that the target detection model comprises the updated target detection network, or the updated semantic segmentation network, or the updated target detection network and the updated semantic segmentation network.
[0118] The embodiments of the present application provide a training apparatus of a defect detection model, comprising a first training module, a second training module and an updating module; various detection images of industrial detection are established into an industrial detection data set according to a preset rule; the backbone network of an initial detection model can be trained based on the industrial detection data set; a first target data set to be detected with a first defect target determines target detection prediction data and semantic segmentation prediction data of the first defect target through an alternative detection model, wherein the alternative detection model comprises a backbone network, a target detection network and a semantic segmentation network; further, based on the target detection prediction data and the semantic segmentation prediction data, a target detection model corresponding to the first defect target is determined, the target detection model comprises a backbone network, an updated target detection network and an updated semantic segmentation network; through a small amount of defect target data, a target detection model with strong generalization ability and high precision can be quickly realized.
[0119] The embodiments of the present application also provide a terminal device, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program, the computer program is used to realize the training method of the defect detection model, the implementation principle and technical effects are similar to those of the above-mentioned method embodiments, and details are not repeated here.
[0120] The embodiments of the present application also provide a computer storage medium, a computer readable storage medium stores a computer program, and the computer program is executed by a processor to execute the training method of the defect detection model, and the implementation principle and technical effects are similar to those of the above-mentioned method embodiments, and details are not repeated here.
[0121] The following paragraphs will compare and list the Chinese terms involved in the specification of the present application and their corresponding English terms, so as to facilitate reading and understanding.
[0122] For the sake of explanation, the foregoing descriptions have been presented in terms of specific embodiments. However, it is to be appreciated that specific embodiments described herein are not intended to limit the scope of the present application, which is defined with reference to the following claims. Various modifications and changes can be made thereto by those skilled in the art which fall within the scope of the present application as defined by the following claims. The embodiments were chosen and described in order to explain the principles of the application and the practical application and to enable others skilled in the art to understand for implementing various embodiments and with various modifications as are suited to the particular use contemplated.
Claims
1. A training method for a defect detection model, characterized in that, The method comprises the following steps: training a backbone network of an initial detection model based on an industrial detection dataset, wherein the industrial detection dataset is established according to a preset rule based on various detection images of industrial detection; determining target detection prediction data and semantic segmentation prediction data of a first defect target through a first to-be-detected target dataset by using an alternative detection model, wherein the alternative detection model is determined based on the backbone network, a target detection network and a semantic segmentation network, the first to-be-detected target dataset is an image with the first defect target, and the number of images in the first to-be-detected target dataset is less than the number of images in the industrial detection dataset; determining a target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, wherein the target detection model comprises the backbone network, an updated target detection network and an updated semantic segmentation network; determining a target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data comprises: determining target detection loss data based on the target detection prediction data; determining semantic segmentation loss data based on the semantic segmentation prediction data; determining update data by performing reverse gradient propagation on the sum value of the target detection loss data and the semantic segmentation loss data; updating the target detection network and the semantic segmentation network based on the update data; before determining target detection prediction data and semantic segmentation prediction data of a first defect target through a first to-be-detected target dataset by using an alternative detection model, the method further comprises: performing target detection labeling and semantic segmentation labeling on image data corresponding to the first to-be-detected target; performing data enhancement on the labeled image data to determine the first to-be-detected target dataset; after determining a target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, the method further comprises: determining that the target detection model comprises the updated target detection network, or the updated semantic segmentation network, or the updated target detection network and the updated semantic segmentation network based on a preset detection requirement of the first defect target. 2.The method of claim 1, wherein, before determining target detection prediction data and semantic segmentation prediction data of a first defect target through a first to-be-detected target dataset by using an alternative detection model, the method further comprises: replacing an initial prediction network connected to an output end of the backbone network in the initial detection model with a feature extraction structure, wherein the feature extraction structure is used for performing feature fusion on feature maps in the backbone network; determining the alternative detection model based on the backbone network, the feature extraction structure, the target detection network and the semantic segmentation network. 3.The method of claim 2, wherein, In the step of determining a target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, the target detection model further comprises an updated feature extraction structure. 4.The method of claim 2, wherein, determining the alternative detection model based on the backbone network, the feature extraction structure, the target detection network and the semantic segmentation network comprises: An output end of the backbone network is communicatively connected to an input end of the feature extraction structure; An output end of the feature extraction structure is communicatively connected to an input end of the target detection network and an input end of the semantic segmentation network.
5. A device for training a defect detection model, characterized by, Comprise: The first training module is used for training the backbone network of the initial detection model based on an industrial detection data set, and the industrial detection data set is established according to a preset rule based on various detection images of industrial detection; The second training module is used for determining target detection prediction data and semantic segmentation prediction data of the first defect target through the first target data set to be detected by the alternative detection model, wherein the alternative detection model is determined based on the backbone network, the target detection network and the semantic segmentation network, the first target data set to be detected is an image with the first defect target, and the number of images of the first target data set to be detected is less than the number of images of the industrial detection data set; The updating module is used for determining the target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, and the target detection model comprises the backbone network, the updated target detection network and the updated semantic segmentation network; The determination of the target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data comprises: Determining target detection loss data based on the target detection prediction data; Determining semantic segmentation loss data based on the semantic segmentation prediction data; Determining updating data by reverse gradient propagation of the sum value of the target detection loss data and the semantic segmentation loss data; Updating the target detection network and the semantic segmentation network based on the updating data; Before the determination of the target detection prediction data and the semantic segmentation prediction data of the first defect target through the first target data set to be detected by the alternative detection model, the method further comprises: Performing target detection labeling and semantic segmentation labeling on the image data corresponding to the first target to be detected; Performing data enhancement on the labeled image data to determine the first target data set to be detected; After the determination of the target detection model corresponding to the first defect target based on the target detection prediction data and the semantic segmentation prediction data, the method further comprises: Determining that the target detection model comprises the updated target detection network, or the updated semantic segmentation network, or the updated target detection network and the updated semantic segmentation network based on the preset detection requirement of the first defect target. 6.A terminal device, comprising a memory and a processor, wherein the memory stores a computer program, and the terminal device is characterized in that, The processor executes the computer program to realize the steps of the training method of the defect detection model in any one of claims 1 to 4.
7. A computer storage medium, characterized in that The computer readable storage medium stores a computer program, and the computer program is executed by the processor to make the processor execute the steps of the training method of the defect detection model in any one of claims 1 to 4.
Citation Information
Patent Citations
Welding defect detection method and device, electronic equipment and storage medium
CN111862067A