Method and device for detecting loss of a pin of a power transmission line

CN118521551BActive Publication Date: 2026-09-22STATE GRID HEBEI ELECTRIC POWER RES INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410669190.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2026-09-22
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

但是销钉本身会定期更换,有问题的销钉数量占比较少,会导致模型训练的数据集中不同种类的数据不平衡,影响机器学习模型的训练,进而会影响输电线路中销钉缺失检测的准确率,容易出现销钉检测误报的现象

Benefits of technology

[0055]本发明实施例中的销钉缺失检测模型通过均匀采样器和倒置采样器,利用不同类别的销钉图像和销钉图像对应的类别标签训练得到,通过均匀采样器和倒置采样器进行两种方式的采样,可以有效增加模型训练过程中类别标签较少的数据,减少数据不平衡的问题,提高销钉缺失检测模型检测的准确率;将待检测销钉图像输入至预设的销钉缺失检测模型,得到销钉缺失检测模型输出的待检测销钉图像的第一特征向量和对应的第一类别标签,可以利用训练得到的销钉缺失检测模型对待检测销钉图像进行准确检测,提高得到的第一类别标签的准确性;根据所述第一特征向量和预设的聚类中心,确定所述待检测销钉图像的销钉缺失参数值,可以进一步通过待检测销钉图像对应的第一特征向量,确定待检测销钉图像中存在销钉缺失的可能性;最后,基于第一类别标签和销钉缺失参数值,得到待检测销钉图像的检测结果,可以通过销钉缺失检测模型得到的第一类别标签,以及销钉缺失参数值,分别对待检测图像进行检测和判别,实现两次判别,进一步提高销钉缺失检测的准确率,减少销钉检测误报的现象。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118521551B_ABST
    Figure CN118521551B_ABST
Patent Text Reader

Abstract

The application provides a power transmission line pin loss detection method and device, and belongs to the field of power transmission line detection. The method comprises the following steps: acquiring a pin image to be detected of a power transmission line; inputting the pin image to be detected into a preset pin loss detection model to obtain a first feature vector of the pin image to be detected output by the pin loss detection model and a corresponding first category label; wherein the pin loss detection model is obtained by training a uniform sampler and an inverted sampler according to pin images of different categories and category labels corresponding to the pin images; determining a pin loss parameter value of the pin image to be detected according to the first feature vector and a preset clustering center; wherein the clustering center is determined according to a preset number of pin images of pin loss; and obtaining a detection result of the pin image to be detected based on the first category label and the pin loss parameter value. The application can improve the accuracy of power transmission line pin loss detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power transmission line testing technology, and in particular to a method and apparatus for detecting missing pins in power transmission lines. Background Technology

[0002] Pins are indispensable parts on transmission towers, primarily used for mechanically preventing the loosening of nuts. They are used in many locations, such as insulator strings, guy clamps, and grading rings, as well as at the connection between the triangular coupling plate and the tower body. If missing pins are not detected in time, they can cause the fittings to fall off, seriously threatening the safety of the power line. Therefore, accurately detecting whether pins are missing in transmission lines is crucial.

[0003] The detection of missing pins mainly relies on UAV inspections, followed by machine vision analysis of aerial survey images. However, since pins are replaced periodically, the number of faulty pins is relatively small. This imbalance in the training dataset can negatively impact the training of machine learning models, consequently affecting the accuracy of missing pin detection in power transmission lines and increasing the likelihood of false positives. Summary of the Invention

[0004] This invention provides a method and apparatus for detecting missing pins in power transmission lines, thereby improving the accuracy of pin detection and reducing false alarms.

[0005] In a first aspect, embodiments of the present invention provide a method for detecting missing pins in transmission lines, comprising:

[0006] Acquire images of the pins to be inspected in the power transmission line;

[0007] The pin image to be detected is input into a preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on pin images of different categories and the category labels corresponding to the pin images;

[0008] Based on the first feature vector and the preset cluster centers, the pin missing parameter value of the pin image to be detected is determined; wherein, the cluster centers are determined based on a preset number of pin images with missing pins;

[0009] Based on the first category label and the pin missing parameter value, the detection result of the pin image to be detected is obtained.

[0010] In one possible implementation, before inputting the image of the pin to be detected into a preset pin missing detection model to obtain the first feature vector and corresponding first category label of the image of the pin to be detected output by the pin missing detection model, the method further includes:

[0011] Acquire training data, which includes pin images for each category and their corresponding category labels;

[0012] Based on the category label of each pin image in the training data, determine the proportion of pin images for each category label;

[0013] According to the stated quantity ratio, a uniform sampler is used to collect first training data from the training data, and based on the pin missing detection model, the value of the first loss function corresponding to the first training data is obtained.

[0014] According to the stated quantity ratio, a second training data is collected from the training data using an inverted sampler, and the value of the second loss function corresponding to the second training data is obtained based on the pin missing detection model.

[0015] The comprehensive loss value of the missing pin detection model is determined based on the values ​​of the first loss function and the second loss function.

[0016] Based on the comprehensive loss value, the model parameters of the missing pin detection model are adjusted to obtain the trained missing pin detection model.

[0017] In one possible implementation, the first training data includes pin images of different categories after uniform sampling and corresponding category labels, with the number of pin images of each category constituting the quantity ratio; the pin missing detection model includes a feature extraction module and an encoding / translation module; the feature extraction module is used to determine the feature vector of the pin image, and the encoding / translation module is used to determine the feature vector of the category label corresponding to the pin image;

[0018] The step of collecting first training data from the training data using a uniform sampler according to the stated quantity ratio, and obtaining the value of the first loss function corresponding to the first training data based on the pin missing detection model, includes:

[0019] Based on the stated quantity ratio, a first training data is collected from the training data using a uniform sampler;

[0020] The pin images in the first training data are input into the feature extraction module of the pin missing detection model to obtain the second feature vector of each pin image output by the feature extraction module.

[0021] The category labels corresponding to the pin images in the first training data are input into the encoding and translation module in the pin missing detection model to obtain the third feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0022] The value of the first loss function corresponding to the first training data is determined based on the second feature vector and the third feature vector.

[0023] In one possible implementation, the second training data includes pin images of different categories after inversion sampling and their corresponding category labels, with the number of pin images of each category forming an inversion ratio corresponding to the quantity ratio; the pin missing detection model includes a feature extraction module and an encoding / translation module; the feature extraction module is used to determine the feature vector of the pin image, and the encoding / translation module is used to determine the feature vector of the category label corresponding to the pin image;

