Method and system for visual inspection of defects on the inner wall of a cable protection tube
Patent Information
- Application Number
- CN202611246262.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-17
- Publication Date
- 2026-10-30
AI Technical Summary
[0006]本发明的目的在于提供电缆保护管内壁缺陷视觉检测方法及系统用于解决在小直径塑料电缆保护管内壁视觉检测中,塑料内壁漫反射纹理、水渍反光边缘和泥沙颗粒边缘容易与裂纹、划伤、腐蚀和变形形成相近灰度突变,现有固定尺度候选提取和独立特征统计流程无法利用全局灰度状态修正局部尺度空间,也无法将候选提取阶段的差分响应传递至方向梯度统计阶段,导致候选区域过多、误判复核负担较大以及缺陷位置信息不够稳定的技术问题
[0059]本发明通过红色面光源沿定焦光学组件光学接收轴线同轴照射电缆保护管内壁,并根据第一灰度图像的全局灰度均值和灰度方差进行非线性灰度映射,使水膜反光高亮点、管内暗部和塑料内壁漫反射纹理对后续候选区域提取的影响降低;同时,通过灰度方差驱动基础尺度调节因子并构建尺度空间序列,使不同光照状态和内壁状态下的局部候选区域提取尺度能够随第一灰度图像的整体灰度波动状态调整,从而减少积水反光段和泥沙附着段产生的非缺陷候选区域。
Smart Images

