Disclosure of Invention
Aiming at the defects in the prior art, the catenary contact line abnormity detection method and system based on image processing provided by the invention solve the problem of realizing catenary contact line abnormity detection by utilizing high-definition images shot by a catenary suspension state detection and monitoring device 4C through image processing.
In order to achieve the purpose of the invention, the invention adopts the technical scheme that:
the invention provides a catenary contact line abnormity detection method based on image processing, which comprises the following steps:
s1, acquiring a plurality of catenary contact line images shot by the contact line suspension state detection and monitoring device 4C;
s2, preprocessing each catenary contact line image to obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
s3, respectively constructing a catenary contact line foreign body suspension detection network and a catenary contact line abnormal defect detection network;
s4, respectively training a catenary contact line foreign body suspension detection network and a catenary contact line abnormal defect detection network by using a cable abnormal defect image set and a cable foreign body suspension image set to obtain the trained catenary contact line foreign body suspension detection network and catenary contact line abnormal defect detection network;
and S5, respectively carrying out anomaly detection on the catenary contact line image subjected to the same pretreatment by using the trained catenary contact line foreign body suspension detection network and the trained catenary contact line anomaly defect detection network to obtain a cable anomaly defect detection result and a cable foreign body suspension detection result.
The invention has the beneficial effects that: the scheme can realize the line body abnormity detection and line body foreign body suspension detection of the catenary contact line by classifying the cable abnormity defects and processing the images, can detect the situations of line body cavities, stripping, bulges and large and small diameters and can detect the suspension situations of foreign bodies such as plastic bags, kites and the like at the same time, the method has the advantages of high detection precision, good detail sampling feature storage, low network construction cost and high retrieval efficiency.
Further, the step S2 includes the following steps:
s21, converting the contact line image format of each catenary into an RGB format by using a green interpolation method to obtain a catenary contact line image set in the RGB format;
s22, filtering the median of the catenary contact line images in the RGB format to obtain a filtered catenary contact line image set;
the expression of the filtered catenary contact line image is as follows:
g(x,y)=Med{f(x-k,y-l),(k,l)∈W}
wherein g (x, y) represents a filtered catenary contact line image, f (x, y) represents a catenary contact line image in an RGB format, W represents an image calculation area, Med represents median filtering, k represents a filtered image window center abscissa, and l represents a filtered image window center ordinate;
s23, carrying out 2-magnification downsampling on each filtered catenary contact line image to obtain a sampled catenary contact line image set;
the calculation expression of the downsampling is as follows:
wherein, PkRepresenting sampled pixel point values, IiRepresenting the value of the original pixel point, s2Representing a square pixel area, win (k) representing the square pixel area where the original pixel point value is located, and i representing the ith original pixel point value;
s24, respectively obtaining a thick cable abnormal defect image set and a thick cable foreign matter hanging image set by carrying out threshold segmentation on each sampled catenary contact line image;
and S25, performing morphological processing on each thick cable abnormal defect image and each thick cable foreign body hanging image respectively to obtain a cable abnormal defect image set and a cable foreign body hanging image set.
The beneficial effect of adopting the further scheme is as follows: human eyes are most sensitive to green light reaction and weak to red light and blue light reaction, so that a catenary contact line collected by 4C is converted into an RGB format for image processing by a green interpolation method, salt and pepper noise in an image is filtered by median filtering, high detection rate and high detection accuracy are maintained by image downsampling processing, a cable line body is extracted from a background by threshold segmentation, discrete noise is filtered by morphological processing, and a cable abnormal defect image set and a cable foreign body suspension image set with clear characteristics are obtained.
Further, the step S25 includes the following sub-steps:
s251, performing expansion processing on each thick cable abnormal defect image and each thick cable foreign body hanging image to obtain an expanded thick cable abnormal defect image and a thick cable foreign body hanging image;
the computational expression of the dilation process is as follows:
wherein A and B respectively represent a set of elements to be processed and a set of structural elements of the region Z to be processed,
the structural element set B is represented to perform expansion operation on the element set A to be processed, z represents a displacement element, B' represents an origin reflection set of the structural element set,
representing an empty set;
s252, respectively carrying out corrosion treatment on each thick cable abnormal defect image and each thick cable foreign matter suspension image after expansion treatment to obtain a thick cable abnormal defect image set and a thick cable foreign matter suspension image set after corrosion treatment;
the calculation expression of the corrosion treatment is as follows:
wherein, theta represents that the structural element set B performs expansion operation on the element set A to be processed, and B
zA set of structural displacement elements representing the region Z to be processed,
represents containing;
s253, respectively carrying out opening operation and closing operation on each thick cable abnormal defect image and each thick cable foreign matter hanging image after corrosion treatment to respectively obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
the computational expressions of the opening operation and the closing operation are respectively as follows:
wherein,
indicates an open operation, and indicates a close operation.
The beneficial effect of adopting the further scheme is as follows: and the morphological processing filters the abnormal defect images of the thick cables and the discrete noise points of the foreign matter hanging images of the thick cables through expansion, corrosion, opening operation and closing operation to obtain the cable abnormal defect image set and the cable foreign matter hanging image set with clear characteristics.
Further, the catenary contact line anomaly defect detection network in step S3 includes:
the image processing device comprises a cable abnormal defect image input layer Inputs, a first Conv2D scrolling layer, a first BN layer, a first Relu active layer, a first residual module addlayer1, a first maximum pooling maxporoling 2D layer, a second Conv2D scrolling layer, a second BN layer, a second Relu active layer, a second residual module addlayer2, a second maximum pooling maxporoling 2D layer, a third Conv2D scrolling layer, a third BN layer, a third Relu active layer, a third maximum pooling maxporoling 2D layer, a third residual module addlayer3, a fourth Conv2D scrolling layer, a fourth BN layer, a regular fourth Relu active layer, a fourth residual module addlayer4, a fourth maximum pooling2 × flattening layer 2D, a fifth Conv2D scrolling layer, a fifth BN layer, a fifth Conv2 actuating layer, a regular fourth Relup active layer, a fifth residual module adduction 2 flattening layer 2D, a fifth Conv2 flattening layer, a fifth excess pooling layer, a first Relupo 2 flattening layer, a second Relu active layer, a second residual module flattening layer, a third residual flattening module flattening layer, a fifth residual flattening module flattening layer5, a fifth Conv2 flattening layer, a fifth Conv flattening layer, a fifth Conv2 flattening layer, a fifth flattening filter, a fifth filtering module flattening filter, a fifth filtering module flattening filter, a fifth filtering module flattening filter, a fifth filtering module flattening filter, a fifth filtering module flattening filter.
The beneficial effect of adopting the further scheme is as follows: the catenary contact line abnormal defect detection network learns through 5 BN layers, 5 relu activation functions, 4 pooling layers, 5 two-dimensional convolution layers and two Dense full-connection layers, prevents overfitting through a parameter regularization dropout layer, and can realize quick and high-precision detection of catenary contact line abnormal defects after training.
Further, the catenary contact line foreign body suspension detection network of step S3 includes:
the system comprises a cable foreign body hanging image input layer, a backbone network layer, a characteristic diagram acquisition layer, a region nomination network layer, a nomination region layer, an interested region pooling layer, a full connection layer and a category profile output layer;
the cable foreign matter suspension image input layer is connected with the backbone network layer; the backbone network layer is connected with the characteristic diagram acquisition layer; the characteristic diagram acquisition layer is respectively connected with the regional nomination network layer and the interested region pooling layer; the regional nomination network layer is connected with the nomination regional layer; the nomination region layer is connected with the interested region pooling layer; the region of interest pooling layer is connected with the full-link layer; the full connection layer is connected with the category profile output layer.
The beneficial effect of adopting the further scheme is as follows: the scheme readjusts all input cable foreign matter hanging images into a fixed size through a cable foreign matter hanging image input layer, directly outputs the cable foreign matter hanging images to an interested pooling layer through a characteristic image layer, and outputs the cable foreign matter hanging images to two paths of the interested pooling layer through a region nomination network layer and a nomination region layer to nominate a foreground target and a background target in a region, finally combines the nomination position, correspondingly finds out the position of a prediction target on a characteristic diagram, realizes regression of a prediction position frame through a full connection layer and a category contour output layer, and classifies the targets in the frame.
Furthermore, each convolution structure in the backbone network layer adopts a deformable convolution structure;
the convolution calculation expression of the deformable convolution structure is as follows:
wherein, yp(p0) Convolution output, p, representing a deformable convolution structure0Representing the convolution output position, pnRepresenting the convolution output position p0Corresponding integer offset, R represents a real number, Δ pnRepresenting the convolution output position p0Corresponding non-integer offset, w′(pn) Denotes the integer offset factor, x' (p)0+pn+Δpn) Representing the input to the deformable convolution structure.
The beneficial effect of adopting the further scheme is as follows:
further, the loss function L ({ p) in the area nomination network layer trainingi},{ti}) the expression is as follows:
wherein N is
clsIndicates the number of classes, N
regIndicating the number of nominated regions, i' indicating the ith anchor point, p
i′Representing the probability that the prediction box is the foreground,
indicates the probability that the prediction block predicts correctly, t
i′A parameter representing the boundary of the prediction box,
the boundary parameter of a real labeling frame of the foreground target is represented, the lambda represents a classification loss and prediction loss balance factor,
a function representing the loss of classification is represented,
represents a prediction loss function, x 'and y' represent the abscissa and ordinate, respectively, of the center point of the prediction box, w and h represent the width and height of the prediction box, respectively,
representing a smooth function.
The beneficial effect of adopting the further scheme is as follows: the comprehensive analysis of the classification loss and the prediction loss is realized through the classification loss and the prediction loss balance factor, and the high precision of the feature extraction of the regional nomination network layer is guaranteed.
The invention also provides a detection system of the catenary contact line abnormity detection method based on image processing, which comprises the following steps:
the catenary contact line image acquisition module is used for acquiring a plurality of catenary contact line images shot by the catenary suspension state detection and monitoring device 4C;
the image preprocessing module is used for preprocessing images of contact wires of each carrier cable to obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
the detection network construction module is used for respectively constructing a catenary contact line foreign matter suspension detection network and a catenary contact line abnormal defect detection network;
the detection network training module is used for training a catenary contact line foreign matter suspension detection network and a catenary contact line abnormal defect detection network by utilizing the cable abnormal defect image set and the cable foreign matter suspension image set respectively to obtain the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormal defect detection network;
and the catenary contact line abnormity detection module is used for carrying out abnormity detection on the catenary contact line image subjected to the same pretreatment by utilizing the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormity defect detection network respectively to obtain a cable abnormity defect detection result and a cable foreign matter suspension detection result.
The beneficial effects of the invention are as follows: the detection system of the catenary contact line abnormity detection method based on image processing is a system correspondingly arranged to the catenary contact line abnormity detection method based on image processing and is used for realizing the catenary contact line abnormity detection method based on image processing.
Detailed Description
The following description of the embodiments of the present invention is provided to facilitate the understanding of the present invention by those skilled in the art, but it should be understood that the present invention is not limited to the scope of the embodiments, and it will be apparent to those skilled in the art that various changes may be made without departing from the spirit and scope of the invention as defined and defined by the appended claims, and all changes that can be made by the invention using the inventive concept are intended to be protected.
Example 1
As shown in fig. 1, in one embodiment of the present invention, the present invention provides a catenary contact line anomaly detection method based on image processing, which includes the following steps:
s1, acquiring a plurality of catenary contact line images shot by the contact line suspension state detection and monitoring device 4C;
s2, preprocessing each catenary contact line image to obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
the step S2 includes the following steps:
s21, converting the format of each catenary contact line image into RGB format by using a green interpolation method to obtain a catenary contact line image set in RGB format;
s22, filtering median values of the catenary contact line images in the RGB formats to obtain filtered catenary contact line image sets;
the expression of the filtered catenary contact line image is as follows:
g(x,y)=Med{f(x-k,y-l),(k,l)∈W}
wherein g (x, y) represents a filtered catenary contact line image, f (x, y) represents a catenary contact line image in an RGB format, W represents an image calculation area, Med represents median filtering, k represents a filtered image window center abscissa, and l represents a filtered image window center ordinate;
s23, carrying out 2-magnification downsampling on each filtered catenary contact line image to obtain a sampled catenary contact line image set;
the calculation expression of the downsampling is as follows:
wherein, PkRepresenting sampled pixel point values, IiRepresenting the value of the original pixel point, s2Representing a square pixel area, win (k) representing the square pixel area where the original pixel point value is located, and i representing the ith original pixel point value;
s24, respectively obtaining a thick cable abnormal defect image set and a thick cable foreign matter hanging image set by carrying out threshold segmentation on each sampled catenary contact line image;
s25, performing morphological processing on each thick cable abnormal defect image and each thick cable foreign body hanging image respectively to obtain a cable abnormal defect image set and a cable foreign body hanging image set;
the step S25 includes the following sub-steps:
s251, performing expansion processing on each thick cable abnormal defect image and each thick cable foreign body hanging image to obtain an expanded thick cable abnormal defect image and a thick cable foreign body hanging image;
the computational expression of the dilation process is as follows:
wherein A and B respectively represent a set of elements to be processed and a set of structural elements of the region Z to be processed,
representing the expansion operation of the structural element set B on the element set A to be processed, z representing a displacement element, B' representing an origin reflection set of the structural element set,
representing an empty set;
s252, respectively carrying out corrosion treatment on each thick cable abnormal defect image and each thick cable foreign matter suspension image after expansion treatment to obtain a thick cable abnormal defect image set and a thick cable foreign matter suspension image set after corrosion treatment;
the calculation expression of the corrosion treatment is as follows:
wherein, theta represents that the structural element set B performs expansion operation on the element set A to be processed, and B
zA set of structural displacement elements representing the region Z to be processed,
represents containing;
s253, respectively performing opening operation and closing operation on each thick cable abnormal defect image and each thick cable foreign matter hanging image after corrosion treatment to respectively obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
the computational expressions of the opening operation and the closing operation are respectively as follows:
wherein,
represents an open operation,. represents a close operation;
s3, respectively constructing a catenary contact line foreign body suspension detection network and a catenary contact line abnormal defect detection network;
as shown in fig. 3, the catenary contact line abnormal defect detection network in step S3 includes:
the system comprises a cable abnormal defect image input layer Inputs, a first Conv2D scrolling layer, a first BN layer, a first Relu activation layer, a first residual module addlayer1, a first maximum pooling maxporoling 2D layer, a second Conv2D scrolling layer, a second BN layer, a second Relu activation layer, a second residual module addlayer2, a second maximum pooling maxporoling 2D layer, a third Conv2D scrolling layer, a third BN layer, a third Relu activation layer, a third maximum pooling maxporoling 2D layer, a third residual module addlayer3, a fourth Conv2D scrolling layer, a fourth BN layer, a fourth Relu activation layer, a fourth residual module addlayer4, a fourth maximum pooling maxporoling 2 layer D, a fifth Conv2D scrolling layer, a fifth BN layer, a fifth Reuv activation layer, a fifth residual module adduction module addlayer4, a fourth maximum pooling2 flattening layer D, a fifth Conv2 scrolling layer, a fifth BN layer, a fifth Conv2, a fifth overflux activation layer, a fifth residual module flattening layer, a fifth recycling layer, a parameter input layer, a first Relu activation layer, a second residual module flattening module, a second residual module, a third residual module flattening 2 flattening layer, a fifth recycling module flattening layer, a fifth recycling parameter, a fifth recycling module flattening layer, a fifth recycling parameter, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling parameter, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening layer, a fifth recycling module flattening;
the abnormal cable defect images are 320 x 120 images, labels containing address information are added to the images respectively, the types of the labels are holes, stripping, bulges and sizes, and each image comprises more than 600 images;
as shown in fig. 4, the catenary contact line foreign body suspension detection network in step S3 includes:
the system comprises a cable foreign body hanging image input layer, a backbone network layer, a characteristic diagram acquisition layer, a regional nomination network layer, a nomination region layer, an interested region pooling layer, a full connection layer and a category profile output layer;
the cable foreign matter suspension image input layer is connected with the backbone network layer; the backbone network layer is connected with the characteristic diagram acquisition layer; the characteristic diagram acquisition layer is respectively connected with the regional nomination network layer and the region of interest pooling layer; the regional nomination network layer is connected with the nomination regional layer; the nomination region layer is connected with the interested region pooling layer; the region of interest pooling layer is connected with the full-link layer; the full connection layer is connected with the category profile output layer;
each convolution structure in the backbone network layer adopts a deformable convolution structure;
the convolution calculation expression of the deformable convolution structure is as follows:
wherein, yp(p0) Convolution output, p, representing a deformable convolution structure0Representing the convolution output position, pnRepresenting the convolution output position p0Corresponding integer offset, R represents a real number, Δ pnRepresenting the convolution output position p0Corresponding non-integer offset, w' (p)n) Denotes the integer offset factor, x' (p)0+pn+Δpn) An input representing a deformable convolution structure;
loss function L ({ p) in the training of the area nomination network layeri},{ti}) the expression is as follows:
wherein N is
clsIndicates the number of classes, N
regIndicating the number of nominated regions, i' indicating the ith anchor point, p
i′Representing the probability that the prediction box is the foreground,
indicates the probability that the prediction block predicts correctly, t
i′A parameter representing the boundary of the prediction box,
the boundary parameter of a real labeling frame of the foreground target is represented, the lambda represents a classification loss and prediction loss balance factor,
a function representing the loss of classification is represented,
represents a prediction loss function, x 'and y' represent the abscissa and ordinate, respectively, of the center point of the prediction box, w and h represent the width and height of the prediction box, respectively,
representing a smooth function.
S4, training a catenary contact line foreign matter suspension detection network and a catenary contact line abnormal defect detection network by utilizing the cable abnormal defect image set and the cable foreign matter suspension image set respectively to obtain the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormal defect detection network;
s5, respectively using the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormal defect detection network to perform abnormal detection on the catenary contact line image subjected to the same pretreatment, so as to obtain a cable abnormal defect detection result and a cable foreign matter suspension detection result;
the abnormal defect detection result of the cable comprises hole abnormality, stripping abnormality, bulge abnormality and size diameter abnormality, and the cable foreign matter suspension detection result is foreign matter suspension.
The invention has the beneficial effects that: the invention has the beneficial effects that: the scheme can realize the line body abnormity detection and line body foreign body suspension detection of the catenary contact line by classifying the cable abnormity defects and processing the images, can detect the situations of line body cavities, stripping, bulges and large and small diameters and can detect the suspension situations of foreign bodies such as plastic bags, kites and the like at the same time, the method has the advantages of high detection precision, good detail sampling feature storage, low network construction cost and high retrieval efficiency.
Example 2
As shown in fig. 4, in an embodiment of the present invention, the present invention provides a detection system of a catenary contact line anomaly detection method based on image processing, including:
the catenary contact line image acquisition module is used for acquiring a plurality of catenary contact line images shot by the catenary suspension state detection and monitoring device 4C;
the image preprocessing module is used for preprocessing images of contact wires of each carrier cable to obtain a cable abnormal defect image set and a cable foreign matter hanging image set;
the detection network construction module is used for respectively constructing a catenary contact line foreign body suspension detection network and a catenary contact line abnormal defect detection network;
the detection network training module is used for training a catenary contact line foreign matter suspension detection network and a catenary contact line abnormal defect detection network by utilizing the cable abnormal defect image set and the cable foreign matter suspension image set respectively to obtain the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormal defect detection network;
and the catenary contact line abnormity detection module is used for carrying out abnormity detection on the catenary contact line image subjected to the same pretreatment by utilizing the trained catenary contact line foreign matter suspension detection network and the trained catenary contact line abnormity defect detection network respectively to obtain a cable abnormity defect detection result and a cable foreign matter suspension detection result.
The detection system of the catenary contact line anomaly detection method based on image processing provided by the embodiment can execute the technical scheme shown in the catenary contact line anomaly detection method based on image processing in the embodiment of the method, and the implementation principle and the beneficial effects are similar, so that the details are not repeated here.
In the embodiment of the invention, the functional units can be divided according to the catenary contact line abnormality detection method based on image processing, for example, each function can be divided into each functional unit, and two or more functions can be integrated into one processing unit. The integrated unit may be implemented in the form of hardware, or may be implemented in the form of a software functional unit. It should be noted that the division of the cells in the present invention is schematic, and is only a logical division, and there may be another division manner in actual implementation.
In the embodiment of the invention, in order to realize the principle and the beneficial effect of the catenary contact line abnormity detection method based on image processing, the detection system of the catenary contact line abnormity detection method based on image processing comprises hardware structures and/or software modules corresponding to the execution of various functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware and/or combinations of hardware and computer software, where a function is performed in a hardware or computer software-driven manner, and that the function described may be implemented in any suitable manner for each particular application depending upon the particular application and design constraints imposed on the technology, but such implementation is not to be considered as beyond the scope of the present application.