[0024] The step of collecting second training data from the training data using an inverted sampler according to the stated quantity ratio, and obtaining the value of the second loss function corresponding to the second training data based on the pin missing detection model, includes:

[0025] Determine the reciprocal of the stated quantity ratio to obtain the inverted ratio;

[0026] Based on the inverted ratio, a second training data is collected from the training data using an inverted sampler;

[0027] The pin images in the second training data are input into the feature extraction module of the pin missing detection model to obtain the fourth feature vector of each pin image output by the feature extraction module.

[0028] The category labels corresponding to the pin images in the second training data are input into the encoding and translation module in the pin missing detection model to obtain the fifth feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0029] The value of the second loss function corresponding to the second training data is determined based on the fourth feature vector and the fifth feature vector.

[0030] In one possible implementation, before adjusting the model parameters of the missing pin detection model based on the comprehensive loss value to obtain the trained missing pin detection model, the method further includes:

[0031] Randomly enhance the pin images in the first training data to obtain randomly enhanced images;

[0032] The randomly enhanced image is input into the feature extraction module of the missing pin detection model to obtain the sixth feature vector of each randomly enhanced image output by the feature extraction module;

[0033] The value of the contrastive learning loss function of the pin missing detection model is determined based on the sixth feature vector of each randomly enhanced image;

[0034] The comprehensive loss value is updated based on the value of the contrastive learning loss function.

[0035] In one possible implementation, the pin missing parameter value of the pin image to be detected is determined based on the first feature vector and a preset cluster center, including:

[0036] For each cluster center, calculate the vector distance between the first feature vector and the feature vector corresponding to that cluster center;

[0037] The pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center.

[0038] In one possible implementation, the pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center, including:

[0039] Determine whether the vector distance between the first feature vector and the feature vector corresponding to each cluster center is greater than a preset distance;

[0040] The pin missing parameter value of the pin image to be detected is determined based on the number of vector distances greater than a preset distance.

[0041] In one possible implementation, before determining the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center, the method further includes:

[0042] Obtain a preset number of pin-missing images; wherein, the pin-missing images are pin images whose category label is "pin-missing";

[0043] Each pin-missing image is input into the pin-missing detection model to obtain the seventh feature vector of the corresponding pin-missing image output by the pin-missing detection model.

[0044] Clustering was performed on the seventh feature vector of all images with missing pins to obtain multiple cluster centers.

[0045] In one possible implementation, the detection result of the pin image to be detected is obtained based on the first category label and the pin missing parameter value, including:

[0046] Determine whether the first category label indicates a missing pin;

[0047] If the first category label is missing pin, then determine whether the missing pin parameter value is greater than a preset threshold;

[0048] If the pin missing parameter value is greater than a preset threshold, then the detection result of the pin image to be detected is determined to be a pin missing.

[0049] Secondly, embodiments of the present invention provide a device for detecting missing pins in power transmission lines, comprising:

[0050] The acquisition module is used to acquire images of the pins to be inspected in the transmission line;

[0051] The classification module is used to input the pin image to be detected into a preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on pin images of different categories and the category labels corresponding to the pin images;

[0052] The determining module is used to determine the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center; wherein, the cluster center is determined based on a preset number of pin images with missing pins;

[0053] The detection module is used to obtain the detection result of the pin image to be detected based on the first category label and the pin missing parameter value.

[0054] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0055] The pin missing detection model in this embodiment of the invention is trained using a uniform sampler and an inverted sampler, utilizing pin images of different categories and their corresponding category labels. By employing both uniform and inverted sampling methods, the model effectively increases the amount of data with fewer category labels during training, reducing data imbalance and improving the accuracy of the pin missing detection model. The pin image to be detected is input into the preset pin missing detection model, yielding the first feature vector and corresponding first category label of the pin image output by the model. This trained pin missing detection model can then be used to accurately detect the pin image. The detection process is as follows: First, the accuracy of the obtained first category label is improved. Based on the first feature vector and a preset cluster center, the pin missing parameter value of the pin image to be detected is determined. Further, the probability of a pin missing in the pin image can be determined using the first feature vector corresponding to the pin image. Finally, based on the first category label and the pin missing parameter value, the detection result of the pin image to be detected is obtained. The first category label obtained from the pin missing detection model, along with the pin missing parameter value, can be used to detect and discriminate the image, achieving two-stage discrimination. This further improves the accuracy of pin missing detection and reduces false alarms. Attached Figure Description

[0056] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0057] Figure 1 This is a flowchart illustrating the implementation of a method for detecting missing pins in power transmission lines, as provided in an embodiment of the present invention.

[0058] Figure 2 This is a flowchart illustrating the implementation of a training pin missing detection model provided in an embodiment of the present invention.

[0059] Figure 3 This is a flowchart illustrating the implementation of another training pin missing detection model provided in an embodiment of the present invention.

[0060] Figure 4 This is a flowchart illustrating the implementation of another method for detecting missing pins in power transmission lines provided in this embodiment of the invention.

[0061] Figure 5 In this embodiment, A is a schematic diagram of the detection of the first type of pin image to be detected provided by the present invention; Figure 5 B in the figure is a detection schematic diagram of the second type of pin image to be detected provided in the embodiment of the present invention; Figure 5 C in the figure is a detection schematic diagram of the third type of pin image to be detected provided in the embodiment of the present invention; Figure 5 In this embodiment, D is a schematic diagram of the detection of the fourth type of pin image to be detected provided by the present invention;

[0062] Figure 6 This is a schematic diagram of the structure of the power transmission line pin missing detection device provided in an embodiment of the present invention. Detailed Implementation

[0063] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0064] The inventors have discovered that, in order to perform pin missing detection, machine learning models are typically used to identify and detect the pin images to be detected. However, the training dataset of machine learning models is imbalanced in different types of data. Pins are replaced periodically, and images of pins that should be present but are actually missing account for a small percentage in the training dataset. Furthermore, drones have limited shooting angles, and problematic pins may not be captured. This further results in a small percentage of images with missing pins and images where the pins themselves are not present in the existing dataset. The combined percentage of these two key categories of images in all images in the training dataset is approximately 19%, which in turn affects the accuracy of pin missing detection in transmission lines.