Figure CN123015494A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine vision inspection and industrial non-destructive testing, specifically to a method and system for visual inspection of defects in the inner wall of cable protection pipes. Background Technology
[0002] Cable protection pipes are used in underground power cable laying, road crossings, industrial park power distribution channels, and municipal power duct projects. Common materials include PVC-C, MPP, and HDPE. During construction, transportation, heat fusion connection, cable pulling, and long-term underground service, the inner wall of cable protection pipes may develop sharp scratches, micro-cracks, chipping, localized corrosion and peeling, extrusion deformation, joint steps, and foreign matter adhesion. For protection pipes not yet fitted with cables, inner wall defects can scrape the cable sheath during subsequent cable pulling; for protection pipes already in use, inner wall deformation and foreign matter accumulation can increase cable removal resistance and may create localized stress concentrations at bends and joints.
[0003] The inner diameter of cable protection pipes is typically smaller than that of urban drainage pipes, gas pipes, and industrial transmission pipes. The pipes are also relatively long, and the reflected light from the inner wall is affected by the curved wall surface, diffuse reflection from the plastic material, specular reflection from the water film, and obstruction by silt. At the construction site, the area near the pipe opening is exposed to strong light from the wellhead, handheld lighting, dust, and condensation. When the image acquisition device enters the pipe, water droplet spots, silt particles, metal fragments, molding marks, and joint shadows will appear in the field of view. These targets, along with actual cracks or scratches, all appear as localized grayscale abrupt changes in the grayscale image. Relying solely on a fixed threshold or single edge detection easily leads to the misidentification of water film edges and silt edges as defects.
[0004] Existing pipe internal wall inspection solutions are mostly geared towards larger diameter pipes, typically relying on crawler vehicles, panoramic cameras, laser cross-section scanning, structured light measurement, or 3D point cloud reconstruction. These solutions offer sufficient installation space and measurement baselines for large-diameter pipes. However, for small-diameter plastic cable protection pipes, constraints such as internal space, bending radius, lighting arrangement, and cost make it difficult to directly deploy multi-camera, multi-laser, or long-baseline 3D measurement components. When using conventional endoscopic vision solutions, image enhancement, candidate region extraction, feature extraction, and classification are usually treated as independent processing steps. The lack of transferable image response data between these steps means that high-frequency abrupt changes identified in previous stages fail to continuously participate in feature statistics in subsequent stages.
[0005] In the scenario of inspecting the inner wall of small-diameter plastic cable protection pipes, the key issue in defect identification is not simply obtaining images of the pipe interior, but rather how to involve the global illumination state of the image in the extraction of local defect candidates and how to ensure that local differential responses continue to participate in defect feature construction when water stains, sediment adhesion, plastic inner wall molding patterns, and actual defects coexist in the same image frame. If the scale space is fixed, water accumulation or reflective sections will generate a large number of candidate connected regions; if the differential responses after the candidate regions are extracted are discarded, the directional gradient histogram features will assign similar weights to the edges of sediment and cracks, resulting in insufficient discriminative power of the input features of the subsequent classification network. Summary of the Invention
[0006] The purpose of this invention is to provide a visual inspection method and system for defects in the inner wall of cable protection pipes. This method addresses the technical problems encountered in visual inspection of the inner wall of small-diameter plastic cable protection pipes. These problems include the tendency for diffuse reflection textures, water stain reflective edges, and mud and sand particle edges on the plastic inner wall to form similar gray-level abrupt changes with cracks, scratches, corrosion, and deformation. Existing fixed-scale candidate extraction and independent feature statistics processes cannot utilize the global gray-level state to correct the local scale space, nor can they transfer the differential response from the candidate extraction stage to the directional gradient statistics stage. This results in an excessive number of candidate regions, a heavy burden of misjudgment verification, and unstable defect location information.
[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0008] The visual inspection method and system for defects in the inner wall of cable protection pipes includes the following:
[0009] Acquire the first grayscale image generated by the image acquisition device during the detection of the inner wall of the cable protection pipe, record the acquisition timestamp of the first grayscale image, and acquire the axial pulse counting sequence output by the ranging mechanism;
[0010] The global grayscale mean and grayscale variance are determined based on the first grayscale image. The first grayscale image is then subjected to nonlinear grayscale mapping based on the global grayscale mean and the grayscale variance to obtain a second grayscale image. A scale space sequence is then constructed based on the grayscale variance.
[0011] The scale space sequence is used to perform multi-scale smoothing and adjacent scale difference on the second grayscale image to obtain a candidate region map and a comprehensive difference magnitude matrix.
[0012] Based on the candidate region map, a defect sub-image is extracted. The basic gradient magnitude of the defect sub-image is modulated using the comprehensive difference magnitude matrix to obtain the directional gradient histogram feature. The directional gradient histogram feature is then fused with the gray-level co-occurrence matrix feature to obtain a fused feature vector.
[0013] The fused feature vector is input into the classification network, and combined with the acquisition timestamp and the axial pulse counting sequence, the defect type and defect location information are output.
[0014] As a preferred embodiment of the present invention, the first grayscale image is generated by a red surface light source, a fixed-focus optical component, and a photoelectric sensor chip disposed in the image acquisition device. The red surface light source coaxially illuminates the inner wall of the cable protection tube along the optical receiving axis of the fixed-focus optical component. The center wavelength of the red surface light source is 630nm to 680nm. The fixed-focus optical component receives the reflected light from the inner wall of the cable protection tube, and the photoelectric sensor chip converts the reflected light into the first grayscale image.
[0015] As a preferred embodiment of the present invention, the step of performing nonlinear gray-level mapping on the first gray-level image based on the global gray-level mean and the gray-level variance to obtain the second gray-level image includes:
[0016] The lower limit point and the upper limit point of gray-level mapping are determined based on the global gray-level mean and the gray-level variance.
[0017] Map the pixel grayscale values located between the lower limit point and the upper limit point of the grayscale mapping to a preset grayscale display range;
[0018] Compress the grayscale values of pixels that are below the lower limit of the grayscale mapping to a lower grayscale level;
[0019] The grayscale values of pixels above the upper limit of the grayscale mapping are compressed to the high grayscale end to obtain the second grayscale image.
[0020] As a preferred embodiment of the present invention, the step of constructing a scale-space sequence based on the gray-scale variance includes:
[0021] A basic scale adjustment factor is generated based on the gray-level variance, and the basic scale adjustment factor is negatively correlated with the gray-level variance.
[0022] Multiple Gaussian smoothed scales are generated based on the basic scale adjustment factor and the preset scale ratio, and the multiple Gaussian smoothed scales constitute the scale space sequence.
[0023] As a preferred embodiment of the present invention, the step of performing multi-scale smoothing and adjacent-scale difference on the second grayscale image according to the scale space sequence to obtain a candidate region map and a comprehensive difference magnitude matrix includes:
[0024] Gaussian smoothing is applied to the second grayscale image based on the scale space sequence to obtain a multi-layer smoothed image;
[0025] By subtracting two adjacent smoothed images, a multi-scale difference image is obtained;
[0026] The absolute values of the multi-scale difference images are taken separately and then weighted and superimposed to obtain the comprehensive difference magnitude matrix;
[0027] The candidate region map is obtained by threshold segmentation and connected component labeling of the comprehensive difference magnitude matrix.
[0028] As a preferred embodiment of the present invention, after threshold segmentation and connected component labeling of the comprehensive difference magnitude matrix to obtain the candidate region map, the method further includes:
[0029] Calculate the region area, bounding rectangle ratio, and roundness value for each candidate connected component;
[0030] When the roundness value is greater than the roundness threshold and the area value is less than the area threshold, the corresponding candidate connected region is marked as a non-defect foreign object region, and the non-defect foreign object region is deleted from the candidate region map.
[0031] As a preferred embodiment of the present invention, the step of modulating the basic gradient magnitude of the defect sub-image using the comprehensive differential magnitude matrix to obtain the directional gradient histogram feature includes:
[0032] The defect sub-image is divided into multiple cell units;
[0033] Calculate the fundamental gradient magnitude and gradient direction of the pixels in the defective sub-image;
[0034] The matrix magnitude corresponding to the defect sub-image in the comprehensive difference magnitude matrix is read as the spatial weight;
[0035] The basic gradient magnitude is modulated at the pixel level using the spatial weights to obtain a weighted gradient magnitude.
[0036] The weighted gradient magnitude is accumulated according to the quantization interval corresponding to the gradient direction to obtain the directional gradient histogram feature.
[0037] As a preferred embodiment of the present invention, the gray-level co-occurrence matrix features are obtained in the following manner:
[0038] The defective sub-image is compressed to grayscale.
[0039] The gray-level co-occurrence matrix is obtained by statistically analyzing the gray-level co-occurrence frequency based on multiple pixel displacements and multiple orientation angles.
[0040] Energy, contrast, correlation, and entropy are extracted from the gray-level co-occurrence matrix, and the energy, contrast, correlation, and entropy corresponding to each pixel displacement and each orientation angle are averaged to obtain the gray-level co-occurrence matrix features.
[0041] As a preferred embodiment of the present invention, the step of fusing the directional gradient histogram features with the gray-level co-occurrence matrix features to obtain a fused feature vector includes:
[0042] The directional gradient histogram features and the gray-level co-occurrence matrix features are normalized respectively;
[0043] The normalized directional gradient histogram features and the normalized gray-level co-occurrence matrix features are concatenated in a fixed order to obtain the fused feature vector;
[0044] The classification network is trained using a focal loss function and outputs the probability distribution of cracks, corrosion, scratches, deformation, and non-defect foreign objects.
[0045] As a preferred embodiment of the present invention, the step of combining the acquisition timestamp and the axial pulse counting sequence to output defect location information includes:
[0046] Convert the axial pulse counting sequence into physical axial distance;
[0047] Establish a mapping relationship between the physical axial distance and the acquisition timestamp of the first grayscale image;
[0048] The axial position of the defect is determined based on the acquisition timestamp corresponding to the candidate connected region in the candidate region map, and the axial position of the defect is output as part of the defect position information.
[0049] As a preferred embodiment of the present invention, after determining the global grayscale mean and grayscale variance of the first grayscale image, the method further includes:
[0050] Determine whether the global grayscale mean is within a preset effective range, and determine whether the grayscale variance is within a preset effective range;
[0051] When the global grayscale mean exceeds the preset mean effective range, or the grayscale variance exceeds the preset variance effective range, the first grayscale image is marked as an illumination abnormal frame, and the classification confidence of the illumination abnormal frame is reduced or a re-acquisition is triggered.
[0052] As a preferred embodiment of the present invention, the comprehensive differential amplitude matrix undergoes amplitude normalization processing before participating in the pixel-level modulation of the basic gradient amplitude. The amplitude normalization processing uses the maximum value, mean value, or quantile threshold of the comprehensive differential amplitude matrix as the normalization benchmark. The quantile threshold is the matrix amplitude located at a preset ratio position after all matrix amplitudes in the comprehensive differential amplitude matrix are arranged in ascending order. The ratio of the matrix amplitude of the corresponding pixel in the comprehensive differential amplitude matrix to the normalization benchmark is limited to a preset weight range [0,1]. Values exceeding the upper limit are taken as 1, and values below the lower limit are taken as 0. The limited ratio is used as a spatial weight to participate in the pixel-level modulation of the basic gradient amplitude.
[0053] As a preferred technical solution of the present invention, the cable protection pipe inner wall defect visual inspection system is used to implement the cable protection pipe inner wall defect visual inspection method as described above. The cable protection pipe inner wall defect visual inspection system includes an image acquisition device, a processing terminal and a display terminal.
[0054] The image acquisition device includes a cylindrical housing, a fixed-focus optical component, a photoelectric sensor chip, a red surface light source, and a ranging mechanism. The fixed-focus optical component, the photoelectric sensor chip, and the red surface light source are disposed within the cylindrical housing. The red surface light source is coaxially arranged along the optical receiving axis of the fixed-focus optical component. The photoelectric sensor chip is used to output a first grayscale image. The ranging mechanism is used to output an axial pulse counting sequence during the axial movement of the image acquisition device along the cable protection pipe.
[0055] The processing terminal is connected to the image acquisition device. The processing terminal is used to receive the first grayscale image and the axial pulse counting sequence. When receiving the first grayscale image, it records the acquisition timestamp, determines the global grayscale mean and grayscale variance of the first grayscale image, generates a second grayscale image based on the global grayscale mean and grayscale variance, constructs a scale space sequence based on the grayscale variance, generates a candidate region map and a comprehensive difference magnitude matrix based on the scale space sequence, extracts a defect sub-image based on the candidate region map, modulates the basic gradient magnitude of the defect sub-image using the comprehensive difference magnitude matrix to obtain the orientation gradient histogram feature, fuses the orientation gradient histogram feature with the grayscale co-occurrence matrix feature to obtain a fused feature vector, inputs the fused feature vector into a classification network to output the defect type, and converts the axial pulse counting sequence into physical axial distance to output defect location information.
[0056] The display terminal is connected to the processing terminal, and the display terminal is used to display a structured mapping diagram formed by the defect type and the defect location information.
[0057] In addition, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the visual inspection method for defects in the inner wall of cable protection pipes as described above.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] This invention uses a red surface light source to coaxially illuminate the inner wall of the cable protection pipe along the optical receiving axis of the fixed-focus optical component. It then performs nonlinear gray-scale mapping based on the global gray-scale mean and variance of the first gray-scale image. This reduces the impact of water film reflection highlights, dark areas inside the pipe, and diffuse reflection textures on the plastic inner wall on subsequent candidate region extraction. Simultaneously, by driving a basic scale adjustment factor through gray-scale variance and constructing a scale space sequence, the extraction scale of local candidate regions under different lighting and inner wall conditions can be adjusted according to the overall gray-scale fluctuation of the first gray-scale image, thereby reducing non-defect candidate regions generated by water accumulation reflection sections and silt adhesion sections.
[0060] This invention uses the comprehensive differential amplitude matrix simultaneously for candidate region map generation and directional gradient histogram feature statistics, so that the intensity of local mutations formed in the candidate extraction stage continues to be used as the basic gradient amplitude for spatial weight modulation, and is then input into the classification network after being fused with the gray-level co-occurrence matrix features. By combining candidate region morphology removal, illumination anomaly frame processing and axial pulse counting sequence localization, it can output defect type and defect location information corresponding to the axial distance of the cable protection pipe, reducing the burden of false judgment verification caused by mud and sand edges, water droplet edges and plastic molding textures. Attached Figure Description
[0061] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0062] Figure 1 This is a flowchart of the method of the present invention.
[0063] Figure 2 This is a flowchart of the image acquisition and display process of the present invention.
[0064] Figure 3 This is a flowchart of the grayscale mapping process of the present invention.
[0065] Figure 4 This is a flowchart of the scale-space sequence construction process of the present invention.
[0066] Figure 5This is a flowchart of the process for generating the comprehensive differential magnitude matrix of the present invention.
[0067] Figure 6 This is a complete flowchart of the defect feature fusion and classification localization of the present invention. Detailed Implementation
[0068] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the embodiments of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0069] The following is in conjunction with the appendix Figures 1-6 The embodiments of the present invention will be described in detail below.
[0070] Example 1: This example discloses a visual inspection system for defects in the inner wall of a cable protection pipe. The system includes an image acquisition device, a processing terminal, and a display terminal. The image acquisition device is used to enter the interior of the cable protection pipe and acquire images of the inner wall; the processing terminal is used to perform image processing, candidate region extraction, feature fusion, classification and recognition, and defect localization; the display terminal is used to display a structured mapping map formed by the defect type and defect location information output by the processing terminal.
[0071] The image acquisition device includes a cylindrical housing, a fixed-focus optical assembly, a photoelectric sensor chip, a red surface light source, an ambient light blocking mechanism, a flexible sealing ring, and a ranging mechanism. The cylindrical housing supports the fixed-focus optical assembly, the photoelectric sensor chip, and the red surface light source, and allows the image acquisition device to move axially along the cable protection conduit. For cable protection conduits with an inner diameter of 50mm to 100mm, the outer diameter of the cylindrical housing can be set to 42mm to 45mm, allowing the image acquisition device to pass through the conduit while preserving installation space for the red surface light source and the fixed-focus optical assembly.
[0072] A fixed-focus optical component is positioned at the front center of the cylindrical outer casing. This component employs a fixed focal length to avoid image scale changes caused by frequent autofocusing during movement within the tube. A red surface light source surrounds or is coaxially arranged with the fixed-focus optical component, illuminating the inner wall of the cable protection tube coaxially along the optical receiving axis of the component. The center wavelength of the red surface light source is between 630nm and 680nm; in this embodiment, it is 650nm. The diffuse reflection of red light on the plastic inner wall is relatively stable and reduces the impact of different color impurities on grayscale images compared to white light illumination. The surface lighting method of the red surface light source smooths the illumination changes at the center and edges of the field of view, reducing strong spots and long shadows formed by point light sources on the curved inner wall.
[0073] The photoelectric sensor chip is located at the rear end of the fixed-focus optical assembly. The fixed-focus optical assembly receives reflected light from the inner wall of the cable protection pipe, and the photoelectric sensor chip converts the reflected light into a first grayscale image. The first grayscale image can be an 8-bit grayscale image with a grayscale display range of 0 to 255. After receiving the first grayscale image, the processing terminal assigns a collection timestamp to the first grayscale image and establishes a mapping relationship between the collection timestamp and the axial pulse counting sequence output by the ranging mechanism.
[0074] An ambient light blocking mechanism is located at the rear end of the cylindrical housing, near the pipe opening when the image acquisition device enters the cable protection pipe. This mechanism blocks strong light from the wellhead, construction lighting, and handheld lights from entering the imaging field of view from the rear of the image acquisition device. The ambient light blocking mechanism may include an opaque annular retaining ring coaxially mounted with the cylindrical housing. This ring is located at the rear end of the cylindrical housing and obstructs the effective imaging field of view of the fixed-focus optical components. A flexible sealing ring is located on the outer periphery of the cylindrical housing. This ring maintains flexible contact or close contact with the inner wall of the cable protection pipe, reducing the entry of stray light and buffering radial swaying of the cylindrical housing as it moves within the pipe. The flexible sealing ring can be made of wear-resistant rubber, silicone, or a flexible brush ring. While the flexible sealing ring does not participate in image recognition calculations, it improves the stability of the global grayscale mean and grayscale variance in the first grayscale image.
[0075] The ranging mechanism outputs an axial pulse count sequence as the image acquisition device moves axially along the cable protection pipe. The ranging mechanism may include an encoder wheel, which contacts the inner wall of the cable protection pipe and rotates as the image acquisition device moves. Each pulse output by the encoder wheel corresponds to a preset pulse distance coefficient. The preset pulse distance coefficient is determined based on the circumference of the encoder wheel and the number of pulses per encoder revolution, specifically the circumference of the encoder wheel divided by the number of pulses per encoder revolution. In this embodiment, the example value for the preset pulse distance coefficient is 0.5 mm per pulse. The processing terminal obtains the physical axial distance based on the product of the number of axial pulses and the preset pulse distance coefficient. In the event of a short-term slippage of the encoder wheel, the processing terminal can determine whether the axial pulse count sequence is abnormal based on the acquisition timestamps of adjacent frames, the upper limit of the traction speed, and the change in the axial pulse count, and mark the abnormal segment as a segment requiring verification.
[0076] In this embodiment, the data transmission relationship between the image acquisition device, the processing terminal, and the display terminal is as follows: The image acquisition device transmits a first grayscale image and an axial pulse counting sequence to the processing terminal; the processing terminal records the acquisition timestamp upon receiving the first grayscale image, and performs grayscale statistics, nonlinear grayscale mapping, scale space sequence construction, multi-scale differencing, candidate region map generation, comprehensive difference magnitude matrix generation, defect sub-image cropping, feature fusion, and classification recognition on the first grayscale image; the processing terminal transmits the defect type, defect location information, and confidence level to the display terminal; the display terminal displays the structured mapping map. This data flow forms a continuous technical chain between image acquisition, image processing, defect classification, and location display.
[0077] Example 2: Based on Example 1, this example describes the grayscale mapping of the first grayscale image, the construction of the scale space sequence, the generation of the comprehensive difference magnitude matrix, and the generation of the candidate region map.
[0078] After receiving the first grayscale image, the processing terminal calculates the global grayscale mean and grayscale variance of the first grayscale image. Let the pixel coordinates in the first grayscale image be... The gray value at that location is The width of the first grayscale image is The height is The global grayscale mean is denoted as The variance of grayscale is denoted as The processing terminal calculates the global grayscale mean as follows:
[0079] ;
[0080] In the formula, Let represent the grayscale variance of the first grayscale image. Grayscale variance reflects the overall grayscale fluctuation in the first grayscale image. Sections with dry and rough inner walls (hereinafter referred to as dry-rough sections) typically have moderate grayscale variance; sections with water accumulation and specular reflection (hereinafter referred to as water-reflective sections) have increased grayscale variance due to the simultaneous presence of a bright water film and a dark background; and sections with insufficient illumination (hereinafter referred to as insufficiently illuminated sections) experience overall grayscale compression and decreased grayscale variance. The processing terminal uses the grayscale variance as an input variable for subsequent scale-space sequences, enabling the extraction scale of local candidate regions under different illumination and inner wall conditions to vary with the image state.
[0081] The processing terminal determines the lower and upper limits of gray-level mapping based on the global gray-level mean and variance. (Lower limit of gray-level mapping) Determine as follows:
[0082] ;
[0083] Grayscale mapping upper limit point Determine as follows:
[0084] ;
[0085] In the formula, This is the lower bound point of the grayscale mapping. This represents the upper limit point of grayscale mapping. The global grayscale mean. For grayscale variance, The standard deviation of grayscale This is a preset multiple. In this embodiment, the preset multiple is... Choose 2, with the preset grayscale display range being 0 to 255. The processing terminal compresses the grayscale values of pixels below the lower limit of the grayscale mapping to the low grayscale end, compresses the grayscale values of pixels above the upper limit of the grayscale mapping to the high grayscale end, and smoothly stretches the grayscale values of pixels between the lower and upper limits of the grayscale mapping to the preset grayscale display range, thus obtaining the second grayscale image.
[0086] Nonlinear grayscale mapping can employ a piecewise cubic smoothing method. Let the input pixel grayscale value be... The mapped output grayscale value is The piecewise cubic smoothing mapping at the lower limit point of the grayscale mapping and grayscale mapping upper limit point Cubic polynomial interpolation is used between them, and the following conditions are met: place and The continuity condition of the first derivative at a given point. For pixel gray values below the lower limit of gray-level mapping, the processing terminal maps the pixel gray values to the lower gray-level end, that is,... Pixel mapping to For pixel grayscale values higher than the upper limit of the grayscale mapping, the processing terminal maps the pixel grayscale value to the higher grayscale end, that is... Pixel mapping to For pixel grayscale values between the lower and upper limits of the grayscale mapping, the processing terminal maintains the first-order continuity of the mapping curve, ensuring that crack boundaries in the second grayscale image do not generate additional false edges due to hard truncation. To ensure that the constant mappings at the low and high grayscale ends are smoothly connected to the intermediate cubic polynomial smoothing, piecewise cubic smoothing is applied... place and The endpoint derivative can be set to 0. Under the condition that the endpoint derivative is 0, the lower limit point of grayscale mapping is... and grayscale mapping upper limit point Mapping function between To meet , , , A cubic polynomial. When lie in and When the interval is between, the mapping function can be written as:
[0087] ;
[0088] In the formula, To map and output grayscale values, For input pixel grayscale values, This is the lower bound point of the grayscale mapping. Let be the upper limit point of the grayscale mapping. The above expression satisfies four boundary conditions and ensures a smooth connection between the lower and upper limit points of the grayscale mapping.
[0089] The processing terminal generates a base scale adjustment factor based on the gray-level variance. The base scale adjustment factor is negatively correlated with the gray-level variance; the larger the gray-level variance, the smaller the base scale adjustment factor, with a limit approaching 1.0; the smaller the gray-level variance, the larger the base scale adjustment factor, with a limit approaching 2.0. When the gray-level variance is high, it indicates strong gray-level fluctuations in the first gray-level image. The processing terminal reduces the base scale adjustment factor to prevent the Gaussian smoothing scale from erasing fine crack boundaries due to over-smoothing. When the gray-level variance is low, it indicates weak overall gray-level changes in the first gray-level image. The processing terminal increases the base scale adjustment factor to enhance the scale space's stable response to low-contrast defects. In this embodiment, the base scale adjustment factor is denoted as... The processing terminal generates the basic scale adjustment factor as follows:
[0090] ;
[0091] In the formula, Basic scale adjustment factor Let V be the grayscale variance of the first grayscale image. This is the variance adjustment constant. It is a natural exponential function. The variance adjustment constant. This is used to adjust the influence of grayscale variance on the base scale adjustment factor. (In this embodiment...) The example value is 500.
[0092] The processing terminal generates a scale space sequence based on the basic scale adjustment factor and the preset scale ratio. The first [scale space sequence]... Each Gaussian smoothing scale is denoted as Generate as follows:
[0093] ;
[0094] In the formula, For the first Gaussian smoothing scale Based on Gaussian smoothing scale, The example value is 1.0 pixels. To pre-set the common ratio of the scale, Example values are Or 2.0, This is the scale number. , This represents the number of scales contained in the scale-space sequence. The example values are 4 to 6. This is the base scale adjustment factor. The scale space sequence includes multiple Gaussian smoothing scales. The processing terminal performs Gaussian smoothing on the second grayscale image according to the scale space sequence, resulting in a multi-layer smoothed image.
[0095] The processing terminal performs difference operations on adjacent smoothed images to obtain multi-scale difference images. Specifically, for two smoothed images with adjacent scale numbers in the scale-space sequence, the processing terminal subtracts the smoothed image of the larger scale number from the smoothed image of the smaller scale number layer, or subtracts the smoothed image of the smaller scale number layer from the smoothed image of the larger scale number layer, but the difference direction of all adjacent layers remains consistent. If the scale-space sequence contains... If the Gaussian smoothing scale is , then the number of adjacent layer pairs is That is, the number of multi-scale difference images ,in This represents the number of multi-scale difference images. Multi-scale difference images can highlight areas in the second grayscale image where the response changes significantly at adjacent scales. Cracks, scratches, and corrosion edges typically maintain directional differential responses across multiple adjacent scales, while water droplets and silt particles are more likely to form small-area, highly rounded local responses.
[0096] The processing terminal takes the absolute values of the multi-scale difference images and then performs a weighted superposition to obtain a comprehensive difference magnitude matrix. Let the first... Zhang's multi-scale difference image is The weights of the multi-scale difference image are The comprehensive difference magnitude matrix is denoted as The processing terminal then generates the comprehensive differential magnitude matrix as follows:
[0097] ;
[0098] In the formula, For the composite difference magnitude matrix in pixel coordinates The amplitude at that point, For the first Zhang's multi-scale difference image in pixel coordinates The difference at that point, For the first Weights of multi-scale difference images, The number of multi-scale difference images, The sequence number represents the multi-scale difference image. The x-coordinate is the pixel coordinate. The vertical coordinate is the pixel coordinate. This embodiment uses the default equal-weight stacking method, meaning that the weights of the difference images at each scale are taken as the same value. The processing terminal can also adjust the response stability to cracks, corrosion, and scratches based on the difference images at various scales in the defect training samples. The stability of the response can be measured by calculating the coefficient of variation of the amplitude response in the labeled defect region of the difference images at each scale. The coefficient of variation is the ratio of the standard deviation of the amplitude response to the mean of the amplitude response. The smaller the coefficient of variation, the lower the stability. The values are relatively high. The above weight adjustment method is optional and does not affect the fact that the processing terminal uses the default equal-weight superposition method to generate the comprehensive difference magnitude matrix.
[0099] The processing terminal performs threshold segmentation based on the matrix mean, matrix standard deviation, or quantile threshold of the comprehensive difference magnitude matrix to obtain binary candidate images. The matrix mean and matrix standard deviation are statistically obtained from all matrix magnitudes in the comprehensive difference magnitude matrix. The quantile threshold is the matrix magnitude located at a preset percentage position after all matrix magnitudes in the comprehensive difference magnitude matrix are arranged in ascending order. An example of this preset percentage position is 95%, meaning the 95th percentile matrix magnitude after ascending order is used as the quantile threshold. The processing terminal marks pixels with matrix magnitudes higher than the threshold as candidate pixels and pixels with matrix magnitudes lower than the threshold as background pixels. For detection sections with significant water reflection, the processing terminal preferentially uses the quantile threshold to avoid a few bright reflective points causing a shift in the matrix mean and matrix standard deviation. The processing terminal also considers the grayscale variance of the first grayscale image. Whether the current detection segment exceeds a preset variance threshold determines whether it belongs to a detection segment with obvious water accumulation and reflection. The preset variance threshold can be set according to the statistical results of the gray-scale variance of defect-free samples, which is the mean of the gray-scale variance of defect-free samples plus twice the standard deviation. For dry detection segments with relatively stable gray-scale changes, the processing terminal can use a combination of matrix mean and matrix standard deviation to determine the threshold, for example, by setting the threshold... Determine as follows:
[0100] ;
[0101] In the formula, The threshold for the comprehensive difference magnitude matrix, The mean of the combined difference magnitude matrix. The standard deviation of the composite difference magnitude matrix. This is the threshold adjustment coefficient. The example values range from 1.5 to 3.0.
[0102] The processing terminal performs connected component labeling, hole filling, and boundary closure on the binary candidate image to obtain a candidate region image. The candidate region image records the pixel set, circumscribed rectangle, center coordinates, region area, and boundary length for each candidate connected component. The candidate region image is not the final defect image, but rather an intermediate result used for subsequent defect sub-image cropping and feature extraction. The processing terminal synchronously caches the comprehensive difference magnitude matrix with the candidate region image, ensuring that the comprehensive difference magnitude matrix is not only used for threshold segmentation.
[0103] The processing terminal calculates the region area, bounding rectangle ratio, and roundness value for each candidate connected component. The region area represents the number of pixels contained in the candidate connected component. The bounding rectangle ratio represents the ratio between the long and short sides of the bounding rectangle of the candidate connected component; the ratio is calculated as the ratio of the long side length to the short side length, and a ratio of 1 indicates that the bounding rectangle is a square. The roundness value represents how close the candidate connected component is to a circle. Let the region area of the candidate connected component be... The perimeter of the candidate connected component is The roundness value is recorded as The processing terminal calculates the roundness value as follows:
[0104] ;
[0105] In the formula, This represents the roundness value of the candidate connected component. Let be the area value of the candidate connected region. Let be the perimeter of the candidate connected region. The value is pi. Circular water droplets, silt particles, and metal debris typically appear as small, highly rounded connected regions in the candidate region map; cracks and scratches typically appear as elongated connected regions; and corrosion peeling typically appears as irregularly shaped, sheet-like connected regions. Therefore, when the roundness value is greater than the roundness threshold and the area value is less than the area threshold, the processing terminal marks the corresponding candidate connected region as a non-defect foreign object region and deletes the non-defect foreign object region from the candidate region map. For candidate connected regions with an area greater than or equal to the area threshold, even if the roundness value is high, the processing terminal retains them to avoid mistakenly deleting large, near-circular real defects such as circular corrosion pits. In this embodiment, an example value for the roundness threshold is 0.90, and an example value for the area threshold is 120 pixels.
[0106] In the field verification sample, the processing terminal executed the process of this embodiment on 1200 frames of the first grayscale image. The test images included 400 frames of dry and rough sections, 300 frames of water accumulation and reflective sections, 300 frames of mud and sand adhesion sections, and 200 frames of joint misalignment sections.
[0107] Using a fixed Gaussian smoothing scale, that is, setting the above-mentioned basic scale adjustment factor... Always keep it at 1.0 and make it The threshold is a fixed threshold consisting of the mean of the comprehensive difference magnitude matrix plus one matrix standard deviation. The value is 4. Values , With a value of 1.0 pixel, an average of 18.6 candidate connected components are generated per frame in the water film reflection segment, with a large number of these components originating from the water film edge. After adopting the gray-scale variance-driven scale-space sequence of this embodiment, the average number of candidate connected components per frame in the water film reflection segment is reduced to 7.4; the manually verified candidate connected components for true defects remain within the original annotation range. These verification results demonstrate that the gray-scale variance-driven scale-space sequence can reduce the number of candidate regions caused by water film reflection while maintaining the true defect candidate responses.
[0108] Example 3: Based on Examples 1 and 2, this example describes the detection and processing of abnormal lighting frames, defect sub-image cropping, modulation direction gradient histogram features of the comprehensive differential amplitude matrix, amplitude normalization processing of the comprehensive differential amplitude matrix, gray-level co-occurrence matrix feature extraction, fusion feature vector construction, classification network training, and defect location information output.
[0109] After obtaining the candidate region map, the processing terminal first determines whether the first grayscale image is a frame with abnormal lighting. The processing terminal compares the global grayscale mean with the preset mean effective range and the grayscale variance with the preset variance effective range.
[0110] The preset effective range for the mean is determined based on the statistical results of the global grayscale mean in the defect-free sample segments. Specifically, it can be set to the mean of the global grayscale mean in the defect-free sample segments plus or minus two standard deviations. The defect-free sample segments are the image sets obtained by collecting and statistically analyzing known defect-free cable protection pipe sample segments before formal inspection. The preset effective range for the variance is determined based on the statistical results of the grayscale variance in the defect-free sample segments. Specifically, it can be set to the mean of the grayscale variance in the defect-free sample segments plus or minus two standard deviations. When the global grayscale mean exceeds the preset effective range for the mean, or the grayscale variance exceeds the preset effective range for the variance, the processing terminal marks the corresponding first grayscale image as an illumination anomaly frame.
[0111] For frames with abnormal lighting, the processing terminal can perform two processing methods. One method is to reduce the classification confidence, specifically by multiplying the maximum probability output by the classification network by a preset confidence reduction coefficient. In this embodiment, the example value of the preset confidence reduction coefficient is 0.5. The other method is to trigger re-acquisition, specifically by outputting a re-acquisition prompt to the image acquisition device, causing the image acquisition device to re-acquire the first grayscale image at the same or adjacent axial position. Through the above processing, strong reflections, occlusions, or instantaneous exposure anomalies will not be directly output as high-confidence defect results.
[0112] The processing terminal extracts a defect sub-image from the second grayscale image based on the coordinates of the candidate connected components in the candidate region map. The extraction range of the defect sub-image includes the bounding rectangle of the candidate connected component and a preset edge extension width, with an example value of 5 to 20 pixels. The preset edge extension width is used to preserve the normal inner wall texture near the defect edge, enabling the classification network to determine the difference between the candidate region and the surrounding texture.
[0113] For candidate connected components near the image boundary, if the preset edge expansion width exceeds the boundary of the second grayscale image, the processing terminal fills the excess portion with the average grayscale value of the neighboring background. The average grayscale value of the neighboring background is determined as follows: First, in the second grayscale image, an initial truncating window is obtained by expanding the preset edge expansion width outward from the bounding rectangle of the candidate connected component as the center; within the initial truncating window, a point located outside the bounding rectangle of the candidate connected component and whose corresponding grayscale value in the first grayscale image is within the lower limit of the grayscale mapping is selected. and grayscale mapping upper limit point The average grayscale value of the pixels between the two grayscale values is used as the fill value. If the initial cropping window extends beyond the boundary of the second grayscale image, the portion exceeding the boundary is not included in the average grayscale value calculation; only the effective pixels actually present within the initial cropping window are used. If no pixels satisfy the above conditions, the processing terminal uses the median grayscale value of the pixels outside the bounding rectangle of the candidate connected component as the fill value.
[0114] The processing terminal uniformly scales the defect sub-images to a fixed size, with an example value of 64×64 pixels. During uniform scaling, the aspect ratio of the candidate connected components is maintained. After scaling, the candidate connected components are centered in the fixed-size image, and any insufficient areas are filled with the average gray level of the neighboring background to prevent slender cracks from being deformed due to forced stretching. In this embodiment, the example value for the preset upper limit of the aspect ratio is 5. That is, when the ratio of the long side to the short side of the bounding rectangle of the candidate connected component exceeds 5, the processing terminal still maintains the aspect ratio during scaling. After scaling, the area occupied by the candidate connected component in the fixed size is correspondingly reduced, and the remaining area is filled with the average gray level of the neighboring background. The oriented gradient histogram features and gray-level co-occurrence matrix features are still statistically analyzed according to the complete fixed-size image.
[0115] The processing terminal extracts oriented gradient histogram features from the defect sub-image. The processing terminal divides the defect sub-image into multiple cell units, which can be 8×8 pixels or 16×16 pixels; in this embodiment, the cell unit size is 8×8 pixels. The processing terminal calculates the basic gradient magnitude and gradient direction at each pixel location. Let the defect sub-image be located at pixel coordinates... The gray value at that location is Horizontal grayscale difference is divided into Vertical grayscale difference is divided into The horizontal grayscale difference and the vertical grayscale difference are respectively determined by pixel coordinates. The grayscale difference between adjacent pixels in the horizontal and vertical directions is determined, and the calculation method is as follows:
[0116] ;
[0117] ;
[0118] In the formula, pixel coordinates Horizontal grayscale difference at the location, pixel coordinates Vertical grayscale difference at the location, For the defective sub-image in pixel coordinates The grayscale value at that location. When the pixel coordinates... When the pixel is located in the first row, last row, first column, or last column of a defective sub-image, center difference cannot be used. The processing terminal then uses forward or backward difference instead: For pixels in the first row, take... For the last row of pixels, take ,in The height of the defective sub-image; for the first column of pixels, take... For the last column of pixels, take ,That The width of the defect sub-image. For the four corner pixels of the defect sub-image, the processing terminal performs forward or backward difference on the horizontal grayscale difference of the four corner pixels, corresponding to the beginning or end of the row, and forward or backward difference on the vertical grayscale difference, corresponding to the beginning or end of the column.
[0119] Basic gradient magnitude Calculate as follows:
[0120] ;
[0121] In the formula, pixel coordinates The basic gradient magnitude at that location.
[0122] gradient direction Calculate as follows:
[0123] ;
[0124] In the formula, pixel coordinates gradient direction at that point To determine the arctangent function for each quadrant based on the horizontal and vertical gray-level differences, The output range is The processing terminal maps the gradient direction to an unsigned directional range. :when At that time, take ;when At that time, take Ordinary directional gradient histogram features directly accumulate the basic gradient magnitude over a directional interval, while this embodiment further utilizes a comprehensive differential magnitude matrix to modulate the basic gradient magnitude. The directional quantization interval is within the unsigned directional range. With equal division within the inner space, each directional interval covers 9 directions. rad, which is 20°; with 12 directional intervals, each directional interval covers rad, which is 15°.
[0125] The processing terminal reads the matrix magnitudes corresponding to the pixel positions of the defect sub-image from the comprehensive difference magnitude matrix. Since the comprehensive difference magnitude matrix and the second grayscale image share the same pixel coordinate reference, the processing terminal can determine the matrix magnitude corresponding to each pixel based on the cropped coordinates of the defect sub-image. The processing terminal converts the matrix magnitudes of the corresponding pixels in the comprehensive difference magnitude matrix into spatial weights and uses these spatial weights to perform pixel-level modulation of the basic gradient magnitudes to obtain the weighted gradient magnitudes. The weighted gradient magnitudes are denoted as... The processing terminal can perform modulation in the following manner:
[0126] ;
[0127] In the formula, pixel coordinates The weighted gradient magnitude at that point, pixel coordinates The basic gradient magnitude at that point, For the composite difference magnitude matrix in pixel coordinates Matrix magnitude at that location, This is the amplitude stability constant. This is used to avoid unstable modulation when the overall differential amplitude is small.
[0128] In this embodiment, the mean of the matrix is the arithmetic mean of the magnitudes of all matrices in the comprehensive difference magnitude matrix; when the mean of the matrix is greater than 10.0, The example value is 0.1 times the mean of the matrix; when the mean of the matrix is not greater than 10.0, The example value is 1.0. The processing terminal accumulates the weighted gradient magnitude according to the quantization interval corresponding to the gradient direction to obtain the directional gradient histogram feature. The processing terminal concatenates the directional gradient histograms of all cells in the defect sub-image in a fixed spatial order to form the directional gradient histogram feature vector. The concatenation order is consistent with the row and column scanning order of the cells in the defect sub-image. The directional quantization interval can be set to 9 or 12 directional intervals. For example, when the defect sub-image size is 64×64 pixels, the cell size is 8×8 pixels, and the number of directional quantization intervals is 9, the defect sub-image contains 64 cells, and the directional gradient histogram feature vector is 576-dimensional. The dimension of the directional gradient histogram feature vector is determined by the selected fixed size, cell size, and number of directional quantization intervals, and remains consistent during the training and inference phases.
[0129] In some implementations, the comprehensive difference magnitude matrix undergoes magnitude normalization before the input directional gradient histogram feature statistics. The magnitude normalization uses the maximum value, mean, or quantile threshold of the comprehensive difference magnitude matrix as the normalization benchmark. When there are a few highly reflective pixels in the first grayscale image, the quantile threshold is preferentially used as the normalization benchmark to avoid individual high-brightness points dominating the normalization result; when the overall response of the first grayscale image is relatively uniform, the maximum value or mean of the matrix can be used as the normalization benchmark. The preset ratio of the quantile threshold can be 95%. The processing terminal limits the ratio of the matrix magnitude of the corresponding pixel in the comprehensive difference magnitude matrix to the normalization benchmark within a preset weight range [0,1]. Values exceeding the upper limit are assigned a value of 1, and values below the lower limit are assigned a value of 0. This limited ratio is used as a spatial weight to participate in the pixel-level modulation of the basic gradient magnitude. This normalization method avoids excessive spatial weights caused by individual highly reflective points and makes the directional gradient histogram features between different frames comparable.
[0130] The processing terminal extracts gray-level co-occurrence matrix features from the defect sub-image. The processing terminal first performs gray-level compression on the defect sub-image, which can be compressed to 32 or 64 gray levels.
[0131] The processing terminal calculates the gray-level co-occurrence frequency based on multiple pixel displacements and multiple orientation angles to obtain a gray-level co-occurrence matrix. The gray-level co-occurrence frequency is the number of times two pixel gray-level values appear together under a specified displacement and orientation angle. Pixel displacements can be set to 1, 2, and 4 pixels; orientation angles can be set to 0°, 45°, 90°, and 135°, with 0° defined as the horizontal direction to the right in the defect sub-image, and counter-clockwise rotation as positive. The processing terminal extracts energy, contrast, correlation, and entropy values from the gray-level co-occurrence matrix. Since the gray-level co-occurrence matrix is constructed separately for multiple pixel displacements and multiple orientation angles, the processing terminal takes the arithmetic mean of the values of the same feature parameter under different pixel displacements and orientation angles to obtain a scalar value for each of the final energy, contrast, correlation, and entropy values. Energy reflects the concentration of gray-level co-occurrence distribution, contrast reflects local gray-level differences, correlation reflects gray-level spatial correlation, and entropy reflects texture complexity. Corrosion and spalling regions typically exhibit high contrast and entropy values, while water droplet regions typically possess high energy and relatively regular boundaries. Crack regions show a clear directional concentration in their directional gradient histogram features.
[0132] The processing terminal performs normalization processing on the directional gradient histogram features and the gray-level co-occurrence matrix features respectively. The normalization processing can use max-min normalization or mean-variance normalization. This embodiment uses max-min normalization, that is, linearly mapping each component value in the directional gradient histogram feature vector to the interval [0,1], and linearly mapping the four scalar values of energy, contrast, correlation and entropy in the gray-level co-occurrence matrix features to the interval [0,1] respectively.
[0133] The processing terminal concatenates the normalized Histogram of Oriented Gradients (HGP) features and the normalized Gray-Level Co-occurrence Matrix (GLCM) features in a fixed order to obtain a fused feature vector. This fixed order can be configured such that the HGP features are placed first, followed by the GLCM features. The GLCM features include four scalar values: energy, contrast, correlation, and entropy. When the HGP feature vector is 576-dimensional, the fused feature vector is 580-dimensional. The processing terminal inputs the fused feature vector into a classification network, which outputs the probability distributions of cracks, corrosion, scratches, deformation, and non-defect foreign objects.
[0134] The classification network can include an input layer, at least one fully connected layer, a non-linear activation layer, and an output layer. The number of nodes in the input layer is consistent with the dimension of the fused feature vector, and the number of nodes in the output layer is consistent with the number of defect type categories output by the classification network. For example, when the fused feature vector is 580-dimensional and the output categories are cracks, corrosion, scratches, deformation, and non-defect foreign objects, the number of input layer nodes corresponds to the 580-dimensional fused feature vector, and the number of output layer nodes corresponds to the five output categories. The classification network is trained using a focal loss function to reduce the training inhibition on a small number of real defect samples when there are many non-defect foreign object samples. The focal loss function is denoted as... The processing or training terminal calculates the focus loss function as follows:
[0135] ;
[0136] In the formula, The value of the focus loss function. For category weight coefficients, The example value is 0.25. The probability value output by the classification network for the true category. Adjustment index for difficult-to-classify samples, The example value is 2.0. The function is the natural logarithm. Category weight coefficients. The adjustment index for hard-classified samples is used to adjust the weights of different defect categories during training. This is used to improve the attention that classification networks pay to difficult-to-classify samples.
[0137] After the classification network is trained, the processing terminal inputs the fused feature vectors into the classification network to obtain the probabilities of each category. If the maximum category probability is not lower than a preset reliability threshold, the processing terminal outputs the defect type corresponding to the maximum category probability. In this embodiment, the example value of the preset reliability threshold is 0.7. If the maximum category probability is lower than the preset reliability threshold, the processing terminal marks the corresponding candidate region as a region to be reviewed. The preset reliability threshold can be selected based on the receiver operating characteristic (ROC) curve of the classification network on the validation set to achieve a target balance between recall and precision.
[0138] The processing terminal determines the defect location information based on the candidate region map and the axial pulse count sequence output by the ranging mechanism. The candidate region map provides the pixel coordinates of the defect sub-image in the second grayscale image, and the ranging mechanism provides the axial pulse count sequence of the image acquisition device in the cable protection pipe. The processing terminal converts the axial pulse count sequence into physical axial distance and establishes a mapping relationship between the physical axial distance and the acquisition timestamp of the first grayscale image.
[0139] When the acquisition timestamp of the first grayscale image coincides with the pulse count time of a certain axis, the processing terminal directly reads the corresponding physical axial distance. When the acquisition timestamp of the first grayscale image is between two adjacent axial pulse count times, the processing terminal performs linear interpolation based on the physical axial distances corresponding to the two adjacent axial pulse count times to obtain the physical axial distance corresponding to the first grayscale image. The processing terminal outputs the candidate connected component center coordinates, defect type, confidence level, and physical axial distance together as the defect location information.
[0140] The display terminal generates a structured mapping map based on the defect type and location information output by the processing terminal. The structured mapping map can include a two-dimensional unfolded view of the cable protection pipe, a list of axial distances, color-coded defect categories, and markings for areas requiring review. Construction personnel can use the structured mapping map to locate the pipe sections that need cleaning, review, or repair. If the same type of defect appears in multiple consecutive frames at the same axial location, the processing terminal can merge multiple candidate areas into a single defect segment and output the start and end points of the defect segment, as well as its maximum confidence level.
[0141] The engineering inspection object in this embodiment is an MPP cable protection pipe for laying 10 kV power cables, with a length of 150m and an inner diameter of 75mm. During the on-site inspection, the processing terminal detected a dark, thin linear area and adjacent silt particles at 26.3m. The silt particles in the candidate region image have high roundness and small area, and were deleted by the morphological elimination process. The dark, thin linear area maintains a high directional response in the comprehensive differential amplitude matrix and is classified as a crack after fusion of the directional gradient histogram feature and the gray-level co-occurrence matrix feature. At 58.7m, the processing terminal detected a bright circular spot and an irregular dark spot. The bright circular spot was classified as a non-defect foreign object, and the irregular dark spot was classified as corrosion. At 92.1m, the processing terminal detected a large area of water film reflection. The global gray-level mean and gray-level variance of the corresponding first gray-level image both exceeded the effective range. The processing terminal marked the corresponding frame as an abnormal illumination frame and reduced the classification confidence or triggered a re-acquisition.
[0142] This embodiment uses cable protection pipe samples made of PVC, MPP, and HDPE materials to establish training and test data, with inner diameters ranging from 50mm to 100mm. In this embodiment, defect sub-images are uniformly scaled to a fixed size of 64×64 pixels. The training data includes 6800 defect sub-images, including 1200 images of cracks, 1100 of corrosion, 1300 of scratches, 900 of deformation, and 2300 of non-defect foreign objects. The test data includes 1700 defect sub-images. In the test results, the recall rate for cracks was 92.4%, for scratches 94.1%, for corrosion 89.7%, for deformation 88.3%, and for non-defect foreign objects 93.6%. In continuous on-site inspection of a 150m long MPP cable protection pipe, this embodiment averaged 0.38 areas to be checked per meter; without using the comprehensive differential amplitude matrix to modulate the basic gradient amplitude, the average number of areas to be checked per meter was 1.15. The above results show that after the comprehensive difference magnitude matrix is transferred from the candidate region extraction stage to the directional gradient statistics stage, the number of regions to be verified caused by the edges of sediment and water droplets can be reduced.
[0143] This embodiment forms the following continuous data chain: a red surface light source and a fixed-focus optical component generate a first grayscale image; a processing terminal records the acquisition timestamp of the first grayscale image; a ranging mechanism outputs an axial pulse counting sequence; the first grayscale image generates a global grayscale mean and grayscale variance; the global grayscale mean and grayscale variance are used to generate a second grayscale image; the grayscale variance is used to generate a basic scale adjustment factor; the basic scale adjustment factor is used to generate a scale space sequence; the scale space sequence is used to generate a multi-layer smoothed image and a multi-scale difference image; the multi-scale difference image is used to generate a comprehensive difference magnitude matrix; the comprehensive difference magnitude matrix is used to generate a candidate region map and to modulate the basic gradient magnitude; the candidate region map is used to extract a defect sub-image; the defect sub-image is used to generate directional gradient histogram features and gray-level co-occurrence matrix features; the directional gradient histogram features and gray-level co-occurrence matrix features are used to generate a fused feature vector; the fused feature vector is used by the classification network to output the defect type; the axial pulse counting sequence and the acquisition timestamp are used to output defect location information; and the display terminal displays a structured mapping map based on the defect type and defect location information.
[0144] In some implementations, the red surface light source can be a narrowband red light guide plate, a narrowband red light emission array, or a coaxial red light array structure. A light-shielding ring can be provided between the red surface light source and the fixed-focus optical component to reduce glare caused by the red surface light source directly hitting the fixed-focus optical component. The center wavelength of the red surface light source remains in the range of 630nm to 680nm.
[0145] In some implementations, the ranging mechanism may employ an encoder wheel, a traction reel encoder, or an external ranging encoder. Regardless of the ranging structure used, the ranging mechanism outputs an axial pulse counting sequence to the processing terminal. The processing terminal calculates the physical axial distance based on the axial pulse counting sequence and a preset pulse distance coefficient, and establishes a mapping relationship between the physical axial distance and the acquisition timestamp of the first grayscale image.
[0146] In some implementations, the fixed size of the defect sub-image can be uniformly set to 128×128 pixels. When using 128×128 pixels, the same input size is maintained during the training and inference processes of the same classification network. The cell partitioning of the oriented gradient histogram features, the extraction of gray-level co-occurrence matrix features, and the order of concatenating the fused feature vectors are re-determined according to the same rules, without changing the processing relationship of the modulation of the basic gradient magnitude by the comprehensive difference magnitude matrix. It should be noted that the choice of fixed size will affect the dimensions of the oriented gradient histogram features and the gray-level co-occurrence matrix features, thereby affecting the total dimension of the fused feature vector and the number of nodes in the input layer of the classification network. Those skilled in the art, after selecting a fixed size, should recalculate the feature dimensions and adjust the classification network structure accordingly according to the same cell partitioning rules and gray-level co-occurrence matrix statistical rules; once a fixed size is selected, it should remain consistent during the training and inference phases.
[0147] In some implementations, the classification network output categories can be expanded to include cracks, corrosion, scratches, deformation, joint misalignment, internal wall burrs, and non-defect foreign objects. Training samples for the newly added categories can be obtained by cropping defect sub-images in the same manner as in Example 3, extracting directional gradient histogram features and gray-level co-occurrence matrix features, and then training the classification network together with the original categories.
[0148] In some implementations, the processing terminal can perform axial consistency verification on candidate region maps of adjacent acquisition timestamps. If multiple consecutive frames near the same axial position contain candidate regions with the same direction and category, the processing terminal increases the confidence level of the corresponding defect segment; if a single frame contains a candidate region with a small area, high roundness, and discontinuous behavior in adjacent frames, the processing terminal decreases the confidence level of the corresponding candidate region or marks the corresponding candidate region as a non-defect foreign object.
[0149] In some implementations, the structured mapping displayed on the terminal includes a two-dimensional unfolded diagram and an axial list. The two-dimensional unfolded diagram is laid out along the axis of the cable protection conduit, using different colors to represent cracks, corrosion, scratches, deformation, and areas to be reviewed; the axial list records the defect start point, defect end point, defect type, confidence level, corresponding frame number, and review suggestions. The display terminal can also generate an on-site review path based on the defect location information.
[0150] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.
[0151] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. It should be noted that any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A visual inspection method for defects in the inner wall of cable protection pipes, characterized in that, include: Acquire the first grayscale image generated by the image acquisition device during the detection of the inner wall of the cable protection pipe, record the acquisition timestamp of the first grayscale image, and acquire the axial pulse counting sequence output by the ranging mechanism; The global grayscale mean and grayscale variance are determined based on the first grayscale image. The first grayscale image is then subjected to nonlinear grayscale mapping based on the global grayscale mean and the grayscale variance to obtain a second grayscale image. A scale space sequence is then constructed based on the grayscale variance. The scale space sequence is used to perform multi-scale smoothing and adjacent scale difference on the second grayscale image to obtain a candidate region map and a comprehensive difference magnitude matrix. Based on the candidate region map, a defect sub-image is extracted. The basic gradient magnitude of the defect sub-image is modulated using the comprehensive difference magnitude matrix to obtain the directional gradient histogram feature. The directional gradient histogram feature is then fused with the gray-level co-occurrence matrix feature to obtain a fused feature vector. The fused feature vector is input into the classification network, and combined with the acquisition timestamp and the axial pulse counting sequence, the defect type and defect location information are output.
2. The visual inspection method for defects in the inner wall of cable protection pipe according to claim 1, characterized in that: The first grayscale image is generated by a red surface light source, a fixed-focus optical component, and a photoelectric sensor chip disposed in the image acquisition device. The red surface light source coaxially illuminates the inner wall of the cable protection tube along the optical receiving axis of the fixed-focus optical component. The center wavelength of the red surface light source is 630nm to 680nm. The fixed-focus optical component receives the reflected light from the inner wall of the cable protection tube, and the photoelectric sensor chip converts the reflected light into the first grayscale image.
3. The visual inspection method for defects in the inner wall of cable protection pipe according to claim 1, characterized in that: The step of performing nonlinear gray-level mapping on the first gray-level image based on the global gray-level mean and the gray-level variance to obtain the second gray-level image includes: The lower limit point and the upper limit point of gray-level mapping are determined based on the global gray-level mean and the gray-level variance. Map the pixel grayscale values located between the lower limit point and the upper limit point of the grayscale mapping to a preset grayscale display range; Compress the grayscale values of pixels that are below the lower limit of the grayscale mapping to a lower grayscale level; The grayscale values of pixels above the upper limit of the grayscale mapping are compressed to the high grayscale end to obtain the second grayscale image.
4. The visual inspection method for defects in the inner wall of cable protection pipe according to claim 1, characterized in that: The step of constructing a scale-space sequence based on the gray-level variance includes: A basic scale adjustment factor is generated based on the gray-level variance, and the basic scale adjustment factor is negatively correlated with the gray-level variance. Multiple Gaussian smoothed scales are generated based on the basic scale adjustment factor and the preset scale ratio, and the multiple Gaussian smoothed scales constitute the scale space sequence.
5. The method for visually inspecting defects in the inner wall of a cable protection pipe according to claim 1, characterized in that: The step of performing multi-scale smoothing and adjacent-scale differencing on the second grayscale image based on the scale space sequence to obtain a candidate region map and a comprehensive difference magnitude matrix includes: Gaussian smoothing is applied to the second grayscale image based on the scale space sequence to obtain a multi-layer smoothed image; By subtracting two adjacent smoothed images, a multi-scale difference image is obtained; The absolute values of the multi-scale difference images are taken separately and then weighted and superimposed to obtain the comprehensive difference magnitude matrix; The candidate region map is obtained by threshold segmentation and connected component labeling of the comprehensive difference magnitude matrix.
6. The method for visual inspection of defects in the inner wall of a cable protection pipe according to claim 5, characterized in that: After performing threshold segmentation and connected component labeling on the comprehensive difference magnitude matrix to obtain the candidate region map, the method further includes: Calculate the region area, bounding rectangle ratio, and roundness value for each candidate connected component; When the roundness value is greater than the roundness threshold and the area value is less than the area threshold, the corresponding candidate connected region is marked as a non-defect foreign object region, and the non-defect foreign object region is deleted from the candidate region map.
7. The visual inspection method for defects in the inner wall of cable protection pipe according to claim 1, characterized in that: The process of modulating the base gradient magnitude of the defect sub-image using the comprehensive differential magnitude matrix to obtain directional gradient histogram features includes: The defect sub-image is divided into multiple cell units; Calculate the fundamental gradient magnitude and gradient direction of the pixels in the defective sub-image; The matrix magnitude corresponding to the defect sub-image in the comprehensive difference magnitude matrix is read as the spatial weight; The basic gradient magnitude is modulated at the pixel level using the spatial weights to obtain a weighted gradient magnitude. The weighted gradient magnitude is accumulated according to the quantization interval corresponding to the gradient direction to obtain the directional gradient histogram feature.
8. The method for visual inspection of defects in the inner wall of a cable protection pipe according to claim 1, characterized in that, The gray-level co-occurrence matrix features are obtained in the following way: The defective sub-image is compressed to grayscale. The gray-level co-occurrence matrix is obtained by statistically analyzing the gray-level co-occurrence frequency based on multiple pixel displacements and multiple orientation angles. Energy, contrast, correlation, and entropy are extracted from the gray-level co-occurrence matrix, and the energy, contrast, correlation, and entropy corresponding to each pixel displacement and each orientation angle are averaged to obtain the gray-level co-occurrence matrix features.
9. The visual inspection method for defects in the inner wall of a cable protection pipe according to claim 1, characterized in that: The process of fusing the directional gradient histogram features with the gray-level co-occurrence matrix features to obtain a fused feature vector includes: The directional gradient histogram features and the gray-level co-occurrence matrix features are normalized respectively; The normalized directional gradient histogram features and the normalized gray-level co-occurrence matrix features are concatenated in a fixed order to obtain the fused feature vector; The classification network is trained using a focal loss function and outputs the probability distribution of cracks, corrosion, scratches, deformation, and non-defect foreign objects.
10. A visual inspection system for defects in the inner wall of cable protection pipes, characterized in that: The cable protection pipe inner wall defect visual inspection system is used to implement the cable protection pipe inner wall defect visual inspection method according to claim 1. The cable protection pipe inner wall defect visual inspection system includes an image acquisition device, a processing terminal and a display terminal. The image acquisition device includes a cylindrical housing, a fixed-focus optical component, a photoelectric sensor chip, a red surface light source, and a ranging mechanism. The fixed-focus optical component, the photoelectric sensor chip, and the red surface light source are disposed within the cylindrical housing. The red surface light source is coaxially arranged along the optical receiving axis of the fixed-focus optical component. The photoelectric sensor chip is used to output a first grayscale image. The ranging mechanism is used to output an axial pulse counting sequence during the axial movement of the image acquisition device along the cable protection pipe. The processing terminal is connected to the image acquisition device. The processing terminal is used to receive the first grayscale image and the axial pulse counting sequence. When receiving the first grayscale image, it records the acquisition timestamp, determines the global grayscale mean and grayscale variance of the first grayscale image, generates a second grayscale image based on the global grayscale mean and grayscale variance, constructs a scale space sequence based on the grayscale variance, generates a candidate region map and a comprehensive difference magnitude matrix based on the scale space sequence, extracts a defect sub-image based on the candidate region map, modulates the basic gradient magnitude of the defect sub-image using the comprehensive difference magnitude matrix to obtain the orientation gradient histogram feature, fuses the orientation gradient histogram feature with the grayscale co-occurrence matrix feature to obtain a fused feature vector, inputs the fused feature vector into a classification network to output the defect type, and converts the axial pulse counting sequence into physical axial distance to output defect location information. The display terminal is connected to the processing terminal, and the display terminal is used to display a structured mapping diagram formed by the defect type and the defect location information.
