Foggy day insulator defect detection method and device, electronic equipment and storage medium
By using pre-trained YOLO model and domain classifier to detect defects on insulator image data in foggy days, the problem of insulator defect detection under foggy days is solved, the cost of data labeling is reduced, the detection accuracy and efficiency are improved, and the safety of the power system is improved. sex.
Patent Information
- Application Number
- CN202411399149.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-10-09
AI Technical Summary
Under foggy conditions, it is difficult for the existing technology to effectively detect insulator defects, mainly due to the difference in image feature distribution between sunny and foggy days, the performance of the detection model declines, and the calculation cost of defogging algorithm is high and cannot fundamentally solve the problem of feature distribution changes.
By obtaining the training set, including defective labeled insulator image data in sunny conditions and defect-free labeled insulator image data in foggy conditions, the pre-trained YOLO model and domain classifier are used to domain classify image features to reduce the number of labeled data. Reliance on the data collection and labeling cost and improve detection accuracy.
It realizes efficient and accurate insulator defect detection under foggy conditions, significantly improves detection accuracy and efficiency, and improves the operational safety and reliability of the power system.
Smart Images

Figure CN119067963A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power system inspection, and in particular to a method, device, electronic equipment and storage medium for detecting defects of insulators in foggy weather. Background Art
[0002] Insulators are key components in high-voltage power transmission systems, and their defects are one of the important factors leading to power system accidents. Therefore, defect detection of insulators is very important.
[0003] In clear weather conditions, due to the large amount of labeled data and various refined technologies, existing technologies can effectively identify and locate insulator defects. However, in severe weather conditions such as fog, insulator defect detection still faces huge challenges. This is mainly because the detection model trained with image data obtained on clear days suffers from severe performance degradation in foggy environments. The reason is that there is an obvious domain shift problem between clear days and foggy days, that is, there are significant differences in the distribution of image features obtained under different weather conditions.
[0004] Traditional methods to deal with the impact of fog are mainly to improve the visual clarity of images through image processing technology, such as defogging algorithms. Although this improves image quality to a certain extent, it is usually accompanied by high computational costs, and these methods cannot fundamentally solve the fundamental changes in the distribution of image features caused by weather changes. In addition, although training models directly on image data collected under foggy conditions can improve performance to a certain extent, the implementation of this method is limited by the extremely high cost of data collection and annotation. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for detecting insulator defects in foggy weather, so as to solve the problem of high computational cost caused by the defogging algorithm, reduce the dependence on a large amount of labeled data during model training, and realize efficient and accurate detection of insulator defects.
[0006] According to one aspect of the present invention, a method for detecting insulator defects in foggy weather is provided, the method comprising:
[0007] Acquire a training set, the training set comprising a source domain and a target domain, the source domain being a set of defect-marked insulator image data under sunny conditions, and the target domain being a set of defect-free insulator image data under foggy conditions with a preset concentration;
[0008] The pre-trained model is trained based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is a pre-trained YOLO model corresponding to when the target loss of the pre-trained model is less than or equal to a preset loss value, and the domain classifier is used to predict the domain classification result of the image feature information; the image feature information is feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain;
[0009] The target insulator image data corresponding to the preset concentration of fog is obtained, and defect detection is performed on the target insulator image data based on the target YOLO model to obtain an insulator defect detection result.
[0010] According to another aspect of the present invention, a device for detecting defects of insulators in foggy weather is provided, the device comprising:
[0011] A training set acquisition module, used to acquire a training set, wherein the training set includes a source domain and a target domain, wherein the source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration;
[0012] A training module, used for training the pre-trained model based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is a pre-trained YOLO model corresponding to a target loss of the pre-trained model that is less than or equal to a preset loss value, and the domain classifier is used to predict a domain classification result of the image feature information; the image feature information is feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain;
[0013] The prediction module is used to obtain target insulator image data corresponding to a preset concentration of fog, and perform defect detection on the target insulator image data based on the target YOLO model to obtain an insulator defect detection result.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for detecting insulator defects in foggy weather described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for detecting insulator defects in foggy weather as described in any embodiment of the present invention when executed.
[0019] The technical solution of the embodiment of the present invention obtains a training set, which includes a source domain and a target domain. The source domain is a set of defect-marked insulator image data under clear weather conditions, and the target domain is a set of non-defect-marked insulator image data under foggy conditions with a preset concentration. The data in the target domain of this training set is data without defect marking, which greatly reduces the dependence on a large amount of labeled data, and can significantly reduce the cost and workload of data collection and annotation in practical applications. The pre-trained model is further trained based on the training set to obtain the target YOLO model; because the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is the pre-trained YOLO model corresponding to the target loss of the pre-trained model when it is less than or equal to the preset loss value, and the domain classifier is used to predict the domain classification result of the image feature information; the image feature information is the feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain; the addition of the domain classifier during the training process effectively aligns the feature distribution between the source domain (sunny image) and the target domain (foggy image), and significantly reduces the domain offset problem caused by weather changes; thereby obtaining the target insulator image data corresponding to the preset concentration of fog, performing defect detection on the target insulator image data based on the target YOLO model, and obtaining the insulator defect detection result, thereby improving the detection accuracy and efficiency of insulator defects under foggy conditions, and improving the operation safety and reliability of the power system.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flow chart of a method for detecting defects of insulators in foggy weather provided according to an embodiment of the present invention;
[0023] Figure 2 is a flow chart of another method for detecting defects of insulators in foggy weather provided according to an embodiment of the present invention;
[0024] Figure 3 is a flow chart of another method for detecting defects of insulators in foggy weather provided according to an embodiment of the present invention;
[0025] Figure 4 is a flow chart of a method for detecting defects of insulators in foggy weather applicable to an embodiment of the present invention;
[0026] Figure 5 is a structural schematic diagram of a device for detecting defects of insulators in foggy weather provided according to an embodiment of the present invention;
[0027] Figure 6 It is a structural schematic diagram of an electronic device for implementing the method for detecting defects of insulators in foggy weather according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] Embodiment 1
[0031] Figure 1 A flow chart of a method for detecting insulator defects in foggy weather provided in an embodiment of the present invention. This embodiment can be applicable to the situation of predicting insulator defects in foggy weather. The method can be executed by an insulator defect detection device for foggy weather. The insulator defect detection device for foggy weather can be implemented in the form of hardware and / or software. The insulator defect detection device for foggy weather can be configured in any electronic device with network communication function.
[0032] like Figure 1 As shown, the method for detecting defects of insulators in foggy weather of the present invention comprises the following process:
[0033] S110, obtaining a training set, the training set including a source domain and a target domain, the source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration.
[0034] Specifically, the insulator image data of the source domain and the target domain can be collected by drones or fixed monitoring equipment. After collection, the defect of the insulator image data in the source domain is marked as data for model training. The insulator image data in the target domain does not need to be marked, which reduces the workload of marking data.
[0035] The defect label includes normalized bounding box center coordinates, width, and height information.
[0036] Optionally, obtaining a training set includes: obtaining first insulator image data, performing defect marking and first domain label marking on the first insulator image data to obtain the marked first insulator image data, and forming a set of the marked first insulator image data into a source domain; the first insulator image data is insulator image data under sunny conditions, and the first domain label is 0; obtaining second insulator image data, performing second domain label marking on the second insulator image data to obtain the marked second insulator image data, and forming a set of the marked second insulator image data into a source domain; the second insulator image data is insulator image data under foggy conditions with a preset concentration, and the second domain label is 1.
[0037] S120, training the pre-trained model based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier, the target YOLO model is a pre-trained YOLO model corresponding to a target loss of the pre-trained model that is less than or equal to a preset loss value, and the domain classifier is used to predict domain classification results of image feature information; the image feature information is feature information from global to local extracted from insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain.
[0038] The target loss can be understood as the sum of the loss corresponding to the pre-trained YOLO model and the loss corresponding to the domain classifier. The preset loss value can be understood as the maximum loss value of the detection result of the pre-trained model to achieve the preset accuracy.
[0039] Specifically, the pre-trained YOLO model in the pre-trained model extracts features from the insulator image data in the training set to obtain image feature information, and the domain classifier in the pre-trained model predicts the domain classification result of the image feature information, and further obtains the loss value of the domain classifier based on the domain classification result. At the same time, the pre-trained YOLO model in the pre-trained model also marks defects on the insulator image data in the source domain in the training set to obtain defect marking results, and obtains defect loss values based on the defect marking results and the defect marking of the insulator image data in the source domain. Further, the target loss of the pre-trained model is obtained based on the loss value of the domain classifier and the defect loss value. If the target loss is greater than the preset loss value, it means that the accuracy of the pre-trained model is still unqualified at this time, and the model parameters corresponding to the target loss need to be updated to the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continuously trained until the target loss is less than or equal to the preset loss value, indicating that the accuracy of the pre-trained model is qualified at this time, and the pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
[0040] S130, obtaining target insulator image data corresponding to a preset concentration of fog, performing defect detection on the target insulator image data based on a target YOLO model, and obtaining an insulator defect detection result.
[0041] Specifically, the target YOLO model is a model for different preset concentrations of fog. The target insulator image data is obtained, and the preset concentration of fog corresponding to the target insulator image data is determined. The target insulator image data is then input into the corresponding target YOLO model for defect detection to obtain accurate insulator defect detection results.
[0042] The technical solution of the embodiment of the present invention obtains a training set, which includes a source domain and a target domain. The source domain is a set of defect-marked insulator image data under clear weather conditions, and the target domain is a set of non-defect-marked insulator image data under foggy conditions with a preset concentration. The data in the target domain of this training set is data without defect marking, which greatly reduces the dependence on a large amount of labeled data, and can significantly reduce the cost and workload of data collection and annotation in practical applications. The pre-trained model is further trained based on the training set to obtain the target YOLO model; because the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is the pre-trained YOLO model corresponding to the target loss of the pre-trained model when it is less than or equal to the preset loss value, and the domain classifier is used to predict the domain classification result of the image feature information; the image feature information is the feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain; the addition of the domain classifier during the training process effectively aligns the feature distribution between the source domain (sunny image) and the target domain (foggy image), and significantly reduces the domain offset problem caused by weather changes; thereby obtaining the target insulator image data corresponding to the preset concentration of fog, performing defect detection on the target insulator image data based on the target YOLO model, and obtaining the insulator defect detection result, thereby improving the detection accuracy and efficiency of insulator defects under foggy conditions, and improving the operation safety and reliability of the power system.
[0043] Embodiment 2
[0044] Figure 2 A flow chart of another method for detecting insulator defects in foggy weather provided in an embodiment of the present invention. The technical solution of this embodiment further optimizes the process S120 in the aforementioned embodiment on the basis of the aforementioned embodiment. This embodiment can be combined with various optional solutions in one or more of the aforementioned embodiments.
[0045] like Figure 2 As shown, the method for detecting defects of insulators in foggy weather of the present invention comprises the following process:
[0046] S210, obtaining a training set, the training set including a source domain and a target domain, the source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration.
[0047] Specifically, the first insulator image data is obtained, the first insulator image data is defect-marked and the first domain label is marked to obtain the marked first insulator image data, and the marked first insulator image data set is composed of a source domain; the first insulator image data is the insulator image data under sunny conditions, and the first domain label is 0; the second insulator image data is obtained, the second insulator image data is marked with a second domain label to obtain the marked second insulator image data, and the marked second insulator image data set is composed of a source domain; the second insulator image data is the insulator image data under foggy conditions with a preset concentration, and the second domain label is 1.
[0048] In this embodiment, the domain classifier includes at least one image-level domain classifier and at least one instance-level domain classifier. The image-level domain classifier is used to process the feature distribution differences of the insulator image data at the global image level, and these features reflect the broad information of the overall image scene rather than the detailed information of a specific object.
[0049] The instance-level domain classifier is used to handle the differences in feature distribution of insulator image data at the local image level. Instance-level features are formed by layer-by-layer extraction and feature combination at deeper levels of the network. These features are more specific and usually related to specific object categories and tasks. The goal of the instance-level domain classifier is to make the feature distribution of insulator instances in different weather conditions more similar, especially in terms of shape, size, and edge definition.
[0050] The image-level domain classifier consists of a gradient reversal layer, a convolutional layer, a batch normalization layer, and an activation function, and the instance-level domain classifier consists of a gradient reversal layer, a fully connected layer, an activation function, and a Dropout layer.
[0051] In this embodiment, the pre-trained YOLO model includes a feature extractor, which includes at least one global feature extraction layer (Backbone) and at least one local feature extraction layer (Neck). The local feature extraction layer is located behind all global feature extraction layers and is used to further extract features output from the global feature extraction layer; the pre-trained YOLO model is also used to predict and mark defect features in insulator image data.
[0052] The number of global feature extraction layers is greater than or equal to the number of image-level domain classifiers, and the number of local feature extraction layers is greater than or equal to the number of instance-level domain classifiers.
[0053] Accordingly, before the target YOLO model is obtained by training the pre-trained model based on the training set, the method includes: selecting a first preset number of global feature extraction layers from at least one global feature extraction layer as the target global feature extraction layer, and selecting a second preset number of local feature extraction layers from at least one local feature extraction layer as the target local feature extraction layer; one target global feature extraction layer corresponds to one image-level domain classifier, and one target local feature extraction layer corresponds to one instance-level domain classifier. That is, if the feature data output by m global feature extraction layers is used, the number of corresponding image-level domain classifiers is also m; if the feature data output by n local feature extraction layers is used, the number of corresponding instance-level domain classifiers is also n.
[0054] S220, performing feature extraction on the insulator image data of the source domain based on each target global feature extraction layer in the pre-trained YOLO model, and obtaining first image feature information corresponding to the output of each target global feature extraction layer; the first image feature information is marked with a first domain label.
[0055] The first image feature information can be understood as the feature distribution of the insulator image data in the source domain at the global image level.
[0056] S230. Based on the image-level domain classifier corresponding to each target global feature extraction layer, perform feature extraction analysis on the first image feature information to obtain a first domain classification result output by the image-level domain classifier corresponding to each target local feature extraction layer; the first domain classification result is used to describe the probability value of the first image feature information belonging to the source domain or the target domain.
[0057] S240, performing feature extraction on the insulator image data of the target domain based on each target local feature extraction layer in the pre-trained YOLO model, and obtaining second image feature information corresponding to the output of each target local feature extraction layer; the second image feature information is marked with a second domain label.
[0058] The second image feature information can be understood as the feature distribution of the insulator image data of the target domain at the local image level.
[0059] S250. Based on the instance-level domain classifier corresponding to each target local feature extraction layer, perform feature extraction analysis on the second image feature information to obtain a second domain classification result output by the instance-level domain classifier corresponding to each target local feature extraction layer; the second domain classification result is used to describe the probability value of the second image feature information belonging to the source domain or the target domain.
[0060] S260, determining a first loss value of the image-level domain classifier based on the first domain classification result and the first domain label, determining a second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label, and taking the sum of the first loss value and the second loss value as the classification loss value of the domain classifier.
[0061] Specifically, there is a first corresponding relationship between the first domain classification result and the first domain label and the first loss value of the image-level domain classifier, and there is a second corresponding relationship between the second domain classification result and the second domain label and the second loss value of the instance-level domain classifier, then the first loss value of the image-level domain classifier is searched from the first corresponding relationship according to the first domain classification result and the first domain label; the second loss value of the instance-level domain classifier is searched from the second corresponding relationship according to the second domain classification result and the second domain label. Further, the first weight of the first loss value and the second weight of the second loss value are determined, and the classification loss value of the domain classifier is obtained based on the first loss value, the second loss value, the first weight of the first loss value and the second weight of the second loss value.
[0062] As an optional embodiment, determining a first loss value of an image-level domain classifier based on the first domain classification result and the first domain label includes: using the following formula to express the first loss value L of the image-level domain classifier: img :
[0063]
[0064] Among them, D i represents the domain label of the i-th insulator image data in the training set, and the domain label includes the first domain label and the second domain label. represents the predicted probability value of the mth image-level domain classifier at the position (x, y) in the i-th insulator image data in the training set, that is, the first domain classification result;
[0065] Accordingly, determining the second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label includes: using the following formula to express the first loss value L of the instance-level domain classifier ins :
[0066]
[0067] Among them, D i represents the domain label of the i-th insulator image data in the training set. The domain label includes the first domain label and the second domain label. i,n It represents the predicted probability value of the nth instance-level domain classifier of the i-th insulator image data in the training set, that is, the second domain classification result.
[0068] The technical solution of this embodiment adopts a loss calculation formula to determine the loss value, thereby achieving a more accurate calculation of the loss value.
[0069] S270. Input the insulator image data of the source domain in the training set into the pre-trained YOLO model to obtain a defect prediction result, and determine the detection loss value of the pre-trained YOLO model based on the defect prediction result and the insulator image data of the source domain; the defect prediction result is the prediction labeling result of the pre-trained YOLO model in the insulator image data of the source domain.
[0070] Specifically, the pre-trained YOLO model will mark defects in the insulator image data of the source domain to obtain defect prediction results, which include information such as the normalized bounding box center coordinates, width, and height. The detection loss of the pre-trained YOLO model mainly includes three parts: bounding box loss, confidence loss, and classification loss.
[0071] Bounding box loss: This part of the loss calculates the deviation between the predicted bounding box and the actual labeled bounding box. Pre-trained YOLO models usually use IOU (intersection over union) or more complex variants such as GIOU and CIOU to evaluate the degree of alignment between the predicted box and the true box.
[0072] Confidence loss: Evaluates the confidence of the pre-trained YOLO model in predicting whether the bounding box contains a defective object and compares it with the actual situation. If the predicted box correctly contains the defective object, the loss value is small; conversely, if the predicted box is incorrectly marked as containing a defective object or fails to identify the real object, the loss value increases.
[0073] Classification loss: If the predicted box correctly identifies the object, this part of the loss calculates the error between the predicted category and the actual category. This is usually implemented through cross entropy loss, which evaluates the difference between the model's predicted probability for each category and the actual label.
[0074] Furthermore, the bounding box loss, confidence loss, and classification loss are added together according to the weight ratio as the detection loss value of the pre-trained YOLO model.
[0075] S280, determining the target loss of the pre-trained model based on the classification loss value and the detection loss value, and when the target loss is greater than the preset loss value, updating the pre-trained YOLO model in the pre-trained model with the pre-trained YOLO model corresponding to the target loss, and continuing to train the pre-trained model based on the training set until the target loss is greater than the preset loss value, and taking the pre-trained YOLO model corresponding to the target loss of the pre-trained model when it is less than or equal to the preset loss value as the target YOLO model.
[0076] Specifically, the classification loss value and the detection loss value can be weighted and summed according to the weight ratio to obtain the target loss of the pre-trained model. When the target loss is greater than the preset loss value, the pre-trained YOLO model corresponding to the target loss is used to update the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continued to be trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
[0077] S290, obtaining target insulator image data corresponding to a preset concentration of fog, performing defect detection on the target insulator image data based on a target YOLO model, and obtaining an insulator defect detection result.
[0078] The technical solution of this embodiment obtains a training set, performs feature extraction on the insulator image data of the source domain based on each target global feature extraction layer in the pre-trained YOLO model, obtains the first image feature information corresponding to the output of each target global feature extraction layer, performs feature extraction analysis on the first image feature information based on the image-level domain classifier corresponding to each target global feature extraction layer, and obtains the first domain classification result output by the image-level domain classifier corresponding to each target local feature extraction layer; the first domain classification result is used to describe the probability value of the first image feature information belonging to the source domain or the target domain, and performs feature extraction on the insulator image data of the target domain based on each target local feature extraction layer in the pre-trained YOLO model, and obtains the second image feature information corresponding to the output of each target local feature extraction layer. Feature information, based on the instance-level domain classifier corresponding to each target local feature extraction layer, feature extraction analysis is performed on the second image feature information to obtain the second domain classification result output by the instance-level domain classifier corresponding to each target local feature extraction layer; the second domain classification result is used to describe the probability value of the second image feature information belonging to the source domain or the target domain, effectively aligning the feature distribution between the source domain (sunny image) and the target domain (foggy image), significantly reducing the domain shift problem caused by weather changes, further, based on the first domain classification result and the first domain label, the first loss value of the image-level domain classifier is determined, based on the second domain classification result and the second domain label, the second loss value of the instance-level domain classifier is determined, and the sum of the first loss value and the second loss value is used as the classification loss value of the domain classifier. The insulator image data of the source domain in the training set is input into the pre-trained YOLO model to obtain the defect prediction result, and the detection loss value of the pre-trained YOLO model is determined based on the defect prediction result and the insulator image data of the source domain. The target loss of the pre-trained model is determined based on the classification loss value and the detection loss value. When the target loss is greater than the preset loss value, the pre-trained YOLO model corresponding to the target loss is updated with the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continued to be trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model. The addition of the two losses improves the accuracy of the target YOLO model, so that the target insulator image data corresponding to the preset concentration of fog is subsequently obtained, and defect detection is performed on the target insulator image data based on the target YOLO model, so that accurate insulator defect detection results can be obtained, which improves the detection accuracy and efficiency of insulator defects under foggy conditions and improves the operation safety and reliability of the power system.
[0079] Embodiment 3
[0080] Figure 3This is a flow chart of another method for detecting defects in insulators in foggy weather provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process of S120 in the above embodiment on the basis of the above embodiment. This embodiment can be combined with various optional solutions in one or more of the above embodiments. The steps that are the same as those in the above embodiment are not described in detail.
[0081] like Figure 3 As shown, the method for detecting defects of insulators in foggy weather of the present invention comprises the following process:
[0082] S3101. Obtain a training set, where the training set includes a source domain and a target domain. The source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration.
[0083] S3102. Perform feature extraction on the insulator image data of the source domain based on each target global feature extraction layer in the pre-trained YOLO model to obtain first image feature information corresponding to the output of each target global feature extraction layer; the first image feature information is marked with a first domain label.
[0084] S3103. Based on the image-level domain classifier corresponding to each target global feature extraction layer, perform feature extraction analysis on the first image feature information to obtain a first domain classification result output by the image-level domain classifier corresponding to each target local feature extraction layer; the first domain classification result is used to describe the probability value of the first image feature information belonging to the source domain or the target domain.
[0085] S3104. Perform feature extraction on the insulator image data of the target domain based on each target local feature extraction layer in the pre-trained YOLO model to obtain second image feature information corresponding to the output of each target local feature extraction layer; the second image feature information is marked with a second domain label.
[0086] S3105. Based on the instance-level domain classifier corresponding to each target local feature extraction layer, perform feature extraction analysis on the second image feature information to obtain a second domain classification result output by the instance-level domain classifier corresponding to each target local feature extraction layer; the second domain classification result is used to describe the probability value of the second image feature information belonging to the source domain or the target domain.
[0087] S3106. Determine a first loss value of the image-level domain classifier based on the first domain classification result and the first domain label, determine a second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label, and use the sum of the first loss value and the second loss value as the classification loss value of the domain classifier.
[0088] S3107. Input the insulator image data of the source domain in the training set into the pre-trained YOLO model to obtain a defect prediction result, and determine the detection loss value of the pre-trained YOLO model based on the defect prediction result and the insulator image data of the source domain; the defect prediction result is the prediction labeling result of the pre-trained YOLO model in the insulator image data of the source domain.
[0089] S3108. Determine the total number of features in the first image feature information processed by each image-level domain classifier, and determine the consistency loss based on the total number of features, the first domain classification results, and the second domain classification results; the consistency loss is used to describe the difference in predictions of the image-level domain classifier and the instance-level domain classifier for the same feature in the same insulator image data.
[0090] Specifically, based on the total number of features, the first domain classification result, and the second domain classification result, the consistency loss is determined, including: the consistency loss L is expressed by the following formula: cst :
[0091]
[0092] Among them, |I m | represents the total number of features in the first image feature information processed by the m-th image-level domain classifier, represents the predicted probability value of the mth image-level domain classifier at the position (x, y) in the i-th insulator image data in the training set, that is, the first domain classification result, p i,n It represents the predicted probability value of the nth instance-level domain classifier of the i-th insulator image data in the training set, that is, the second domain classification result.
[0093] S3109. Determine the target loss of the pre-trained model based on the classification loss value, the consistency loss and the detection loss value. When the target loss is greater than the preset loss value, update the pre-trained YOLO model in the pre-trained model with the pre-trained YOLO model corresponding to the target loss. Continue to train the pre-trained model based on the training set until the target loss is greater than the preset loss value. Then, use the pre-trained YOLO model corresponding to the target loss of the pre-trained model when it is less than or equal to the preset loss value as the target YOLO model.
[0094] Specifically, the target loss of the pre-training model is determined based on the classification loss value, consistency loss, and detection loss value, which can be expressed as:
[0095] L total =L det +λ 1 (L img +L ins )+λ 2 L cst ;
[0096] Among them, λ 1 and λ 2 Represent the weights of classification loss value and consistency loss respectively.
[0097] like Figure 4 As shown, when the target loss is greater than the preset loss value, the pre-trained YOLO model corresponding to the target loss is updated with the pre-trained YOLO model in the pre-trained model, that is, the model parameters are updated by back propagation, and the pre-trained model with updated network parameters is continued to be trained based on the training set until the target loss is greater than the preset loss value, and the pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
[0098] S3110, obtaining target insulator image data corresponding to a preset concentration of fog, performing defect detection on the target insulator image data based on a target YOLO model, and obtaining an insulator defect detection result.
[0099] The technical solution of this embodiment is to obtain a training set, perform feature extraction on the insulator image data of the source domain based on each target global feature extraction layer in the pre-trained YOLO model, obtain the first image feature information corresponding to the output of each target global feature extraction layer, perform feature extraction and analysis on the first image feature information based on the image-level domain classifier corresponding to each target global feature extraction layer, and obtain the first domain classification result output by the image-level domain classifier corresponding to each target local feature extraction layer; perform feature extraction on the insulator image data of the target domain based on each target local feature extraction layer in the pre-trained YOLO model, obtain the second image feature information corresponding to the output of each target local feature extraction layer, perform feature extraction and analysis on the second image feature information based on the instance-level domain classifier corresponding to each target local feature extraction layer, and obtain the second domain classification result output by the instance-level domain classifier corresponding to each target local feature extraction layer; further, determine the first loss value of the image-level domain classifier based on the first domain classification result and the first domain label, determine the second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label, and use the sum of the first loss value and the second loss value as the classification loss value of the domain classifier. The insulator image data of the source domain in the training set is input into the pre-trained YOLO model to obtain the defect prediction result, and the detection loss value of the pre-trained YOLO model is determined based on the defect prediction result and the insulator image data of the source domain. The total number of features in the first image feature information processed by each image-level domain classifier is determined, and the consistency loss is determined based on the total number of features, the first domain classification result and the second domain classification result; the consistency loss is used to describe the prediction difference between the image-level domain classifier and the instance-level domain classifier for the same feature in the same insulator image data. The target loss of the pre-trained model is determined based on the classification loss value, the consistency loss and the detection loss value. When the target loss is greater than the preset loss value, the pre-trained YOLO model corresponding to the target loss is updated with the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continued to be trained based on the training set until the target loss is greater than the preset loss value, and the pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model. The addition of the three losses improves the accuracy of the target YOLO model, so that the target insulator image data corresponding to the preset concentration of fog can be obtained later. Defect detection of the target insulator image data is performed based on the target YOLO model, and accurate insulator defect detection results can be obtained, which improves the detection accuracy and efficiency of insulator defects under foggy conditions and improves the operation safety and reliability of the power system.
[0100] Embodiment 4
[0101] Figure 5This is a structural schematic diagram of a device for detecting defects in insulators in foggy weather provided according to an embodiment of the present invention. This embodiment can be applied to the situation of predicting defects in insulators in foggy weather. The device for detecting defects in insulators in foggy weather can be implemented in the form of hardware and / or software. The device for detecting defects in insulators in foggy weather can be configured in any electronic device with network communication function.
[0102] like Figure 5 As shown, the foggy weather insulator defect detection device of the present invention comprises:
[0103] A training set acquisition module 410 is used to acquire a training set, wherein the training set includes a source domain and a target domain, wherein the source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration;
[0104] A training module 420 is used to train the pre-trained model based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is a pre-trained YOLO model corresponding to when the target loss of the pre-trained model is less than or equal to a preset loss value, and the domain classifier is used to predict the domain classification result of the image feature information; the image feature information is feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain;
[0105] The prediction module 430 is used to obtain target insulator image data corresponding to a preset concentration of fog, and perform defect detection on the target insulator image data based on the target YOLO model to obtain an insulator defect detection result.
[0106] On the basis of the above embodiment, optionally, a training set acquisition module is used to: acquire first insulator image data, perform defect marking and first domain label marking on the first insulator image data to obtain the marked first insulator image data, and form the marked first insulator image data set into the source domain; the first insulator image data is the insulator image data under sunny conditions, and the first domain label is 0; acquire second insulator image data, perform second domain label marking on the second insulator image data to obtain the marked second insulator image data, and form the marked second insulator image data set into the source domain; the second insulator image data is the insulator image data under foggy conditions with a preset concentration, and the second domain label is 1.
[0107] On the basis of the above embodiment, optionally, the domain classifier includes at least one image-level domain classifier and at least one instance-level domain classifier, the image-level domain classifier is used to process the feature distribution difference of the insulator image data at the global image level, the instance-level domain classifier is used to process the feature distribution difference of the insulator image data at the local image level, the image-level domain classifier is composed of a gradient reversal layer, a convolution layer, a batch normalization layer and an activation function, and the instance-level domain classifier is composed of a gradient reversal layer, a fully connected layer, an activation function and a Dropout layer;
[0108] The pre-trained YOLO model includes a feature extractor, which includes at least one global feature extraction layer and at least one local feature extraction layer, wherein the local feature extraction layer is located behind all global feature extraction layers and is used to further extract features output from the global feature extraction layer; the pre-trained YOLO model is also used to predict and mark defect features in insulator image data;
[0109] The number of the global feature extraction layers is greater than or equal to the number of the image-level domain classifiers, and the number of the local feature extraction layers is greater than or equal to the number of the instance-level domain classifiers.
[0110] Based on the above embodiment, optionally, the training module includes a selection unit, which is used to: select a first preset number of global feature extraction layers from the at least one global feature extraction layer as target global feature extraction layers, and select a second preset number of local feature extraction layers from the at least one local feature extraction layer as target local feature extraction layers; one of the target global feature extraction layers corresponds to an image-level domain classifier, and one of the target local feature extraction layers corresponds to an instance-level domain classifier.
[0111] Based on the above embodiment, optionally, the training module includes a first training unit, and the first training unit is used to:
[0112] Based on each of the target global feature extraction layers in the pre-trained YOLO model, feature extraction is performed on the insulator image data of the source domain to obtain first image feature information corresponding to the output of each target global feature extraction layer; the first image feature information is marked with a first domain label;
[0113] Based on the image-level domain classifier corresponding to each of the target global feature extraction layers, feature extraction analysis is performed on the first image feature information to obtain a first domain classification result output by the image-level domain classifier corresponding to each of the target local feature extraction layers; the first domain classification result is used to describe the probability value of the first image feature information belonging to the source domain or the target domain;
[0114] Based on each target local feature extraction layer in the pre-trained YOLO model, feature extraction is performed on the insulator image data of the target domain to obtain second image feature information corresponding to the output of each target local feature extraction layer; the second image feature information is marked with a second domain label;
[0115] Based on the instance-level domain classifier corresponding to each of the target local feature extraction layers, feature extraction analysis is performed on the second image feature information to obtain a second domain classification result output by the instance-level domain classifier corresponding to each of the target local feature extraction layers; the second domain classification result is used to describe the probability value of the second image feature information belonging to the source domain or the target domain;
[0116] Determine a first loss value of the image-level domain classifier based on the first domain classification result and the first domain label, determine a second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label, and use the sum of the first loss value and the second loss value as the classification loss value of the domain classifier;
[0117] Inputting the insulator image data of the source domain in the training set into the pre-trained YOLO model to obtain a defect prediction result, and determining the detection loss value of the pre-trained YOLO model based on the defect prediction result and the insulator image data of the source domain; the defect prediction result is a prediction labeling result of the pre-trained YOLO model in the insulator image data of the source domain;
[0118] The target loss of the pre-trained model is determined based on the classification loss value and the detection loss value. When the target loss is greater than a preset loss value, the pre-trained YOLO model corresponding to the target loss is used to update the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continuously trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
[0119] Based on the above embodiment, optionally, the first loss value L of the image-level domain classifier is expressed by the following formula: img :
[0120]
[0121] Among them, D i represents the domain label of the i-th insulator image data in the training set, and the domain label includes the first domain label and the second domain label. represents the predicted probability value of the mth image-level domain classifier at the position (x, y) in the i-th insulator image data in the training set, that is, the first domain classification result;
[0122] Accordingly, the first loss value L of the instance-level domain classifier is expressed as follows: ins :
[0123]
[0124] Among them, D i represents the domain label of the i-th insulator image data in the training set. The domain label includes the first domain label and the second domain label. i,n It represents the predicted probability value of the nth instance-level domain classifier of the i-th insulator image data in the training set, that is, the second domain classification result.
[0125] Based on the above embodiment, optionally, the training module includes a second training unit, and the second training unit is used to:
[0126] Determining the total number of features in the first image feature information processed by each of the image-level domain classifiers;
[0127] Determine a consistency loss based on the total number of features, the first domain classification result, and the second domain classification result; the consistency loss is used to describe the difference in predictions of the image-level domain classifier and the instance-level domain classifier for the same feature in the same insulator image data;
[0128] The target loss of the pre-trained model is determined based on the classification loss value, the consistency loss and the detection loss value. When the target loss is greater than a preset loss value, the pre-trained YOLO model corresponding to the target loss is used to update the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continuously trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
[0129] The foggy weather insulator defect detection device provided by the embodiment of the present invention can execute the foggy weather insulator defect detection method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0130] Embodiment 5
[0131] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0132] Figure 6The structural schematic diagram of an electronic device that can be used to implement the foggy insulator defect detection method of an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0133] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0134] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0135] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the foggy weather insulator defect detection method.
[0136] In some embodiments, the method for detecting insulator defects in foggy weather may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method for detecting insulator defects in foggy weather described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the method for detecting insulator defects in foggy weather in any other appropriate manner (e.g., by means of firmware).
[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0138] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0139] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0140] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0141] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0142] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0144] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting insulator defects in foggy weather, characterized in that: The method comprises: Acquire a training set, the training set comprising a source domain and a target domain, the source domain being a set of defect-marked insulator image data under sunny conditions, and the target domain being a set of defect-free insulator image data under foggy conditions with a preset concentration; The pre-trained model is trained based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is a pre-trained YOLO model corresponding to when the target loss of the pre-trained model is less than or equal to a preset loss value, and the domain classifier is used to predict the domain classification result of the image feature information; the image feature information is feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain; The target insulator image data corresponding to the preset concentration of fog is obtained, and defect detection is performed on the target insulator image data based on the target YOLO model to obtain an insulator defect detection result.
2. The method according to claim 1, characterized in that Get the training set, including: Acquire first insulator image data, perform defect marking and first domain label marking on the first insulator image data to obtain marked first insulator image data, and form a source domain with the marked first insulator image data set; the first insulator image data is insulator image data under sunny conditions, and the first domain label is 0; Acquire second insulator image data, perform second domain label marking on the second insulator image data to obtain the marked second insulator image data, and form the marked second insulator image data set into the source domain; the second insulator image data is insulator image data under foggy conditions of preset concentration, and the second domain label is 1.
3. The method according to claim 2, characterized in that The domain classifier includes at least one image-level domain classifier and at least one instance-level domain classifier, the image-level domain classifier is used to process the feature distribution difference of the insulator image data at the global image level, and the instance-level domain classifier is used to process the feature distribution difference of the insulator image data at the local image level, the image-level domain classifier is composed of a gradient reversal layer, a convolution layer, a batch normalization layer and an activation function, and the instance-level domain classifier is composed of a gradient reversal layer, a fully connected layer, an activation function and a Dropout layer; The pre-trained YOLO model includes a feature extractor, which includes at least one global feature extraction layer and at least one local feature extraction layer, wherein the local feature extraction layer is located behind all global feature extraction layers and is used to further extract features output from the global feature extraction layer; the pre-trained YOLO model is also used to predict and mark defect features in insulator image data; The number of the global feature extraction layers is greater than or equal to the number of the image-level domain classifiers, and the number of the local feature extraction layers is greater than or equal to the number of the instance-level domain classifiers.
4. The method according to claim 3, characterized in that Before training the pre-trained model based on the training set to obtain the target YOLO model, the method includes: A first preset number of global feature extraction layers are selected from the at least one global feature extraction layer as target global feature extraction layers, and a second preset number of local feature extraction layers are selected from the at least one local feature extraction layer as target local feature extraction layers; one of the target global feature extraction layers corresponds to one image-level domain classifier, and one of the target local feature extraction layers corresponds to one instance-level domain classifier.
5. The method according to claim 4, characterized in that The pre-trained model is trained based on the training set to obtain a target YOLO model, including: Based on each of the target global feature extraction layers in the pre-trained YOLO model, feature extraction is performed on the insulator image data of the source domain to obtain first image feature information corresponding to the output of each target global feature extraction layer; the first image feature information is marked with a first domain label; Based on the image-level domain classifier corresponding to each of the target global feature extraction layers, feature extraction analysis is performed on the first image feature information to obtain a first domain classification result output by the image-level domain classifier corresponding to each of the target local feature extraction layers; the first domain classification result is used to describe the probability value of the first image feature information belonging to the source domain or the target domain; Based on each target local feature extraction layer in the pre-trained YOLO model, feature extraction is performed on the insulator image data of the target domain to obtain second image feature information corresponding to the output of each target local feature extraction layer; the second image feature information is marked with a second domain label; Based on the instance-level domain classifier corresponding to each of the target local feature extraction layers, feature extraction analysis is performed on the second image feature information to obtain a second domain classification result output by the instance-level domain classifier corresponding to each of the target local feature extraction layers; the second domain classification result is used to describe the probability value of the second image feature information belonging to the source domain or the target domain; Determine a first loss value of the image-level domain classifier based on the first domain classification result and the first domain label, determine a second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label, and use the sum of the first loss value and the second loss value as the classification loss value of the domain classifier; Inputting the insulator image data of the source domain in the training set into the pre-trained YOLO model to obtain a defect prediction result, and determining the detection loss value of the pre-trained YOLO model based on the defect prediction result and the insulator image data of the source domain; the defect prediction result is a prediction labeling result of the pre-trained YOLO model in the insulator image data of the source domain; The target loss of the pre-trained model is determined based on the classification loss value and the detection loss value. When the target loss is greater than a preset loss value, the pre-trained YOLO model corresponding to the target loss is used to update the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continuously trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
6. The method according to claim 5, characterized in that Determining a first loss value of the image-level domain classifier based on the first domain classification result and the first domain label includes: The first loss value L of the image-level domain classifier is expressed as follows: img : Among them, D i represents the domain label of the i-th insulator image data in the training set, and the domain label includes the first domain label and the second domain label. represents the predicted probability value of the mth image-level domain classifier at the position (x, y) in the i-th insulator image data in the training set, that is, the first domain classification result; Accordingly, determining a second loss value of the instance-level domain classifier based on the second domain classification result and the second domain label includes: The first loss value L of the instance-level domain classifier is expressed as follows: ins : Among them, D i represents the domain label of the i-th insulator image data in the training set. The domain label includes the first domain label and the second domain label. i,n It represents the predicted probability value of the nth instance-level domain classifier of the i-th insulator image data in the training set, that is, the second domain classification result.
7. The method according to claim 5 or 6, characterized in that: The pre-trained model is trained based on the training set to obtain a target YOLO model, including: Determining the total number of features in the first image feature information processed by each of the image-level domain classifiers; Determine a consistency loss based on the total number of features, the first domain classification result, and the second domain classification result; the consistency loss is used to describe the difference in predictions of the image-level domain classifier and the instance-level domain classifier for the same feature in the same insulator image data; The target loss of the pre-trained model is determined based on the classification loss value, the consistency loss and the detection loss value. When the target loss is greater than a preset loss value, the pre-trained YOLO model corresponding to the target loss is used to update the pre-trained YOLO model in the pre-trained model, and the pre-trained model is continuously trained based on the training set until the target loss is greater than the preset loss value. The pre-trained YOLO model corresponding to the target loss of the pre-trained model is less than or equal to the preset loss value as the target YOLO model.
8. A device for detecting defects of insulators in foggy weather, characterized in that: The device comprises: A training set acquisition module, used to acquire a training set, wherein the training set includes a source domain and a target domain, wherein the source domain is a set of defect-marked insulator image data under sunny conditions, and the target domain is a set of defect-free insulator image data under foggy conditions with a preset concentration; A training module, used for training the pre-trained model based on the training set to obtain a target YOLO model; the pre-trained model is composed of a pre-trained YOLO model and a domain classifier; the target YOLO model is a pre-trained YOLO model corresponding to a target loss of the pre-trained model that is less than or equal to a preset loss value, and the domain classifier is used to predict a domain classification result of the image feature information; the image feature information is feature information from global to local extracted from the insulator image data in the training set based on the pre-trained YOLO model, and the domain classification result is used to describe the probability value of the image feature information belonging to the source domain or the target domain; The prediction module is used to obtain target insulator image data corresponding to a preset concentration of fog, perform defect detection on the target insulator image data based on the target YOLO model, and obtain an insulator defect detection result.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for detecting defects of insulators in foggy weather according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for detecting defects of insulators in foggy weather according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Injection molding product surface image defect identification method based on transfer learning
CN110111297A
Neural network model training method, image detection method and device
CN110516671A
Automatic image labeling method based on unsupervised domain adaptation
CN112149722A
Image detection model training method and device and image detection method
CN115331097A
Single-stage cross-domain target detection method and device, electronic equipment and storage medium
CN116168248A