[0065] To improve the accuracy of missing pin detection, this invention employs a pre-defined missing pin detection model to detect the image to be tested, first obtaining the first category label corresponding to the image. This missing pin detection model is trained using a uniform sampler and an inverted sampler, which increases the proportion of missing pin images in the training dataset, alleviating the imbalance in the proportion of pin images across different categories. Subsequently, based on the cluster centers determined from the missing pin images, the image to be tested is further discriminated to determine the probability of missing pins in the image. Through these two detection and discrimination processes, the accuracy of missing pin detection can be further improved, reducing false positives.

[0066] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.

[0067] like Figure 1 As shown, the method for detecting missing transmission line pins provided in this embodiment of the invention may include the following steps:

[0068] Step S101: Obtain the image of the pin to be inspected in the transmission line.

[0069] Here, an image of a pin to be detected may contain one or more pin positions to be detected. Through subsequent steps, the detection result of each pin position to be detected can be determined.

[0070] Step S102: Input the pin image to be detected into the preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on the pin images of different categories and the category labels corresponding to the pin images.

[0071] In this embodiment, the preset pin missing detection module may include a feature extraction module and a classifier. The feature extraction module can extract a first feature vector from the pin image to be detected. The classifier can classify the pin according to the first feature vector to obtain the category label corresponding to the first feature vector and output the category label, that is, obtain the first category label corresponding to the pin image to be detected.

[0072] Here, the missing pin detection module is trained using a uniform sampler and an inverted sampler. The uniform sampler and the inverted sampler can collect training data for training the missing pin detection module, while the inverted sampler can collect more pin images corresponding to the category labels that account for a smaller proportion, thereby increasing the proportion of pin images that originally accounted for a smaller proportion in the training data, thus improving the training effect of the missing pin detection model and improving the detection accuracy of the missing pin detection model.

[0073] In addition, if multiple pin positions are detected in the pin image to be detected, the corresponding first feature vector can be extracted for each pin position, and the category label corresponding to each pin position can be obtained, thereby obtaining the first category label corresponding to each pin position in the pin image to be detected.

[0074] Step S103: Determine the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center; wherein, the cluster center is determined based on a preset number of pin images with missing pins.

[0075] In this embodiment, there can be multiple preset cluster centers, which can be determined by clustering images of pins with the category label of missing pins. For example, 1000 images of pins with missing pins can be clustered, and 100 cluster centers can be set. These 100 cluster centers can then be used as the preset cluster centers.

[0076] Here, the similarity between the first feature vector and each cluster center can be determined using the first feature vector and the preset cluster centers. Based on this determined pin-missing reference value, the similarity between the first feature vector and all cluster centers can be characterized, that is, the similarity between the first feature vector and the pin-missing pin image. In fact, this can indicate the probability or likelihood that the first feature vector belongs to the category label of pin-missing.

[0077] Step S104: Based on the first category label and the pin missing parameter value, obtain the detection result of the pin image to be detected.

[0078] In this embodiment, for the pin missing parameter value, if the first feature vector is similar to most cluster centers, it indicates that the category label corresponding to the first feature vector is likely the pin image with a missing pin; if the first feature vector is not similar to the cluster centers, it indicates that the category label corresponding to the first feature vector is likely not the pin image with a missing pin. Based on this, the second category label of the pin image to be detected can be determined.

[0079] Here, by comparing the first category label and the second category label, the third category label of the first feature vector can be determined, thereby determining the detection result of the pin image to be detected. The determination of the first and second category labels involves two detection and discrimination processes. By comparing the two obtained category labels, and finally determining the detection result of the pin image to be detected, the accuracy of pin missing detection can be improved.

[0080] In this embodiment, the detection result of the pin image to be detected can be the category label corresponding to the calibration image to be detected. If the pin image to be detected contains one pin position to be detected, the detection result can be the pin position and the corresponding category label; if the pin image to be detected contains multiple pin positions to be detected, the detection result can be all pin positions and the category label corresponding to each pin position.

[0081] Optionally, this embodiment obtains the detection result of the pin image to be detected based on the first category label and the pin missing parameter value. This can be done by first determining whether the first category label indicates a pin missing; if the first category label indicates a pin missing, then determining whether the pin missing parameter value is greater than a preset threshold; if the pin missing parameter value is greater than the preset threshold, then determining that the detection result of the pin image to be detected is a pin missing.

[0082] In this embodiment, when determining the detection result of the pin image to be detected, it is also possible to first determine whether the first category label is missing pin. If the first category label is not missing pin, the determined first category label can be directly determined as the final detection result.

[0083] If the first category label is missing pin, in order to reduce false alarms in pin detection, a second judgment can be made using the missing pin reference value, that is, to determine whether the missing pin parameter value is greater than the preset threshold.

[0084] If the missing pin parameter value is greater than the preset threshold, it indicates that the category label corresponding to the first feature vector is likely an image of a missing pin. In this case, the category label "missing pin" can be used as the detection result. If the missing pin parameter value is not greater than the preset threshold, the category label corresponding to the first feature vector is likely not an image of a missing pin. That is, if the first category label detected by the missing pin detection model is "missing pin," it is likely a false alarm. Therefore, the category label corresponding to the first feature vector can be "not missing pin" to obtain the detection result of the image to be detected.

[0085] The pin missing detection model in this embodiment of the invention is trained using a uniform sampler and an inverted sampler, utilizing pin images of different categories and their corresponding category labels. By employing both uniform and inverted sampling methods, the model effectively increases the amount of data with fewer category labels during training, reducing data imbalance and improving the accuracy of the pin missing detection model. The pin image to be detected is input into the preset pin missing detection model, yielding the first feature vector and corresponding first category label of the pin image output by the model. This trained pin missing detection model can then be used to accurately detect the pin image. The detection process is as follows: First, the accuracy of the obtained first category label is improved. Based on the first feature vector and a preset cluster center, the pin missing parameter value of the pin image to be detected is determined. Further, the probability of a pin missing in the pin image can be determined using the first feature vector corresponding to the pin image. Finally, based on the first category label and the pin missing parameter value, the detection result of the pin image to be detected is obtained. The first category label obtained from the pin missing detection model, along with the pin missing parameter value, can be used to detect and discriminate the image, achieving two-stage discrimination. This further improves the accuracy of pin missing detection and reduces false alarms.

