Underground drainage blow-off pipeline defect detection method based on incremental learning
Through incremental learning-based methods and knowledge distillation technology, the Faster-RCNN model is trained incrementally, which solves the problem that the existing technology cannot adapt to the changes in defect types of underground drainage and sewage pipelines, and achieves efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510174494.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-10
AI Technical Summary
The existing technology cannot adapt to changes in the types of defects in underground drainage and sewage pipelines, resulting in the need to frequently retrain the model, consume a lot of manpower and computing power, and reduce work efficiency.
Using an incremental learning method, the Faster-RCNN model is incrementally trained by obtaining the initial data set and the incremental data set, and the information of the teacher model is extracted in combination with knowledge distillation technology to generate the target model to adapt to the new defect types.
It realizes the efficient learning ability in the ever-changing task environment, reduces the high computational cost of retraining the entire model, and improves the accuracy and efficiency of defect detection of underground drainage and sewage pipelines.
Smart Images

Figure CN120125960A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pipeline defect detection, and specifically to a method for detecting defects in underground drainage and sewage pipelines based on incremental learning. Background Art
[0002] Currently, the methods for detecting defects in underground drainage and sewage pipelines mainly include human eye recognition, methods based on machine learning, and methods based on convolutional neural networks (CNNs). Among them, the defect detection method based on convolutional neural networks (CNNs) is a more commonly used and accurate method. This comprehensive method usually uses CNNs to automatically extract image features and uses these features for the classification and localization of pipeline defects, so as to achieve the defect detection of underground drainage and sewage pipelines.
[0003] However, with the aging of materials, defect types that have not appeared before may gradually emerge. If CNNs are still used to detect them, retraining is required, which will consume a large amount of manpower and computing power and is not conducive to improving work efficiency. Summary of the Invention
[0004] Aiming at the deficiencies of the prior art, the present invention provides a method for detecting defects in underground drainage and sewage pipelines based on incremental learning, which solves the technical problem in the prior art that it is unable to adapt to changes in defect types.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A method for detecting defects in underground drainage and sewage pipelines based on incremental learning, comprising the following steps:
[0007] S1. Obtain defect images of the drainage and sewage pipelines and construct a defect image dataset, which includes an initial dataset, an incremental dataset, and a validation dataset;
[0008] S2. Use the initial dataset to train the Faster-RCNN model to obtain a teacher model;
[0009] S3. Use the incremental dataset to perform incremental training on the teacher model to obtain a student model;
[0010] S4. Extract the information of the teacher model through knowledge distillation technology and train the student model to obtain a target model;
[0011] S5. Evaluate the accuracy of the target model through the validation dataset.
[0012] Furthermore, the defective image dataset includes s types of defects, the initial dataset includes a types of defects, the incremental dataset includes s - a types of defects, and there are no identical defect types in the initial dataset and the incremental dataset. The validation dataset includes all defect types.
[0013] Furthermore, in step S2, it specifically includes the following steps:
[0014] S21. Determine the number of classification heads of the Faster-RCNN model according to the defect types in the initial dataset;
[0015] S22. Input the initial dataset into the Faster-RCNN model to obtain the first prediction result, where the first prediction result represents the defect type and its predicted bounding box in the defective image;
[0016] S23. Calculate the classification loss L of the Faster-RCNN model cls , and its calculation formula is:
[0017]
[0018] In the formula, N represents the total number of defective images in the initial dataset; C represents the total number of defect types in the initial dataset; y ic represents the c-th defect type in the i-th defective image; p ic represents the probability that the i-th defective image predicted by the Faster-RCNN model belongs to the c-th defect type;
[0019] S24. Calculate the regression loss L of the Faster-RCNN model reg , and its calculation formula is:
[0020]
[0021] Among them,
[0022]
[0023] In the formula, x ij represents the coordinates of the predicted bounding box of the i-th defective image predicted by the Faster-RCNN model; represents the coordinates of the true bounding box in the i-th defective image; smooth L1 represents the smooth loss function;
[0024] S25. Calculate the total loss L of the Faster-RCNN model total , and its calculation formula is:
[0025] L total = γ cls Lcls +γ reg L reg
[0026] In the formula, γ cls and γ reg respectively represent the weight coefficients of the classification loss and the regression loss;
[0027] S26. Perform backpropagation on the Faster-RCNN model according to the total loss L total to minimize the loss function, update the gradient, update the parameters, and adjust the learning rate;
[0028] S27. Repeat the above steps iteratively to obtain and save the teacher model.
[0029] Further, in step S3, it specifically includes the following steps:
[0030] S31. Freeze the feature extraction part of the teacher model and unfreeze the parameters of the RPN and the classification head;
[0031] S32. Input the incremental dataset into the RPN, and the classification head outputs the second prediction result;
[0032] S33. Calculate the classification loss, regression loss, and total loss of the teacher model;
[0033] S34. Perform backpropagation on the teacher model according to the total loss to minimize the loss function, update the gradient, update the parameters, and adjust the learning rate;
[0034] S35. Repeat the above steps iteratively to obtain and save the student model.
[0035] Further, in step S4, it specifically includes the following steps:
[0036] S41. Input the initial dataset and the incremental dataset into the teacher model, and output the first soft label, where the first soft label represents the confidence that the teacher model believes the input defective image belongs to each defect type;
[0037] S42. Input the initial dataset and the incremental dataset into the student model, and output the hard label and the second soft label, where the hard label represents the defect type that the student model believes the input defective image belongs to, and the second soft label represents the confidence that the student model believes the input defective image belongs to each defect type;
[0038] S43. Calculate the hard label loss, soft label loss, regression loss, and total loss of the student model;
[0039] S44. Perform backpropagation on the student model according to the total loss to minimize the loss function, update the gradient, update the parameters, and adjust the learning rate to generate the target model.
[0040] Furthermore, in step S43, the calculation formula for the soft label loss is as follows:
[0041]
[0042] In the formula, L soft represents the soft label loss; N represents the total number of defective images in the initial dataset and the incremental dataset; C represents the total number of defect types; z ic and x ic respectively represent the original predicted values of the teacher model and the student model for the i-th defective image belonging to the c-th defect category; z jc and x jc respectively represent the original predicted values of the teacher model and the student model for the j-th defective image belonging to the c-th defect category.
[0043] Furthermore, in step S5, it specifically includes the following steps:
[0044] S51: Input the validation dataset into the target model, and output the third prediction result, where the third prediction result represents the defect type and the position of the bounding box;
[0045] S52: Calculate the performance metrics of the learning model and denote them as the first performance metrics, where the first performance metrics include mAP, Precision, Recall, and F1-Score;
[0046] S53: Input the validation dataset into the teacher model, and output the fourth prediction result, where the fourth prediction result represents the defect type and the position of the bounding box;
[0047] S54: Calculate the performance metrics of the teacher model and denote them as the second performance metrics;
[0048] S55: Compare the first performance metrics and the second performance metrics, and evaluate the target model.
[0049] Furthermore, in step S52, the calculation formula for Precision is as follows:
[0050]
[0051] In the formula, Precision represents the precision rate; TP represents that the model predicts a positive sample and the actual label is also a positive sample; FP represents that the model predicts a positive sample, but the actual label is a negative sample;
[0052] The calculation formula for Recall is as follows:
[0053]
[0054] Where Recall represents the recall rate; FN represents the cases where the model predicts negative samples but the actual labels are positive samples.
[0055] The calculation formula of F1-Score is:
[0056]
[0057] Where F1-Score represents the F1 score.
[0058] Furthermore, in step S52, the calculation formula of mAP is:
[0059]
[0060] Where mAP represents the mean average precision; AP i represents the area under the precision and recall rate curve of the i-th defect type; N represents the total number of defect types.
[0061] Compared with the prior art, the present invention provides a method for detecting defects in underground drainage and sewage pipes based on incremental learning, which has the following beneficial effects:
[0062] 1. The present invention can maintain high learning ability in a changing task environment, while reducing the high computational cost brought by retraining the entire model. In this way, the present invention achieves high precision and high efficiency in detecting defects in underground drainage and sewage pipes, and solves the problem that existing algorithms cannot meet the growing data processing requirements and the increasing number of categories.
[0063] 2. After freezing the feature extraction part of the baseline model and performing incremental training, the present invention saves the updated model weights, which enables the student model to have the ability to adapt to incremental data while retaining the feature extraction ability of the baseline model, laying a foundation for subsequent knowledge distillation.
[0064] 3. The present invention not only verifies the performance of the student model on new tasks, but also ensures that it successfully inherits the knowledge of the teacher model, achieving efficient learning and adaptation ability. This step is crucial for ensuring the actual application effect of the model and also provides valuable feedback information for subsequent model improvement and optimization. In this way, the present invention can maintain high learning ability in a changing task environment while reducing the high computational cost brought by retraining the entire model, and finally achieve high precision and high efficiency in detecting defects in underground drainage and sewage pipes. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The drawings described herein are used to provide a further understanding of the present application, form a part of the present application, and the schematic embodiments and descriptions thereof are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:
[0066] Figure 1 This is a flowchart of a method for detecting defects in underground drainage and sewage pipelines based on incremental learning according to the present invention;
[0067] Figure 2 This is a flowchart of training the Faster-RCNN model according to the present invention;
[0068] Figure 3 This is a flowchart of training the teacher model according to the present invention;
[0069] Figure 4 This is a flowchart of training the student model according to the present invention;
[0070] Figure 5 This is a flowchart of evaluating the accuracy of the target model according to the present invention. Detailed implementation manners
[0071] To make the above objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation manners. Thereby, the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0072] Underground drainage and sewage pipelines are an important part of urban infrastructure and are widely used in fields such as drainage and sewage treatment. However, due to long-term burial of the pipelines, affected by natural aging, environmental changes, and human factors, problems such as cracking, blockage, and deformation often occur. The detection of underground drainage and sewage pipelines is very important in engineering applications, which is directly related to the safety and operation efficiency of urban infrastructure. Through regular detection, potential hazards such as pipeline damage, blockage, or leakage can be discovered in time, effectively preventing the occurrence of potential accidents, thereby ensuring public safety. In addition, pipeline detection can also identify problems in advance, reduce sudden failures and high repair costs, and improve the operation efficiency of the pipelines. It not only supports the sustainable development of the city, avoids functional failures caused by pipeline aging or damage, but also contributes to environmental protection, preventing pollution to the environment caused by the leakage of sewage or harmful substances. Traditional manual inspection and video playback analysis methods are inefficient and inaccurate, and it is difficult to comprehensively cover all pipelines. Therefore, there is an urgent need for an efficient and intelligent detection method to achieve automated monitoring and management of pipeline status. For this reason, as Figure 1 shown, the present invention proposes a method for detecting defects in underground drainage and sewage pipelines based on incremental learning, including the following steps:
[0073] S1. Obtain defect images of drainage and sewage pipes and construct a defect image dataset, where the defect image dataset includes an initial dataset, an incremental dataset, and a validation dataset. Specifically, extract several defect images from the manually controlled closed-circuit television (CCTV) video data as training data, and label the defect types in each image to generate sample labels. The training data and sample labels constitute the defect image dataset. Among them, the defect image dataset includes s types of defects, the initial dataset includes a types of defects, the incremental dataset includes s - a (a < s) types of defects, and the initial dataset and the incremental dataset do not contain the same defect types. The validation dataset includes all defect types.
[0074] S2. Use the initial dataset to train the Faster-RCNN model to obtain a teacher model. Specifically, since the traditional Faster-RCNN model requires a large amount of training data to retrain the entire model when facing new categories or new samples, it will consume a large amount of time and computing resources. Moreover, when the traditional Faster-RCNN model processes new data, it may lead to a decrease in the learning ability of old data (i.e., catastrophic forgetting), resulting in a decrease in accuracy. In addition, as the types of defects in underground drainage and sewage pipes increase, continuously using traditional methods to update the Faster-RCNN model will become increasingly complex and difficult to manage. Therefore, as Figure 2 shown, in step S2, it specifically includes the following steps:
[0075] S21. Determine the number of classification heads of the Faster-RCNN model according to the defect types in the initial dataset.
[0076] S22. Input the initial dataset into the Faster-RCNN model to obtain a first prediction result, where the first prediction result represents the defect type and its predicted bounding box in the defect image.
[0077] S23. Calculate the classification loss L cls of the Faster-RCNN model, and its calculation formula is:
[0078]
[0079] In the formula, N represents the total number of defect images in the initial dataset; C represents the total number of defect types in the initial dataset; y ic represents the c-th defect type in the i-th defect image; p ic represents the probability that the i-th defect image predicted by the Faster-RCNN model belongs to the c-th defect type.
[0080] S24. Calculate the regression loss L reg, and its calculation formula is:
[0081]
[0082] Wherein,
[0083]
[0084] In the formula, x ij represents the coordinates of the predicted bounding box in the i-th defective image predicted by the Faster-RCNN model; represents the coordinates of the ground truth bounding box in the i-th defective image; smooth L1 represents the smooth loss function;
[0085] S25. Calculate the total loss L of the Faster-RCNN model total , and its calculation formula is:
[0086] L total =γ cls L cls +γ reg L reg
[0087] In the formula, γ cls and γ reg respectively represent the weight coefficients of the classification loss and the regression loss; in the present invention, γ cls and γ reg are respectively taken as 1.2 and 1.1;
[0088] S26. Perform backpropagation on the Faster-RCNN model according to the total loss L total to minimize the loss function, update the gradient, update the parameters and adjust the learning rate; it should be noted that backpropagation, minimizing the loss function, updating the gradient, updating the parameters and adjusting the learning rate all belong to the prior art and will not be elaborated here;
[0089] S27. Repeat the above steps iteratively to obtain the teacher model and save it.
[0090] Specifically, during implementation, first select a suitable optimizer, and set hyperparameters such as the learning rate, momentum, and weight decay. Input the initial dataset into the Faster-RCNN model to output the first prediction result. Then, use the calculated classification loss and regression loss to calculate the gradient through backpropagation. After that, the optimizer will update the parameters of the network according to the calculated gradient to minimize the loss function. In each training step, first clear the gradient of the optimizer, then perform backpropagation to calculate the gradient, and update the network parameters. This process will be carried out in each training epoch until the performance of the model reaches the expectation or the training ends.
[0091] S3. Use the incremental dataset to perform incremental training on the teacher model to obtain the student model. Specifically, as the underground drainage and sewage pipes are used over time, due to the aging of materials, defect types that have not appeared before may gradually emerge. Retraining the Faster-RCNN model requires a large amount of manpower, time, and computing power. Therefore, the student model needs to have the ability to adapt to the above problems. For this reason, as Figure 3 shown, in step S3, it specifically includes the following steps:
[0092] S31. Freeze the feature extraction part of the teacher model and unfreeze the parameters of the RPN and classification head. Specifically, the feature extraction part of the teacher model is the convolutional layer. RPN represents the Region Proposal Network. When freezing the feature extraction part, the requires-grad attribute of the convolutional layer of the teacher model can be set to False to freeze the parameters, so as to retain the feature extraction ability of the teacher model.
[0093] S32. Input the incremental dataset into the RPN, and the classification head outputs the second prediction result.
[0094] S33. Calculate the classification loss, regression loss, and total loss of the teacher model. Specifically, the calculation methods for calculating the classification loss, regression loss, and total loss are the same as those in step S1.
[0095] S34. Perform backpropagation on the teacher model according to the total loss to minimize the loss function, update the gradient, update the parameters, and adjust the learning rate.
[0096] S35. Repeat the above steps iteratively to obtain the student model and save it.
[0097] In step S3 of the present invention, by freezing the feature extraction part of the benchmark model and performing incremental training, the updated model weights are saved, which enables the student model to have the ability to adapt to incremental data and at the same time retains the feature extraction ability of the benchmark model, laying a foundation for subsequent knowledge distillation.
[0098] S4. Extract the information of the teacher model through knowledge distillation technology and train the student model to obtain the target model. Specifically, after performing incremental training on the teacher model, the student model has the ability to identify newly added defect types. However, since the parameters of the RPN and classification head of the student model are different from those of the original teacher model, it may lose some ability to analyze the original defect types. For this reason, as Figure 4 shown, in step S4, it specifically includes the following steps:
[0099] S41. Input the initial dataset and the incremental dataset into the teacher model to output the first soft labels, where the first soft labels represent the confidence levels of the teacher model regarding the input defect images belonging to each defect type. Specifically, these soft labels provide data support for calculating the soft label loss in subsequent steps, thereby guiding the learning of the student model. Additionally, the main role of the soft labels is to help the student model learn more knowledge from the teacher model rather than simply imitating its decision boundary. By having the teacher model provide soft labels, the student model can learn more delicate feature representations and the relative relationships between categories. The soft labels can convey the confidence levels of the teacher model regarding the samples belonging to each category, which helps the student model understand which categories are more likely to be confused, thereby better capturing the nuances in the data. Compared with the learning method that only relies on hard labels, training based on soft labels can enable the student model to obtain better generalization performance because it not only learns to correctly classify known samples but also learns how to handle those ambiguous situations close to the decision boundary, which can effectively improve the generalization ability. Moreover, since the soft labels provide more context information, the student model is not easily overfitted to specific patterns in the training set but is more inclined to construct a more robust and general internal representation, which can reduce the overfitting risk of the student model.
[0100] S42. Input the initial dataset and the incremental dataset into the student model to output hard labels and the second soft labels, where the hard labels represent the defect types that the student model believes the input defect images belong to, and the second soft labels represent the confidence levels of the student model regarding the input defect images belonging to each defect type.
[0101] S43. Calculate the hard label loss, soft label loss, regression loss, and total loss of the student model. Specifically, the calculation formulas for the hard label loss, regression loss, and total loss are the same as those in step S1, while the soft label loss is different from the above calculation method and requires calculating the difference between the first soft labels and the second soft labels. Therefore, in step S43, the calculation formula for the soft label loss is:
[0102]
[0103] In the formula, L soft represents the soft label loss; N represents the total number of defect images in the initial dataset and the incremental dataset; C represents the total number of defect types; z ic and x ic respectively represent the original predicted values of the teacher model and the student model for the i-th defect image belonging to the c-th defect category; z jc and x jcThey respectively represent the original predicted values of the teacher model and the student model for the j-th defect image belonging to the c-th defect category; T represents the temperature parameter; specifically, T is used to control the smoothness of the probability distribution of the soft label, thereby helping the student model better capture the subtle differences between categories; when T > 1, the probability distribution becomes more uniform, making the differences between different categories less obvious; when T = 1, it reverts to the standard softmax output; when T < 1, the probability distribution becomes sharper, similar to a hard label.
[0104] S44. Perform backpropagation on the student model according to the total loss to minimize the loss function, update the gradient, update the parameters, and adjust the learning rate to generate the target model.
[0105] In step S4 of the present invention, through the knowledge distillation technology, the student model can effectively inherit the knowledge of the teacher model while adapting to the new task requirements, avoid catastrophic forgetting, and improve its own generalization ability and computational efficiency. This process ensures that the model can maintain high learning ability in a changing task environment, while reducing the high computational cost of retraining the entire model. And in this way, the present invention achieves high precision and high efficiency in the defect detection of underground drainage and sewage pipes, and solves the problem that existing algorithms cannot meet the growing data processing requirements and the increasing number of categories.
[0106] S5. Evaluate the accuracy of the target model through the validation dataset; specifically, before the target model is put into use, it is also necessary to evaluate the performance of the target model. For this purpose, as Figure 5 shown, in step S5, it specifically includes the following steps:
[0107] S51. Input the validation dataset into the target model and output the third prediction result, where the third prediction result represents the defect type and the position of the bounding box;
[0108] S52. Calculate the performance metrics of the learning model and denote them as the first performance metrics. The first performance metrics include mAP, Precision, Recall, and F1-Score; as a further implementation manner of the present invention, in step S52, the calculation formula for Precision is:
[0109]
[0110] In the formula, Precision represents the precision rate; TP represents that the model predicts a positive sample and the actual label is also a positive sample; FP represents that the model predicts a positive sample, but the actual label is a negative sample;
[0111] The calculation formula for Recall is:
[0112]
[0113] Where Recall represents the recall rate; FN represents that the model predicts a negative sample, but the actual label is a positive sample;
[0114] The calculation formula of F1-Score is:
[0115]
[0116] Where F1-Score represents the F1 score; specifically, if there is a defect in a defect image and the target model correctly detects the defect, it means that the defect image is a positive sample for this defect type; if there is no known defect type in a defect image, it means that the defect image is a negative sample for all known defect types.
[0117] As a further specific implementation manner of the present invention, in step S52, the calculation formula of mAP is:
[0118]
[0119] Where mAP represents the mean average precision; AP i represents the area under the precision and recall rate curve of the i-th defect type; N represents the total number of defect types.
[0120] S53. Input the validation data set into the teacher model, and output the fourth prediction result, where the fourth prediction result represents the defect type and the position of the bounding box;
[0121] S54. Calculate the performance index of the teacher model and record it as the second performance index;
[0122] S55. Compare the first performance index and the second performance index, and evaluate the target model; specifically, generally, the accuracy of the student model obtained by knowledge distillation will slightly decrease, but if the decrease is significant, it means that the training result is not good and the effect of knowledge distillation is not obvious. Therefore, preset values are set for each parameter, and then the difference between each parameter in the first performance index and the second performance index is calculated. If the difference is greater than the preset value, it means that the accuracy of the target model meets the expectation and can be put into use; otherwise, it cannot be put into use.
[0123] In step S5 of the present invention, not only is the performance of the student model on the new task verified, but it is also ensured that it successfully inherits the knowledge of the teacher model, achieving efficient learning and adaptability. This step is crucial for ensuring the actual application effect of the model and also provides valuable feedback information for subsequent model improvement and optimization. In this way, the present invention can maintain efficient learning ability in a changing task environment while reducing the high computational cost brought by retraining the entire model, and finally achieve high precision and high efficiency in underground drainage and sewage pipeline defect detection.
[0124] Those of ordinary skill in the art can understand that all or part of the steps in the above method embodiments can be completed by instructing relevant hardware through a program. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0125] The above embodiments have introduced the present invention in detail. Specific examples are used in this article to elaborate on the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A method for detecting underground drainage and sewage pipe defects based on incremental learning, characterized in that: The following steps are involved: S1. Obtain defect images of drainage and sewage pipes and construct a defect image dataset, which includes an initial dataset, an incremental dataset, and a verification dataset; S2. Use the initial data set to train the Faster-RCNN model to obtain the teacher model; S3, use the incremental data set to incrementally train the teacher model to obtain the student model; S4, extract the information of the teacher model through knowledge distillation technology and train the student model to obtain the target model; S5. Evaluate the accuracy of the target model using the validation dataset.
2. The underground drainage and sewage pipe defect detection method according to claim 1 is characterized in that: The defect image dataset includes s defect types, the initial dataset includes a defect types, the incremental dataset includes sa defect types, and the initial dataset and the incremental dataset do not contain the same defect types. The verification dataset includes all defect types.
3. The underground drainage and sewage pipe defect detection method according to claim 1 is characterized in that: In step S2, the following steps are specifically included: S21, determine the number of classification heads of the Faster-RCNN model according to the defect types in the initial data set; S22, inputting the initial data set into the Faster-RCNN model to obtain a first prediction result, where the first prediction result represents the defect type and its predicted bounding box in the defect image; S23. Calculate the classification loss L of the Faster-RCNN model cls , and its calculation formula is: Where N is the total number of defect images in the initial dataset; C is the total number of defect types in the initial dataset; y ic represents the cth defect type in the ith defect image; p ic represents the probability of the cth defect type in the i-th defect image predicted by the Faster-RCNN model; S24. Calculate the regression loss L of the Faster-RCNN model reg , and its calculation formula is: in, In the formula, x ij Represents the coordinates of the predicted bounding box in the i-th defect image predicted by the Faster-RCNN model; represents the coordinates of the true bounding box in the i-th defect image; smooth L1 represents the smooth loss function; S25. Calculate the total loss L of the Faster-RCNN model total , and its calculation formula is: L total =c cls L cls +g reg L reg In the formula, γ cls and γ reg Represent the weight coefficients of classification loss and regression loss respectively; S26. According to the total loss L total Backpropagate the Faster-RCNN model to minimize the loss function, update gradients, update parameters, and adjust the learning rate; S27. Repeat the above steps to obtain the teacher model and save it.
4. The underground drainage and sewage pipe defect detection method according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31, freeze the feature extraction part of the teacher model, and unfreeze the parameters of the RPN and classification head; S32, input the incremental data set into the RPN, and the classification head outputs the second prediction result; S33, calculate the classification loss, regression loss and total loss of the teacher model; S34, back-propagating the teacher model according to the total loss to minimize the loss function, update the gradient, update the parameters and adjust the learning rate; S35. Repeat the above steps to obtain the student model and save it.
5. The underground drainage and sewage pipe defect detection method according to claim 1, characterized in that: In step S4, the following steps are specifically included: S41, inputting the initial data set and the incremental data set into the teacher model, and outputting a first soft label, where the first soft label indicates the confidence of the teacher model that the input defect image belongs to each defect type; S42, inputting the initial data set and the incremental data set into the student model, outputting a hard label and a second soft label, wherein the hard label indicates the defect type that the student model believes the input defect image belongs to, and the second soft label indicates the confidence that the student model believes the input defect image belongs to each defect type; S43, calculate the hard label loss, soft label loss, regression loss and total loss of the student model; S44. Backpropagate the student model according to the total loss to minimize the loss function, update the gradient, update the parameters and adjust the learning rate to generate the target model.
6. The underground drainage and sewage pipe defect detection method according to claim 5 is characterized in that: In step S43, the soft label loss is calculated as: Where, L soft represents the soft label loss; N represents the total number of defect images in the initial dataset and the incremental dataset; C represents the total number of defect types; z ic and x ic They represent the original prediction values of the teacher model and the student model for the i-th defect image belonging to the c-th defect category; z jc and x jc They respectively represent the original prediction values of the teacher model and the student model for the j-th defect image belonging to the c-th defect category.
7. The underground drainage and sewage pipe defect detection method according to claim 1, characterized in that: In step S5, the following steps are specifically included: S51, inputting the verification data set into the target model, and outputting a third prediction result, where the third prediction result indicates the defect type and the position of the bounding box; S52, calculating the performance index of the learning model and recording it as the first performance index, the first performance index includes mAP, Precision, Recall, and F1-Score; S53, inputting the verification data set into the teacher model, and outputting a fourth prediction result, where the fourth prediction result indicates the defect type and the position of the bounding box; S54, calculating the performance index of the teacher model and recording it as the second performance index; S55. Compare the first performance indicator and the second performance indicator, and evaluate the target model.
8. The underground drainage and sewage pipe defect detection method according to claim 7 is characterized in that: In step S52, the calculation formula of Precision is: In the formula, Precision represents the accuracy; TP represents that the model predicts a positive sample and the actual label is also a positive sample; FP represents that the model predicts a positive sample, but the actual label is a negative sample; The calculation formula of Recall is: In the formula, Recall represents the recall rate; FN represents that the model predicts a negative sample, but the actual label is a positive sample; The calculation formula of F1-Score is: Where, F1-Score represents the F1 score.
9. The underground drainage and sewage pipe defect detection method according to claim 7, characterized in that: In step S52, the calculation formula of mAP is: In the formula, mAP represents the mean average precision; AP i represents the area under the precision and recall curves of the i-th defect type; N represents the total number of defect types.