An industrial detection method based on a progressive network
By using a progressive network method to select datasets and combining old task parameters to train new tasks, the problems of low model update efficiency and catastrophic forgetting in industrial inspection are solved, achieving efficient model updates and improved accuracy.
Patent Information
- Application Number
- CN202410779598.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-06-17
AI Technical Summary
In industrial inspection, as the number of defect sample data continues to increase, the efficiency of network model updates is low and catastrophic amnesia is prone to occur. Existing technologies are unable to efficiently utilize historical and new data for model training.
We employ a progressive network approach, which optimizes the network structure, reduces data redundancy, and avoids catastrophic forgetting by selecting datasets and training the network together with the parameters from the old task and the new task.
It improves the efficiency of model updates and detection accuracy, reduces training time and data storage overhead, and is suitable for multiple optimization training scenarios in industrial inspection.
Smart Images

Figure CN118799270B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, and mainly relates to the optimization of training data and methods in deep learning. Background Technology
[0002] Currently, deep learning has been widely applied in fields such as computer vision, natural language processing, autonomous driving, and medical diagnostics. Relying on abundant data samples and the powerful algorithmic representation capabilities of machine vision, deep learning has become the mainstream inspection method in industrial inspection. However, in actual industrial inspection processes, the collection of defect sample data is an ongoing process accompanying industrial production. As the number of collected samples increases, the network update time also increases proportionally, which often affects the efficiency of network model updates.
[0003] In the field of industrial defect detection, achieving good detection results requires a large amount of defect data to be input into the neural network for training. Jointly training the model by accumulating each collected defect sample with samples from all previous tasks presents a significant challenge in terms of model update efficiency and data storage overhead. Furthermore, when updating the detection model, if the new data differs significantly from the original data, the deep learning model often destroys the knowledge learned from previous tasks, resulting in catastrophic forgetting. Currently, incremental learning is commonly used to address this problem, preserving the knowledge learned from old tasks while accelerating the learning of new tasks. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides an industrial inspection method based on progressive networks. Before model updates, data utilization is improved by effectively filtering newly added data samples. During model optimization training, the progressive network is used to overlay previously learned knowledge into the training of the network for the current new task, effectively avoiding catastrophic forgetting and improving the network's learning efficiency.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] An industrial inspection method based on progressive networks includes the following steps:
[0007] Step S1: Use the first batch of collected data to train the initial model;
[0008] Step S2: Use mAP to filter the dataset to obtain a new dataset and perform iterative filtering;
[0009] Step S3: By comparing the AP of each defect class and the mAP of all classes in the previous task dataset, determine how much data to add to the new task dataset and perform iterative training until the training of each layer of the network parameters for the new task is completed.
[0010] As a further aspect of the present invention, the effectiveness of the target defect training is determined by examining the average precision value of each class and the average AP of all classes after training is completed.
[0011] As a further aspect of this invention, if the AP of the defective class in the old task dataset is greater than the mAP of all classes, it indicates that the training effect of the defective class is better than that of other classes. In the next training, only a small portion of the old data needs to be extracted proportionally and added to the new dataset for training. If the AP of the defective class in the original data is less than the mAP of all classes, it indicates that the training effect of the class is lower than the overall level. In this case, all the data of the class is retained and directly added to the new dataset for training.
[0012] As a further aspect of the present invention, for negative samples existing in the old task dataset, a portion is selected and added to the new dataset according to the size ratio of the newly generated dataset; the selected old data and the newly added data are merged together to form a new dataset, which is then fed into the network for training.
[0013] As a further aspect of the present invention, when updating the network model, the input of the next module for the new task will be jointly determined by the network trained in the previous task and the previous module of the current network, and so on, to complete the training of the network parameters of each layer for the new task.
[0014] As a further aspect of this invention, when applied to the deep learning industrial detection network YOLOv5, the model weight parameters trained on the previous task are only added to the backbone part of the new task network. Each Conv and C3 of the backbone is treated as an updated module and jointly regulated by the old and new task parameters; the neck and head parts of the network remain unchanged.
[0015] The present invention has the following beneficial effects:
[0016] This invention employs an industrial inspection method based on progressive networks. It reduces redundancy in the training dataset by using data filtering, thereby improving the efficiency of model updates. The progressive network training method determines the current model update based on the network parameters from the previous task and the current network parameters. This reduces catastrophic forgetting in the network and improves the model's detection accuracy even with a continuously decreasing sample size. This method is suitable for industrial inspection scenarios in production where inspection data and models are constantly updated.
[0017] This invention proposes an industrial inspection method based on progressive networks. In the data processing stage, the method compares the AP value of each category with the mAP of all categories in the previous task to determine whether the data from the previous task needs to be used for training the current task. Then, the filtered data and newly added data are combined to form the current training dataset. During training, the parameters optimized from the previous task are superimposed with the parameters for the current task to jointly determine the direction of network parameter optimization for the current task. This scheme simultaneously optimizes the training data and network structure, improving data utilization efficiency, mitigating the problem of catastrophic forgetting during network training, and improving model update efficiency. This invention is applicable to multiple optimization training of networks in industrial inspection and has a certain degree of universality; it solves the problem that in industrial inspection, data updates require training with all data, and the continuous accumulation of historical data leads to an increasing model training time and data storage overhead.
[0018] To more clearly illustrate the structural features and effects of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0019] Figure 1 This is the overall framework diagram mentioned in the embodiments of the present invention.
[0020] Figure 2a , Figure 2b This is a data filtering flowchart mentioned in an embodiment of the present invention.
[0021] Figure 3 This is the progressive network framework diagram mentioned in the embodiments of the present invention.
[0022] Figure 4a , Figure 4b This is a diagram of the network training results mentioned in an embodiment of the present invention. Detailed Implementation
[0023] The present invention will now be further described in conjunction with the accompanying drawings and relevant knowledge, and will be described clearly and completely. Obviously, the described applications are only some embodiments of the present invention, and not all embodiments.
[0024] To address the problem in industrial inspection where the ever-increasing volume of data leads to massive training data and prolonged training time, this invention proposes an industrial inspection method based on progressive networks. For each new data entry, the results of the previous task's training are used to assess the impact of each defect category on the overall training, determining whether to retain a large amount of data for continued training. Furthermore, to prevent catastrophic forgetting during iterative updates, weights from the previous task are added to the network structure for the new task, participating in the new network's training. This approach shortens the network update and training time while maintaining the model's detection accuracy.
[0025] Reference Figures 1-4b As shown, the present invention provides an industrial inspection method based on progressive networks, comprising the following steps:
[0026] Step S1: Train the initial model using the first batch of collected data. Specifically, for situations where defect data in industrial inspection is constantly updated, first, train the initial model using the first batch of collected data. The effectiveness of the target defect training is judged by examining the average precision (AP) for each class and the mean average precision (mAP) for all classes after training.
[0027] Step S2: Use mAP to filter the dataset to obtain a new dataset and perform iterative filtering; In this invention, in order to achieve a balance between different categories of data during training and ensure that each category of data achieves a relatively good training effect, mAP is used to filter the dataset.
[0028] Step S3: The amount of data to add to the new task dataset is determined by comparing the AP of each defect class with the mAP of all classes in the previous task dataset, and this process is repeated until the network parameters for each layer of the new task are trained. Specifically: If the AP of a defect class in the old task dataset is greater than the mAP of all classes, it indicates that the training performance of that defect class is better than other classes. In the next training iteration, only a small portion of the old data needs to be proportionally extracted and added to the new dataset for training. If the AP of a defect class in the original data is less than the mAP of all classes, it indicates that the training performance of that class is lower than the overall level. In this case, all data for that class is retained and directly added to the new dataset for training. For negative samples in the old task dataset, a portion is selected and added to the new dataset according to the size ratio of the newly generated dataset. The selected old data and the newly added data are merged together to form a new dataset, which is then fed into the network for training.
[0029] This invention updates the network model by combining the input of the next module for the new task with the input of the network trained on the previous task and the previous module of the current network, and so on, to train the parameters of each layer of the network for the new task. In some embodiments, taking the common deep learning industrial detection network YOLOv5 as an example, the model weights trained on the previous task are only added to the backbone of the new task network. Each Conv and C3 of the backbone is treated as an updated module, controlled by both the old and new task parameters. The neck and head of the network remain unchanged. Subsequent model updates, except for the first trained network, follow this method.
[0030] In this invention, YOLOv5 is used as the detection model for training, as shown in Figures 2-4.
[0031] The data cost and model performance in subsequent network training are controlled through two steps: data screening and progressive network training. The detection model's accuracy is typically evaluated using mAP, which is jointly determined by precision and recall. Specifically, precision and recall can be defined as follows:
[0032]
[0033] Wherein, True Positive (TP): represents the number of instances that are actually positive and correctly classified as positive by the classifier. False Positive (FP): represents the number of instances that are actually negative but incorrectly classified as positive by the classifier. False Negatives (FN): represents the number of instances that are actually positive but incorrectly classified as negative by the classifier. True Negative (TN): represents the number of instances that are actually negative and correctly classified as negative by the classifier.
[0034] Let AP (Average Precision) represent the area between the horizontal and vertical axes of the PR curve.
[0035]
[0036] The mean average precision (mAP) of all classes can be calculated and expressed as follows:
[0037]
[0038] Where C represents the total number of categories, AP i Let represent the AP of class i.
[0039] In this invention, the data filtering process involves using the original dataset to complete the first round of network training, resulting in an initial model. The model's parameter file is then used to filter which classes of data are retained entirely and which are partially retained proportionally.
[0040] Specifically, as shown in the attached document Figure 2a Load the weight parameter file (best.pt) obtained from the previous task training. Obtain the AP for each category. i The value of AP is compared with that of class i. i The relationship between AP and mAP, if AP i If the threshold is greater than mAP, then the threshold will be set. i The value is assigned as 1 if the condition is not met, and 0 otherwise. (See attached image.) Figure 2b As shown, after comparing the AP for each category, the dataset trained on the previous task is loaded. It is then determined whether the category of the data exists in the defect class list `listC`. For data not in `listC`, a portion of the data is saved proportionally based on the size of the final new dataset. Data existing in `listC` and meeting the threshold `thred`... i For data greater than 0, a portion is saved according to a certain proportion; otherwise, all data is saved. Finally, the newly added data is merged with the filtered data to form a new dataset for model optimization and training.
[0041] As attached Figure 3 Model optimization training involves overlaying previously learned content onto the learning process for the new task. The backbone of the detection network has L modules. During the initial model training, the i-th module... It can be represented as Where, Θ (1) This represents the model parameters of the first network, and f represents the activation function of the hidden layer. After training the first network, a base model is obtained. When training the next task, the newly added data and the filtered old data are recombined into a dataset for training. For the new task, the model parameters Θ of the previous task are... (1) Frozen, new parameter Θ (2) Perform initialization, the first The network of layers simultaneously from and Receive parameters. For the k-th model and the i-th module. It can be represented as
[0042]
[0043] The input parameters of each module (C3 or Conv module) in the backbone are determined by the training parameters of the previous task and the output parameters of the previous layer module in the current task. By training on both new and old tasks, the network retains the content learned in the previous training while learning the latest data to the maximum extent, thereby achieving the goal of dynamically optimizing the network.
[0044] In this invention, reference is made to Figure 1 As shown, the first dataset, dataset1, is trained using YOLOv5. After training, the network weight parameters are saved in the file best1.pt. A portion of the data from dataset1 is selected for a second training iteration, and this selected data is merged with the newly added data to form dataset2. Dataset2 is then input into the network for training. During training, the new network determines the direction of optimization by combining the parameters of the previous and current networks. After training, the network weight parameters are saved in the file best2.pt. This process is repeated for each subsequent training iteration.
[0045] Reference Figure 4a and Figure 4b The figure shows the implementation results of the embodiments of the present invention;
[0046] The network was trained three times according to the above scheme. The training results are attached. Figure 4a The first training iteration used 1833 data pairs (images and their corresponding labels) to train the first model, taking 3.434 hours. The second training iteration used 643 data pairs selected from the first dataset and 47 newly added data pairs, taking 1.996 hours. The third training iteration used 450 data pairs selected from the second training iteration and 81 newly added data pairs, taking 1.639 hours. The results show that by filtering the data, the required data for each training iteration gradually decreased, and the training time also shortened accordingly. Figure 4b A comparison of the mAP for each defect class in the three tasks shows that although the training time decreased progressively, the detection accuracy improved gradually through the progressive network training method. In summary, by using data filtering and progressive network training, the model's detection accuracy can be continuously enhanced while increasing the model's update rate. This has significant application value for industrial inspection scenarios that require continuous updates to product defects.
[0047] In summary, this invention proposes an industrial inspection method based on progressive networks to alleviate this situation. During the data processing phase, the AP value of each category and the mAP of all categories in the previous task are compared to determine whether the data from the previous task needs to be used for training the current task. Then, the filtered data and newly added data are combined to form the current training dataset. During training, the parameters optimized from the previous task are superimposed with the parameters of the current task to jointly determine the direction of network parameter optimization for the current task. This scheme simultaneously optimizes the training data and network structure, improving data utilization efficiency, mitigating the problem of catastrophic forgetting during network training, and improving model update efficiency. This invention is applicable to multiple optimization training of networks in industrial inspection, possessing a certain degree of universality. It solves the problem that in industrial inspection, data updates require training with all data, and the continuous accumulation of historical data leads to an increasing model training time and data storage overhead.
[0048] The technical principles of the present invention have been described above with reference to specific embodiments, which are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments; all technical solutions falling within the scope of the present invention's concept are within its protection scope. Those skilled in the art can conceive of other specific embodiments of the present invention without creative effort, and these embodiments will all fall within the protection scope of the present invention.
Claims
1. A progressive network-based industrial detection method, applied to a deep learning industrial detection network YOLOv5, characterized in that, The process includes the following steps: Step S1: Train the initial model using the first batch of collected data, which consists of images and their corresponding labels. After the initial model training is completed, assess the training performance of each defect class by comparing its AP with the total mAP of all classes. Step S2: Perform a cyclical filtering of the old task dataset using the total mAP of all classes to obtain the filtered old task data. Step S3: Compare the AP of each defect class with the total mAP of all classes in the previous task dataset to determine the retention ratio of the old task data. Continue training until all network parameters for the new task are trained. If the AP of a defect class in the old task dataset is greater than the total mAP of all classes, it indicates that the training performance of that class is better than the average level, and the old task data of that class will be extracted proportionally in the next training iteration. If the AP of a defective class in the old task dataset is less than the mAP of all classes, it means that the training effect of that class is below average, so all old task data for that class are retained. For negative samples in the old task dataset, some data are selected according to the size ratio of the newly generated dataset. The selected old task data and the newly added data are merged to form a new dataset, which is then input into the network for training. The model weights obtained from the previous task training are only loaded into the backbone part of the new task network. Each Conv module and C3 module in the backbone is used as an update module. The network neck and head parts remain unchanged. When updating the network model, the input of the update module is determined by the network output completed by the previous task training and the output of the previous module of the current network. The new task network parameters are trained layer by layer.
Citation Information
Patent Citations
Sample incremental learning method based on deep neural network
CN114529752A
Neural network training method and system and neural network model evaluation method
CN115438785A