[0086] In some embodiments, see Figure 2 The diagram shows the implementation flowchart of a training pin missing detection model. Figure 2 In this context, UNIS stands for Uniform Sampler, x us ,y us Let x represent the training data sampled by the uniform sampler, where x us This represents the pin image acquired by the uniform sampler, y usIndicates the corresponding category label; INVS stands for Inverse Sampler, x is ,y is This represents the training data sampled by the inverted sampler, where x is This represents the pin image acquired by the inverted sampler, y is This indicates the corresponding category label.

[0087] Before inputting the image of the pin to be detected into a preset pin missing detection model to obtain the first feature vector and corresponding first category label of the pin missing detection model output by the pin missing detection model, this embodiment may further include:

[0088] First, training data is acquired, including pin images for each category and their corresponding category labels. The acquired training data should have a similar or identical proportion of pin images for each category label to the training data of a conventional pin missing detection model; no restrictions or adjustments are necessary. Acquiring training data first facilitates subsequent sample collection by the uniform sampler and inverted sampler, and then the acquired training data is used to train the pin missing detection model.

[0089] Of course, the training data obtained here can also be training data after sample augmentation or balancing; there are no restrictions here.

[0090] Secondly, based on the category label of each pin image in the training data, determine the proportion of pin images for each category label.

[0091] Here, we can statistically analyze the pin images in the training data to determine the number of pin images corresponding to each category label, thus obtaining the quantity ratio. For example, if the training data includes 800 pin images labeled as having no missing pins, 100 pin images labeled as having missing pins, and 100 pin images labeled as having pins that should not exist, then the quantity ratio can be 8:1:1.

[0092] Then, based on the quantity ratio, a uniform sampler is used to collect the first training data from the training data, and based on the pin missing detection model, the value of the first loss function corresponding to the first training data is obtained (e.g., Figure 2 l in unicon ); and, based on the quantity ratio, using an inverted sampler to collect second training data from the training data, and based on the pin missing detection model, obtaining the value of the second loss function corresponding to the second training data (e.g. Figure 2 l in invcon ).

[0093] In this embodiment, both the first training data and the second training data include pin images for each category and their corresponding category labels. The first training data is obtained by a uniform sampler sampling according to a quantity ratio, and the second training data is obtained by an inverted sampler sampling according to a quantity ratio. Here, all samples are collected only once in each training round, without duplication; that is, there are no duplicate pin images in the first training data, nor are there duplicate pin images in the second training data.

[0094] Here, a uniform sampler and an inverted sampler are used to sample data to obtain the first training data and the second training data. The missing pin detection model is then trained using both training data to obtain the corresponding loss function values. The missing pin detection model can be trained using two different types of training data.

[0095] Next, based on the values ​​of the first loss function and the second loss function, the comprehensive loss value of the missing pin detection model is determined.

[0096] Finally, based on the comprehensive loss value, the model parameters of the missing pin detection model are adjusted to obtain the trained missing pin detection model.

[0097] In this embodiment, when training the pin missing detection model using a uniform sampler, there is a corresponding first loss function; when training the pin missing detection model using an inverted sampler, there is a corresponding second loss function. Here, the first and second loss functions can be weighted and summed to determine the comprehensive loss function of the pin missing detection model (e.g., ...). Figure 2 l in labcon This allows us to obtain a comprehensive loss value, which is then used to train the missing pin detection model more accurately and improve the model's detection accuracy.

[0098] The weighted summation of the first and second loss functions can be determined based on the proportion of pin images for each category label in the training samples. When the proportion of pin images with missing pins is small, the weighting coefficient of the first loss function can be smaller, and the weighting coefficient of the second loss function larger; when the proportion of pin images with missing pins is large, the weighting coefficient of the first loss function can be larger, and the weighting coefficient of the second loss function smaller, thus ensuring a relatively balanced distribution of pin images for each category label in the training model data.

[0099] Optionally, the first training data includes pin images of different categories after uniform sampling and their corresponding category labels, with the number of pin images of each category forming a quantity ratio; the pin missing detection model includes a feature extraction module (such as...). Figure 2 (F in the text) and encoding / translation modules (such as F) Figure 2The Encoder module is used to extract the feature vector of the pin image; the Encoder module is used to extract the feature vector of the category label corresponding to the pin image.

[0100] like Figure 2 As shown, in this embodiment, based on the quantity ratio, a uniform sampler is used to collect first training data from the training data, and based on the pin missing detection model, the value of the first loss function corresponding to the first training data is obtained, which can be:

[0101] First, a uniform sampler is used to collect the first training data from the training data according to the quantity ratio. Here, the probability of a sample corresponding to each category label being collected during sampling by the uniform sampler is proportional to the frequency of occurrence of that category label, that is, the quantity ratio is formed between the number of pin images of each category label in the first training data.

[0102] Next, the pin images from the first training data are input into the feature extraction module of the pin missing detection model to obtain the second feature vector of each pin image output by the feature extraction module.

[0103] Additionally, the category labels corresponding to the pin images in the first training data are input into the encoding and translation module in the pin missing detection model to obtain the third feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0104] Finally, based on the second and third feature vectors, the value of the first loss function corresponding to the first training data is determined.

[0105] In this embodiment, features are extracted from the pin images in the first training data, and the category labels corresponding to the pin images are encoded. By comparing the two obtained feature vectors, the feature extraction module in the pin missing detection model is trained.

[0106] Here, before comparing the second and third feature vectors, a first multilayer perceptron (e.g., Figure 2 In MLP1, the third feature vector corresponding to the category label is mapped to a preset feature space; through a second multilayer perceptron (such as MLP1), the third feature vector is mapped to a preset feature space; Figure 2 In MLP2, the second feature vector corresponding to the pin image is mapped to the same feature space so that the two feature vectors can be compared to obtain the value of the first loss function corresponding to the first training data.

[0107] Optionally, in the second training data, the pin images of different categories after inversion sampling and their corresponding category labels, with the number of pin images of each category forming an inversion ratio corresponding to the quantity ratio; the feature extraction module (such as...) Figure 2In the figure, F) is used to determine the feature vector of the pin image, and the encoding and translation module (such as...) Figure 2 The Encoder in the image is used to determine the feature vector of the category label corresponding to the pin image.

[0108] like Figure 2 As shown, in this embodiment, based on the quantity ratio, an inverted sampler is used to collect second training data from the training data, and based on the pin missing detection model, the value of the second loss function corresponding to the second training data is obtained, which can be:

[0109] First, determine the reciprocal of the quantity ratio to obtain the inverted ratio. Here, the probability of a sample corresponding to each class label being collected during sampling by the inverted sampler is inversely proportional to the frequency of that class label. Therefore, it is necessary to determine the inverted ratio of the training data. For example, if the quantity ratio of the three class labels in the training data is 8:1:1, then the corresponding inverted ratio is 1:8:8; or if the quantity ratio of the three class labels in the training data is 3:2:1, then the corresponding inverted ratio is 2:3:6.

[0110] Secondly, based on the inverted ratio, a second training data set is collected from the training data using an inverted sampler. The number of pin images for each category label in the second training data constitutes an inverted ratio. Therefore, in the inverted sampler, more pin images that were originally less represented are collected, resulting in more pin images with the category label "pin missing" in the second training data, thus enabling better training of the pin missing detection model.

[0111] Then, the pin images from the second training data are input into the feature extraction module of the pin missing detection model to obtain the fourth feature vector of each pin image output by the feature extraction module.

[0112] Additionally, the category labels corresponding to the pin images in the second training data are input into the encoding and translation module in the pin missing detection model to obtain the fifth feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0113] Finally, based on the fourth and fifth feature vectors, the value of the second loss function corresponding to the second training data is determined.

[0114] In this embodiment, feature extraction is also performed on the pin images in the second training data, and the category labels corresponding to the pin images are encoded. By comparing the two feature vectors obtained, the feature extraction module in the pin missing detection model is trained.

[0115] Here, before comparing the fourth and fifth feature vectors, a first multilayer perceptron (such as...) is also used. Figure 2In MLP1, the fifth feature vector corresponding to the category label is mapped to a preset feature space; through a second multilayer perceptron (such as MLP1), the feature vector is mapped to a preset feature space; Figure 2 In MLP2, the fourth feature vector corresponding to the pin image is mapped to the same feature space so that the two feature vectors can be compared to obtain the value of the second loss function corresponding to the second training data.

[0116] In some embodiments, in addition to the sampling and training process of the uniform sampler and the inverted sampler described above, random augmentation and contrastive learning can also be performed to further optimize the feature extraction module F.

[0117] See Figure 3 The flowchart shown here illustrates another implementation of training a missing pin detection model. Before adjusting the model parameters of the missing pin detection model based on the comprehensive loss value to obtain the trained missing pin detection model, it may further include first randomly augmenting the pin images in the first training data to obtain randomly augmented images; then, inputting the randomly augmented images into the feature extraction module of the missing pin detection model to obtain the sixth feature vector of each randomly augmented image output by the feature extraction module; and then, determining the value of the contrastive learning loss function of the missing pin detection model based on the sixth feature vector of each randomly augmented image (e.g., ...). Figure 3 l in con Finally, the overall loss value is updated based on the value of the contrastive learning loss function.

[0118] In this embodiment, after random augmentation of the pin images, pin images with the same initial category label become positive samples after data augmentation; pin images with different initial category labels become negative samples after data augmentation. By performing contrastive learning on the sixth feature vector of the randomly augmented images, and through the penalty of contrastive loss, the vector distance between feature vectors corresponding to positive samples can be reduced, while the vector distance between feature vectors corresponding to negative samples can be increased, thereby improving the accuracy of subsequent detection using the model.

[0119] Random enhancement of the pin image can involve using image enhancement to increase the data diversity of the pin image and improve its image quality, thereby randomly transforming the pin image. For example, at least one of the following processes can be performed on the pin image: color space transformation, geometric transformation, blurring and sharpening, cropping and scaling, grayscale adjustment, contrast adjustment, rotation and mirroring, color balancing, and noise addition, to produce an image that differs from the original image but still retains the same semantic meaning.

[0120] Here, the comprehensive loss function can include a first loss function, a second loss function, and a contrastive learning loss function. The weighted sum of the first and second loss functions can be directly added to the contrastive learning loss function to obtain the comprehensive loss function. Correspondingly, substituting the corresponding loss function values ​​yields the comprehensive loss value.

[0121] Alternatively, random enhancement can be performed on the pin images in the second training data. Through similar steps, the value of the corresponding contrastive learning loss function can be obtained, and then the comprehensive loss value can be updated. This will not be elaborated here.

[0122] The above describes the training process for training the missing pin detection model. After training the missing pin detection model through the above process, the missing pin detection model can be applied to detect the pin image to be detected, and the first feature vector and the corresponding first category label of the pin image to be detected can be obtained.

[0123] The following section will continue to describe the process of determining the missing pin parameters of the pin image to be detected based on the obtained first feature vector.

[0124] In some embodiments, see Figure 4 The flowchart of another method for detecting missing pins in transmission lines is shown. Based on the first feature vector and the preset cluster centers, the missing pin parameter value of the pin image to be detected is determined. This can be achieved by first calculating the vector distance between the first feature vector and the feature vector corresponding to the cluster center for each cluster center; and then determining the missing pin parameter value of the pin image to be detected based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center.

[0125] In this embodiment, the similarity between the first feature vector and the feature vector corresponding to each cluster center is judged by calculating the vector distance between the first feature vector and the feature vector corresponding to each cluster center, thereby obtaining the pin missing reference value of the first feature vector, which is also the pin missing parameter value of the pin image to be detected. Specifically, if the pin image to be detected includes one pin position to be detected, the pin missing parameter value of the pin image to be detected can be directly obtained based on the pin missing reference value of the first feature vector; if the pin image to be detected includes multiple pin positions to be detected, the pin missing reference value of the first feature vector can be one of the multiple pin missing parameter values ​​of the pin image to be detected.

[0126] Here, cosine similarity can be used to calculate the vector distance between the first feature vector and the feature vector corresponding to the cluster center. For example, it can be calculated using the expression: Calculate the vector distance between the first feature vector and the feature vector corresponding to the cluster center; where, simik v represents the vector distance between the i-th first feature vector and the feature vector corresponding to the k-th cluster center. fi Let p represent the i-th first eigenvector. k Let i represent the feature vector corresponding to the k-th cluster center, i represent the i-th first feature vector in the image of the pin to be detected, and k represent the preset k-th cluster center.

[0127] Optionally, in this embodiment, the pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center. This can be achieved by first determining whether the vector distance between the first feature vector and the feature vector corresponding to each cluster center is greater than a preset distance; and then determining the pin missing parameter value of the pin image to be detected based on the number of all vector distances greater than the preset distance.

[0128] In this embodiment, cosine similarity is used to calculate the vector distance between the first feature vector and the feature vector corresponding to each cluster center. The range of this vector distance is -1 to 1. The larger the vector distance, the more similar the first feature vector is to the feature vector corresponding to the cluster center; the smaller the vector distance, the greater the difference between the first feature vector and the feature vector corresponding to the cluster center.

[0129] Therefore, a preset distance can be used as a threshold to determine the similarity between the first feature vector and the feature vector corresponding to each cluster center. Based on the number of cluster centers similar to the first feature vector, the corresponding pin-missing parameter value can be obtained. For example, if there are 100 preset cluster centers and the number of vectors with a distance greater than the preset distance is 60, then the corresponding pin-missing reference value can be 60.

[0130] In addition, this embodiment determines the pin missing parameter value of the pin image to be detected based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center. Alternatively, if the vector distance is greater than a preset distance, the reference value between the first feature vector and the cluster center is determined to be 1; if the distance is less than or equal to a preset threshold, the reference value between the first feature vector and the cluster center is determined to be 0. Finally, the pin missing parameter value of the pin image to be detected is determined based on the reference value between the first feature vector and each cluster center.

[0131] In this embodiment, a reference value between the first feature vector and each cluster center can be determined first, and then the corresponding pin missing parameter value can be obtained based on all the reference values. For example, the pin missing reference value can be calculated according to the following expression: In the formula, S represents the corresponding missing pin parameter value, and c ikσ represents the reference value between the first feature vector and each cluster center, σ represents the preset distance, and n represents the preset set of cluster centers.

[0132] In some embodiments, before determining the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster centers, this embodiment may further include: acquiring a preset number of pin missing images; wherein, the pin missing images are pin images whose category label is pin missing; inputting each pin missing image into the pin missing detection model to obtain the seventh feature vector of the corresponding pin missing image output by the pin missing detection model; and clustering the seventh feature vectors of all pin missing images to obtain multiple cluster centers.

[0133] In this embodiment, the preset cluster centers are determined based on pin images labeled as missing pins. The acquired pin-missing images are input into the pin-missing detection model, where the feature extraction module extracts the feature vector corresponding to each pin-missing image. The feature vector corresponding to the position of the missing pin is the seventh feature vector.

[0134] By clustering all the seventh feature vectors, multiple cluster centers can be obtained, which can then be used to verify and distinguish the first feature vector in subsequent steps.

[0135] In some feasible embodiments, see Figure 5 The first type of pin image to be detected, shown in Figure A, is a schematic diagram. Figure 5 The diagram shows the detection of the second type of pin image to be detected, as shown in B. Figure 5 The diagram shows the detection of the third type of pin image to be detected, as shown in C. Figure 5 The detection diagram of the fourth type of pin image shown in D in the figure shows that... Figure 5 The diagram illustrates the detection process using a missing pin detection model to detect pins in an image. This model identifies the pin positions within the image and categorizes them to determine if a pin is present. If a pin is present at the identified position, the setting is correct. Figure 5 The label "correct" indicates that the pin is not missing; if the pin is not present at its designated location, it indicates a problem with the setting. Figure 5 The label “wrong” in A corresponds to the category label “missing pin”.

[0136] exist Figure 5 In the A, B, C, and D labels, each label is followed by a number, such as... Figure 5The numbers 0.51, 0.92, 0.93, and 0.89 in A represent confidence levels, i.e., the degree of credibility of the labeled data. Subsequently, these confidence levels can be used to filter the detected results in each image to be detected. For example, results with confidence levels greater than a preset confidence level can be retained.

[0137] The pin-missing detection model in this embodiment of the invention is trained using a uniform sampler and an inverted sampler, utilizing pin images of different categories and their corresponding category labels. By employing both uniform and inverted sampling methods, the model training process effectively increases the amount of data with fewer category labels, reducing data imbalance and improving the accuracy of the pin-missing detection model. Specifically, the inverted sampler uses an inverted ratio for sampling and training the pin-missing detection model, increasing the number of pin images with the relatively small category label of "pin-missing." This, combined with the uniform sampler, further reduces data imbalance. Simultaneously, by randomly augmenting the training data and using the augmented images for comparative learning, the vector distance between feature vectors of pin images with the same category label is reduced, while the vector distance between feature vectors of pin images with different category labels is increased. This facilitates subsequent detection and discrimination by calculating the distance between vectors, improving the accuracy of subsequent detection. The image of the pin to be detected is input into a preset pin missing detection model. The model outputs a first feature vector and a corresponding first category label for the pin to be detected. This trained pin missing detection model can accurately detect the pin to be detected, improving the accuracy of the obtained first category label. Based on the first feature vector and preset cluster centers, the pin missing parameter value of the pin to be detected is determined. Furthermore, the probability of a pin missing in the pin to be detected can be determined using the first feature vector corresponding to the pin to be detected. Specifically, determining the cluster center based on pin images with the category label of pin missing helps identify the features of pin images with missing pins, thus accurately determining the pin missing parameter value of the pin to be detected. Finally, based on the first category label and the pin missing parameter value, the detection result of the pin to be detected is obtained. The first category label and the pin missing parameter value obtained from the pin missing detection model can be used to detect and discriminate the image to be detected, achieving two-stage discrimination, further improving the accuracy of pin missing detection and reducing false positives.

[0138] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0139] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0140] Figure 6 A schematic diagram of the structure of the transmission line pin missing detection device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below:

[0141] like Figure 6 As shown, the transmission line pin missing detection device 60 includes:

[0142] The acquisition module 61 is used to acquire images of the pins to be inspected in the transmission line;

[0143] The classification module 62 is used to input the pin image to be detected into the preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on the pin images of different categories and the category labels corresponding to the pin images.

[0144] The determining module 63 is used to determine the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center; wherein, the cluster center is determined based on a preset number of pin images with pin missing.

[0145] The detection module 64 is used to obtain the detection result of the pin image to be detected based on the first category label and the pin missing parameter value.

[0146] In one possible implementation, the classification module 62 is also used for:

[0147] Acquire training data, which includes pin images for each category and their corresponding category labels;

[0148] Based on the category label of each pin image in the training data, determine the proportion of pin images of each category label;

[0149] Based on the quantity ratio, a uniform sampler is used to collect the first training data from the training data, and the value of the first loss function corresponding to the first training data is obtained based on the pin missing detection model.

[0150] Based on the quantity ratio, the inverted sampler is used to collect the second training data from the training data, and the value of the second loss function corresponding to the second training data is obtained based on the pin missing detection model.

[0151] Based on the values ​​of the first loss function and the second loss function, determine the comprehensive loss value of the missing pin detection model;

[0152] Based on the comprehensive loss value, adjust the model parameters of the missing pin detection model to obtain the trained missing pin detection model.

[0153] In one possible implementation, the first training data includes pin images of different categories after uniform sampling and their corresponding category labels, with the number of pin images of each category forming a quantity ratio; the pin missing detection model includes a feature extraction module and an encoding and translation module; the feature extraction module is used to determine the feature vector of the pin image, and the encoding and translation module is used to determine the feature vector of the category label corresponding to the pin image;

[0154] Classification module 62 is specifically used for:

[0155] Based on the quantity ratio, the first training data is collected from the training data using a uniform sampler;

[0156] The pin images in the first training data are input into the feature extraction module of the pin missing detection model to obtain the second feature vector of each pin image output by the feature extraction module.

[0157] The category labels corresponding to the pin images in the first training data are input into the encoding and translation module in the pin missing detection model to obtain the third feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0158] Based on the second and third feature vectors, determine the value of the first loss function corresponding to the first training data.

[0159] In one possible implementation, the second training data contains pin images of different categories after inversion sampling and their corresponding category labels, with the number of pin images of each category forming an inversion ratio corresponding to the quantity ratio; the pin missing detection model includes a feature extraction module and an encoding and translation module; the feature extraction module is used to determine the feature vector of the pin image, and the encoding and translation module is used to determine the feature vector of the category label corresponding to the pin image;

[0160] Classification module 62 is specifically used for:

[0161] By determining the reciprocal of the quantity ratio, we obtain the inverted ratio;

[0162] Based on the inverted ratio, a second training data is collected from the training data using an inverted sampler;

[0163] The pin images from the second training data are input into the feature extraction module of the pin missing detection model to obtain the fourth feature vector of each pin image output by the feature extraction module.

[0164] The category labels corresponding to the pin images in the second training data are input into the encoding and translation module in the pin missing detection model to obtain the fifth feature vector of the category label corresponding to each pin image output by the encoding and translation module.

[0165] Based on the fourth and fifth feature vectors, determine the value of the second loss function corresponding to the second training data.

[0166] In one possible implementation, the classification module 62 is also used for:

[0167] Randomly enhance the pin image in the first training data to obtain a randomly enhanced image;

[0168] The randomly enhanced image is input into the feature extraction module of the pin missing detection model to obtain the sixth feature vector of each randomly enhanced image output by the feature extraction module;

[0169] The value of the contrastive learning loss function for the pin missing detection model is determined based on the sixth feature vector of each randomly enhanced image.

[0170] The overall loss value is updated based on the value of the comparative learning loss function.

[0171] In one possible implementation, the determining module 63 is specifically used for:

[0172] For each cluster center, calculate the vector distance between the first feature vector and the feature vector corresponding to that cluster center;

[0173] The pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center.

[0174] In one possible implementation, the determining module 63 is specifically used for:

[0175] Determine whether the vector distance between the first feature vector and the feature vector corresponding to each cluster center is greater than a preset distance;

[0176] The pin missing parameter value of the pin image to be detected is determined based on the number of vector distances greater than the preset distance.

[0177] In one possible implementation, the determining module 63 is also used for:

[0178] Obtain a preset number of pin-missing images; wherein, the pin-missing images are pin images whose category label is "pin-missing";

[0179] Each pin-missing image is input into the pin-missing detection model to obtain the seventh feature vector of the corresponding pin-missing image output by the pin-missing detection model.

[0180] Clustering was performed on the seventh feature vector of all images with missing pins to obtain multiple cluster centers.

[0181] In one possible implementation, the detection module 64 is specifically used for:

[0182] Determine if the first category label indicates a missing pin;

[0183] If the first category label is missing pins, then determine whether the missing pin parameter value is greater than the preset threshold.

[0184] If the pin missing parameter value is greater than the preset threshold, the detection result of the pin image to be detected is determined to be pin missing.

[0185] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0186] Those skilled in the art will recognize that the templates, units, and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0187] If a module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory, random access memory, electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0188] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for detecting missing pins in transmission lines, characterized in that, include: Acquire images of the pins to be inspected in the power transmission line; The pin image to be detected is input into a preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on pin images of different categories and the category labels corresponding to the pin images; Based on the first feature vector and the preset cluster centers, the pin missing parameter value of the pin image to be detected is determined; wherein, the cluster centers are determined based on a preset number of pin images with missing pins; Based on the first category label and the pin missing parameter value, the detection result of the pin image to be detected is obtained; Before inputting the image of the pin to be detected into a preset pin missing detection model to obtain the first feature vector and corresponding first category label of the pin missing detection model output by the pin missing detection model, the method further includes: Acquire training data, which includes pin images for each category and their corresponding category labels; Based on the category label of each pin image in the training data, determine the proportion of pin images for each category label; According to the stated quantity ratio, a uniform sampler is used to collect first training data from the training data, and based on the pin missing detection model, the value of the first loss function corresponding to the first training data is obtained; wherein, when the uniform sampler samples, the probability of a sample corresponding to each category label being collected is proportional to the frequency of occurrence of that category label; According to the stated quantity ratio, an inverted sampler is used to collect second training data from the training data, and based on the pin missing detection model, the value of the second loss function corresponding to the second training data is obtained; wherein, when the inverted sampler samples, the probability of a sample corresponding to each category label being collected is inversely proportional to the frequency of occurrence of that category label; The comprehensive loss value of the missing pin detection model is determined based on the values ​​of the first loss function and the second loss function. Based on the comprehensive loss value, adjust the model parameters of the missing pin detection model to obtain the trained missing pin detection model; Based on the first feature vector and the preset cluster centers, the pin missing parameter values ​​of the pin image to be detected are determined, including: For each cluster center, calculate the vector distance between the first feature vector and the feature vector corresponding to that cluster center; The pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center. Based on the first category label and the pin missing parameter value, the detection result of the pin image to be detected is obtained, including: Determine whether the first category label indicates a missing pin; If the first category label is missing pin, then determine whether the missing pin parameter value is greater than a preset threshold; If the pin missing parameter value is greater than a preset threshold, then the detection result of the pin image to be detected is determined to be a pin missing.

2. The method for detecting missing pins in transmission lines according to claim 1, characterized in that, The first training data includes pin images of different categories after uniform sampling and corresponding category labels, and the number of pin images of each category constitutes the quantity ratio; the pin missing detection model includes a feature extraction module and an encoding and translation module; the feature extraction module is used to determine the feature vector of the pin image, and the encoding and translation module is used to determine the feature vector of the category label corresponding to the pin image; The step of collecting first training data from the training data using a uniform sampler according to the stated quantity ratio, and obtaining the value of the first loss function corresponding to the first training data based on the pin missing detection model, includes: Based on the stated quantity ratio, a first training data is collected from the training data using a uniform sampler; The pin images in the first training data are input into the feature extraction module of the pin missing detection model to obtain the second feature vector of each pin image output by the feature extraction module. The category labels corresponding to the pin images in the first training data are input into the encoding and translation module in the pin missing detection model to obtain the third feature vector of the category label corresponding to each pin image output by the encoding and translation module. The value of the first loss function corresponding to the first training data is determined based on the second feature vector and the third feature vector.

3. The method for detecting missing pins in transmission lines according to claim 1, characterized in that, The second training data includes pin images of different categories after inversion sampling and their corresponding category labels. The number of pin images of each category constitutes the inversion ratio corresponding to the number ratio. The pin missing detection model includes a feature extraction module and an encoding and translation module. The feature extraction module is used to determine the feature vector of the pin image, and the encoding and translation module is used to determine the feature vector of the category label corresponding to the pin image. The step of collecting second training data from the training data using an inverted sampler according to the stated quantity ratio, and obtaining the value of the second loss function corresponding to the second training data based on the pin missing detection model, includes: Determine the reciprocal of the stated quantity ratio to obtain the inverted ratio; Based on the inverted ratio, a second training data is collected from the training data using an inverted sampler; The pin images in the second training data are input into the feature extraction module of the pin missing detection model to obtain the fourth feature vector of each pin image output by the feature extraction module. The category labels corresponding to the pin images in the second training data are input into the encoding and translation module in the pin missing detection model to obtain the fifth feature vector of the category label corresponding to each pin image output by the encoding and translation module. The value of the second loss function corresponding to the second training data is determined based on the fourth feature vector and the fifth feature vector.

4. The method for detecting missing pins in transmission lines according to claim 1, characterized in that, Before adjusting the model parameters of the missing pin detection model based on the comprehensive loss value to obtain the trained missing pin detection model, the process further includes: Randomly enhance the pin images in the first training data to obtain randomly enhanced images; The randomly enhanced image is input into the feature extraction module of the missing pin detection model to obtain the sixth feature vector of each randomly enhanced image output by the feature extraction module; The value of the contrastive learning loss function of the pin missing detection model is determined based on the sixth feature vector of each randomly enhanced image; The comprehensive loss value is updated based on the value of the contrastive learning loss function.

5. The method for detecting missing pins in transmission lines according to claim 1, characterized in that, Based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center, the pin missing parameter value of the pin image to be detected is determined, including: Determine whether the vector distance between the first feature vector and the feature vector corresponding to each cluster center is greater than a preset distance; The pin missing parameter value of the pin image to be detected is determined based on the number of all vector distances greater than a preset distance.

6. The method for detecting missing pins in transmission lines according to claim 1, characterized in that, Before determining the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center, the method further includes: Obtain a preset number of pin-missing images; wherein, the pin-missing images are pin images whose category label is "pin-missing"; Each pin-missing image is input into the pin-missing detection model to obtain the seventh feature vector of the corresponding pin-missing image output by the pin-missing detection model. Clustering was performed on the seventh feature vector of all images with missing pins to obtain multiple cluster centers.

7. A device for detecting missing pins in power transmission lines, characterized in that, include: The acquisition module is used to acquire images of the pins to be inspected in the transmission line; The classification module is used to input the pin image to be detected into a preset pin missing detection model to obtain the first feature vector and the corresponding first category label of the pin image to be detected output by the pin missing detection model; wherein, the pin missing detection model is trained using a uniform sampler and an inverted sampler based on pin images of different categories and the category labels corresponding to the pin images; The determining module is used to determine the pin missing parameter value of the pin image to be detected based on the first feature vector and the preset cluster center; wherein, the cluster center is determined based on a preset number of pin images with missing pins; The detection module is used to obtain the detection result of the pin image to be detected based on the first category label and the pin missing parameter value; The classification module is also used for: Acquire training data, which includes pin images for each category and their corresponding category labels; Based on the category label of each pin image in the training data, determine the proportion of pin images for each category label; According to the stated quantity ratio, a uniform sampler is used to collect first training data from the training data, and based on the pin missing detection model, the value of the first loss function corresponding to the first training data is obtained; wherein, when the uniform sampler samples, the probability of a sample corresponding to each category label being collected is proportional to the frequency of occurrence of that category label; According to the stated quantity ratio, an inverted sampler is used to collect second training data from the training data, and based on the pin missing detection model, the value of the second loss function corresponding to the second training data is obtained; wherein, when the inverted sampler samples, the probability of a sample corresponding to each category label being collected is inversely proportional to the frequency of occurrence of that category label; The comprehensive loss value of the missing pin detection model is determined based on the values ​​of the first loss function and the second loss function. Based on the comprehensive loss value, adjust the model parameters of the missing pin detection model to obtain the trained missing pin detection model; The determining module is specifically used for: For each cluster center, calculate the vector distance between the first feature vector and the feature vector corresponding to that cluster center; The pin missing parameter value of the pin image to be detected is determined based on the vector distance between the first feature vector and the feature vector corresponding to each cluster center. The detection module is specifically used for: Determine whether the first category label indicates a missing pin; If the first category label is missing pin, then determine whether the missing pin parameter value is greater than a preset threshold; If the pin missing parameter value is greater than a preset threshold, then the detection result of the pin image to be detected is determined to be a pin missing.

Citation Information

Patent Citations

  • Bolt defect detection method based on semi-supervised learning and priori knowledge embedding strategy

    CN114708518A

  • Method and device for detecting integrity quality abnormity of mammary gland X-ray image

    CN114881929A