Cable sheath surface defect real-time detection and classification system based on machine vision
By integrating linear array image acquisition, adaptive illumination compensation, multi-level defect detection and feature extraction, and a hybrid classification model, the real-time and accuracy problems of cable sheath surface defect detection on high-speed production lines have been solved, achieving efficient and accurate defect detection and classification, and meeting the real-time feedback requirements of the production line.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HENAN GUOWANG CABLE GRP CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-05
AI Technical Summary
On high-speed continuous production lines, existing technologies struggle to achieve high-precision, robust, and low-latency real-time detection and classification of surface defects in cable sheaths, limited by factors such as image acquisition quality, lighting effects, and the difficulty in balancing real-time detection with classification accuracy.
The system employs a linear array image acquisition module, an adaptive illumination compensation module, an image preprocessing and enhancement module, a multi-level defect detection and feature extraction module, and a real-time classification decision module. It combines a hybrid classification model of support vector machine and shallow convolutional neural network to construct an end-to-end closed-loop system, achieving high-quality image acquisition, rapid feature extraction, and accurate classification.
Under high-speed motion and complex lighting conditions, high-precision, low-latency detection and classification of cable sheath surface defects were achieved, improving the automation and intelligence level of the production line and ensuring real-time feedback and control of the detection results.
Smart Images

Figure CN121981998A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine image detection technology, specifically relating to a real-time detection and classification system for surface defects in cable sheaths based on machine vision. Background Technology
[0002] Machine vision and artificial intelligence technologies are playing an increasingly important role in industrial automation and quality inspection. By simulating the human visual system and combining it with powerful data processing capabilities, they enable rapid, non-contact assessment of the appearance, dimensions, and surface quality of products on the production line. Image processing-based automatic surface defect detection technology has become a key means to improve the intelligence level of manufacturing and the accuracy of product quality control.
[0003] Automated inspection of surface defects in cable sheaths is a crucial step in ensuring the safety of power transmission and the reliability of cable products. This technology aims to acquire visual information about the cable sheath surface through image acquisition devices and utilize image processing and pattern recognition algorithms to automatically identify and classify various defects such as scratches, dents, bulges, and embedded impurities, replacing the inefficient, subjective, and fatigue-prone traditional method of relying on manual visual inspection.
[0004] Existing technologies typically employ fixed industrial cameras for image acquisition, combined with traditional image processing algorithms or deep learning models based on convolutional neural networks for defect identification. However, in real-world scenarios involving high-speed operation on continuous production lines, existing solutions suffer from the following problems: image blurring and incomplete acquisition caused by high-speed motion significantly reduce the quality of the original image; complex lighting environments and the reflective properties of cable surfaces result in insufficient robustness of feature extraction; traditional classification algorithms have limited ability to distinguish between minute defects and backgrounds with similar textures, while deep learning methods are constrained by the contradiction between real-time requirements and the scarcity of labeled data.
[0005] Existing systems often loosely couple image acquisition, processing, and classification modules, lacking end-to-end optimization for production line cycles. This results in high detection latency and difficulty in achieving true real-time feedback and control. Therefore, how to achieve high-precision, robust, and low-latency real-time detection and classification of cable sheath surface defects in high-speed industrial environments has become an urgent technical challenge. Summary of the Invention
[0006] The purpose of this invention is to provide a real-time detection and classification system for surface defects of cable sheaths based on machine vision, so as to solve the technical contradictions of low efficiency in automated detection of surface defects of cable sheaths in high-speed continuous production line scenarios, which are caused by the influence of motion and lighting on image acquisition quality, insufficient robustness of defect feature extraction, and difficulty in balancing real-time detection and classification accuracy.
[0007] To achieve the above objectives, the present invention provides a real-time detection and classification system for surface defects in cable sheaths based on machine vision, comprising: Linear array image acquisition module, used to acquire complete image data of the sheath surface of the cable during continuous movement; An adaptive illumination compensation module is used to eliminate the interference of uneven ambient lighting and reflections from the cable sheath surface on imaging quality. The image preprocessing and enhancement module receives the raw image data stream from the linear array image acquisition module and performs a series of operations aimed at improving the signal-to-noise ratio of the defective area. The multi-level defect detection and feature extraction module adopts a cascaded architecture to perform coarse-to-fine defect localization and feature quantization on the preprocessed image; The real-time classification decision module receives high-dimensional feature vectors from the multi-level defect detection and feature extraction module and performs the final accurate classification of defect types and confidence assessment. The system control and feedback execution module serves as the scheduling center and execution terminal for the entire system.
[0008] Preferably, the linear array image acquisition module includes a linear array camera, a pulse triggering unit synchronized with the main shaft encoder of the production line, and a laser ranging unit for auxiliary positioning; The line scan camera is installed vertically along the cable axis, and the line frequency is collected in strict synchronization with the pulse signal output by the encoder through the pulse triggering unit; The laser ranging unit measures the working distance between the cable surface and the camera lens in real time and feeds the working distance data back to the autofocus servo mechanism of the camera lens to dynamically compensate for the change in imaging focal length caused by the radial runout of the cable.
[0009] Preferably, the illumination adaptive compensation module includes a ring-shaped multi-zone programmable light source and an embedded light intensity sensor array. The ring light source is arranged around the linear array camera lens, and the light-emitting surface is divided into multiple independently controlled light-emitting zones. The embedded light intensity sensor array is integrated inside the light source and is arranged in a ring to monitor the light intensity projected onto the cable surface in real time from all directions. The adaptive illumination compensation module incorporates an illumination equalization control algorithm. The algorithm aims to obtain a uniform illumination grayscale distribution, reads data from each sensor in real time, calculates the uniformity deviation of the current illumination field, and dynamically adjusts the driving current of each luminous zone until all sensor readings reach the preset equalization threshold range.
[0010] Preferably, the image preprocessing and enhancement module first performs background estimation and subtraction based on a Gaussian model to eliminate periodic interference from the cable sheath substrate texture; Next, an adaptive contrast stretching algorithm based on local gray-level statistics is adopted. This adaptive contrast stretching algorithm divides the image into multiple overlapping sub-regions, calculates the mean and standard deviation of gray-level in each sub-region, and dynamically adjusts its contrast gain according to the degree of deviation of the pixel gray-level values in the sub-region from the region's statistical characteristics. Finally, an anisotropic diffusion filter with adjustable direction is applied. The diffusion coefficient of this anisotropic diffusion filter is negatively correlated with the local gradient magnitude of the image, and its diffusion direction is calibrated according to the main direction of the cable surface texture.
[0011] Preferably, the multi-level defect detection and feature extraction module includes a first-level rapid suspected region detection unit, a second-level defect confirmation and coarse classification unit, and a third-level high-dimensional feature vector extraction unit; The first-level fast suspected region detection unit calculates the absolute difference map between the current frame image and the dynamically updated background template image, and performs binarization segmentation using a dual threshold that is adaptive to the local gray-level variance of the image, initially extracting all gray-level abnormal regions as suspected defect candidate regions. The second-level defect confirmation and coarse classification unit constructs a multi-scale gradient magnitude pyramid at the corresponding position in the original image for each candidate region, and calculates the statistical histogram of the gradient direction within the region and the spatial distribution entropy of the gradient magnitude at each scale. By analyzing the consistency of the gradient direction and the value of the distribution entropy, the candidate region is classified into edge defects, planar defects or noise interference. The third-level high-dimensional feature vector extraction unit extracts a set of quantized feature vectors containing geometric, texture, and frequency domain information for the defect region confirmed by the second level.
[0012] Preferably, the core of the real-time classification decision module is a hybrid classification model that has been trained offline and deployed in a lightweight online manner; This hybrid classification model consists of a support vector machine classifier and a shallow convolutional neural network classifier connected in parallel. The support vector machine classifier uses a radial basis function as its kernel function, which is responsible for classifying feature vectors and outputting decision function values. The shallow convolutional neural network classifier directly uses the normalized image patch of the defect region as input to learn local pixel pattern features and output the classification probability distribution. The real-time classification decision module includes a decision fusion unit. The decision fusion unit converts the decision function value of the support vector machine classifier into a probability value through the sigmoid function, and then performs a weighted average fusion with the probability distribution output by the shallow convolutional neural network. The weighting coefficient is dynamically set according to the historical accuracy of the two classifiers on the validation set. In the fused probability distribution, the class corresponding to the highest probability value is determined as the final classification result, and the highest probability value is recorded as the confidence level of the classification result.
[0013] Preferably, the system control and feedback execution module includes a real-time industrial controller; The real-time industrial controller runs a multi-tasking real-time operating system. The system control and feedback execution module receives the defect classification results, location information and confidence level from the real-time classification decision module. When the classification confidence level is greater than the preset confidence level threshold, it is determined to be a valid defect detection. For valid defects; The system control and feedback execution module accurately calculates the absolute length and position of the defect on the entire cable reel based on its position information in the linear image stream and the encoder pulse count. Then, it sends a structured report containing the defect type, location, size and confidence level to the upper monitoring system through the industrial Ethernet interface, and generates a synchronization trigger signal at the same time. The synchronous trigger signal is precisely triggered when the defect point moves with the cable to the marking station on the production line, driving the inkjet marking device to mark the corresponding position of the defect on the surface of the cable sheath. The system control and feedback execution module is also responsible for coordinating the triggering timing of the linear image acquisition module, the control cycle of the illumination adaptive compensation module, and the priority and resource allocation of each software processing thread.
[0014] Preferably, the multi-scale gradient field analysis process used in the second-level defect confirmation and coarse classification unit is as follows: for each suspected defect candidate region, a region of interest image block with an outer expansion of 10 pixels is cropped at the corresponding position in the original image; Gaussian pyramid downsampling is performed on the image patch of the region of interest to construct an image pyramid; on each scale image, the Sobel gradient in the x and y directions is calculated, and the gradient magnitude map and gradient direction map are synthesized. On the gradient direction map, the gradient directions of all pixels within the candidate region are statistically analyzed, quantized into 8 direction intervals, forming a direction histogram, and the entropy value of the direction histogram is calculated as a measure of gradient direction consistency. On the gradient magnitude map, calculate the mean and standard deviation of the gradient magnitude within the candidate region, and calculate the local entropy of the spatial distribution of the gradient magnitude; Set a set of decision rules: if the entropy value of the orientation histogram is less than the first threshold and the average gradient magnitude is greater than the second threshold, it is determined to be an edge defect; If the entropy value of the orientation histogram is high and the entropy of the gradient magnitude spatial distribution is greater than the third threshold, it is determined to be a planar defect. If the average gradient magnitude is less than the fourth threshold, it is determined to be noise interference and filtered out.
[0015] Preferably, the specific execution steps of the illumination equalization control algorithm are as follows: After each image acquisition cycle, the values of the eight light intensity sensors integrated within the ring light source are read. Calculate the average of these 8 values as the target light intensity; Calculate the absolute difference between each sensor reading and the target intensity; If the difference of a certain sensor is greater than the preset tolerance range, a current adjustment command is generated for the corresponding light-emitting zone of that sensor. The current adjustment amount is proportional to the difference, and the proportional coefficient is determined by pre-calibration. The adjustment command is sent to the constant current drive circuit of each zone through a digital-to-analog converter. After the adjustment is completed, wait for a short stabilization period and read the sensor values again for verification until the difference between all sensor readings and the target intensity falls within the tolerance range, or the maximum number of adjustment iterations of 5 is reached.
[0016] Preferably, the method for calculating the absolute length position in the system control and feedback execution module is as follows: During system initialization, the actual physical length of each line of the linear array camera image is calibrated using the laser ranging unit and recorded as the resolution of each line. During system operation, the real-time industrial controller continuously receives and counts pulse signals from the spindle encoder. When the real-time classification decision module reports a defect, it also reports the row number of the defect in the image frame; the controller reads the encoder pulse count value at that moment. Based on the defect line number and the resolution of each line, calculate the length offset of the defect relative to the starting position of the current image frame; Then, based on the total number of encoder pulses and the preset length corresponding to each pulse, the absolute length of the current image frame's starting position on the entire cable reel is calculated. Finally, the absolute length is added to the length offset to obtain the precise absolute length position of the defect.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention integrates high-speed synchronous image acquisition, dynamic focal length compensation, and adaptive illumination control, ensuring the clarity and consistency of image acquisition under high-speed motion and complex lighting conditions from the source. Strict synchronization between the line scan camera and encoder eliminates motion blur, the autofocus servo mechanism compensates for cable fluctuations, and the real-time equalization algorithm of the multi-zone programmable light source effectively suppresses reflections and shadows. These measures collectively provide high-quality input images for subsequent processing, laying the physical foundation for high-precision detection.
[0018] 2. This invention employs a cascaded defect detection and feature extraction architecture, combining rapid suspected region detection, multi-scale gradient analysis for confirmation, and high-dimensional feature vector extraction to achieve a balance between detection efficiency and accuracy. This architecture first rapidly filters candidate regions with low computational cost, then filters out a large number of false alarms through gradient field analysis, and finally extracts rich features from the refined regions. This avoids the enormous computational burden caused by traditional methods performing complex calculations on the entire image or deep learning models directly processing high-resolution images, thus meeting the requirements of high-speed real-time performance while ensuring detection accuracy.
[0019] 3. This invention designs a hybrid classification model consisting of support vector machines and shallow convolutional neural networks, supplemented by a decision fusion strategy. This design combines the advantages of traditional machine learning models—namely, clear features and high computational efficiency—with the powerful feature learning capabilities of neural network models. The parallel processing of the two classifiers and the weighted fusion of the results effectively improve the robustness and accuracy of classification decisions. Especially when dealing with minor defects or defects with indistinct inter-class differences, it can integrate information from different feature perspectives to make more reliable judgments. Simultaneously, its lightweight design ensures fast real-time inference.
[0020] 4. This invention constructs a complete closed-loop system from image acquisition, processing, classification to feedback execution, and performs precise timing scheduling and position calibration through the system control and feedback execution modules. The end-to-end low-latency design of the system ensures that the detection results can be transformed into control actions on the production line in real time, such as precise position marking, realizing a deep integration of detection and production control. This truly achieves the application goal of online real-time detection and instant feedback, improving the level of production automation and intelligence. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the overall technical solution architecture of the present invention; Figure 2 This is a schematic diagram of the cascaded core principle framework of the multi-level defect detection and feature extraction module in this invention; Figure 3 This is a schematic diagram of the collaborative work and data flow between the illumination adaptive compensation module and the linear array image acquisition module in this invention; Figure 4This is a schematic diagram of the hybrid model decision fusion principle framework of the real-time classification decision module in this invention; Figure 5 This is a closed-loop feedback and real-time scheduling logic framework diagram of the system control and feedback execution module in this invention. Detailed Implementation
[0022] Example 1: Reference Figures 1 to 5 The present invention proposes a real-time detection and classification system for surface defects in cable sheaths based on machine vision. The system consists of six core functional units: a linear array image acquisition module, an illumination adaptive compensation module, an image preprocessing and enhancement module, a multi-level defect detection and feature extraction module, a real-time classification decision module, and a system control and feedback execution module. Each module is tightly coupled with a real-time control protocol through a high-speed data bus to form an end-to-end closed-loop processing pipeline.
[0023] The entire system is deployed on a continuous cable production line and can achieve millisecond-level detection, precise classification, and physical marking of various defects on the sheath surface when the cable operates at a maximum linear speed of 5 meters per second.
[0024] As the front-end sensing unit of the system, the linear array image acquisition module's structure, layout, and operating logic directly determine the upper limit of data quality for all subsequent processing stages. This module includes a high-sensitivity linear array camera with a resolution greater than 4096 pixels, which is fixedly mounted on a rigid bracket directly above the production line in a direction perpendicular to the cable axis.
[0025] To ensure the acquisition of complete, blur-free, and distortion-free surface images during high-speed cable movement, the line scan camera's trigger signal does not use a fixed frequency. Instead, it is dynamically generated by a pulse trigger unit rigidly connected to the production line's spindle encoder. The spindle encoder outputs 2048 pulse signals per revolution. These pulse signals are multiplied and shaped by the pulse trigger unit before serving as the external synchronous trigger source for the line scan camera. Therefore, regardless of the cable's current operating speed, the actual cable movement distance corresponding to each line of image acquisition by the line scan camera remains constant at 0.1 mm, ensuring spatial sampling consistency along the length of the image.
[0026] In addition, to address the unavoidable radial runout of the cable during traction (typically ±2 mm), the linear array image acquisition module also integrates a laser ranging unit. This laser ranging unit uses the triangulation principle to measure the vertical distance from the center point of the cable surface to the front focal plane of the camera lens in real time at a frequency of 1000 times per second, and sends this vertical distance data to the camera's matching autofocus servo mechanism via a serial communication interface.
[0027] The servo mechanism has a built-in piezoelectric ceramic driver with a response time of less than 1 millisecond. It can adjust the lens focal length in real time according to the received distance data, so that the imaging plane is always accurately focused on the surface of the cable sheath, thereby maintaining the spatial resolution of the image in the width direction at 0.05 mm per pixel.
[0028] The illumination adaptive compensation module works in conjunction with the linear array image acquisition module to jointly construct the physical foundation for high-quality image acquisition. Please refer to the appendix. Figure 3 The core of the adaptive illumination compensation module is a ring-shaped multi-zone programmable light source, whose emitting surface is equally divided into eight independently controllable emitting zones, arranged around the lens of the linear array camera. Each emitting zone consists of a set of high-brightness white LED arrays and is equipped with an independent constant current drive circuit.
[0029] Embedded inside the light source ring is a light intensity sensor array consisting of eight miniature silicon photodiodes. Each sensor faces the cable surface area illuminated by the light-emitting zone, monitoring the reflected light intensity of that area in real time. During system initialization, a calibration experiment is conducted to determine the mapping relationship between the driving current of each light-emitting zone and the sensor readings, which is then stored in non-volatile memory. During system operation, the illumination adaptive compensation module immediately activates its equalization control algorithm after a complete image acquisition cycle.
[0030] The equalization control algorithm first reads the current values from eight light intensity sensors and calculates their arithmetic mean as the target light intensity benchmark. Then, the algorithm calculates the absolute deviation of each sensor reading from this benchmark. If any deviation exceeds a preset tolerance threshold (typically 5%), a current adjustment command is generated for the corresponding luminous zone. Adjustment amount. It is proportional to the deviation value, that is , The pre-calibrated scaling factor. For the first Sensor readings, The average value is used. The adjustment command is converted into an analog voltage signal via a digital-to-analog converter, which drives the constant current circuit to change the LED current. This process is completed in up to 5 iterations within the image frame interval (typically 2 milliseconds) until all sensor readings converge to the tolerance range, or the maximum number of iterations is reached.
[0031] Through this mechanism, the system can effectively suppress the uneven illumination field caused by uneven cable surface material, stray light interference from the environment, or aging of the light source, ensuring that the acquired original image has highly consistent grayscale distribution characteristics.
[0032] The image preprocessing and enhancement module receives the raw grayscale image data stream from the linear image acquisition module, which is continuously input at a rate of 5000 lines per second. The linear image acquisition module first performs background estimation and subtraction operations to eliminate the interference of the inherent periodic braided texture of the cable sheath substrate on defect detection. Background template. Historical normal image frames are updated online using a first-order low-pass filter with a time constant of 5 seconds. The recursive formula is as follows: ; For the first Background template image for the moment, For the first Time frame image, The update coefficient is set to 0.002, corresponding to a time constant of 5 seconds. The image after subtraction... All anomalous information that deviates from the normal texture has been preserved. This is a frame image.
[0033] Subsequently, the linear array image acquisition module... An adaptive contrast stretching method based on local gray-level statistics is implemented. The equalization control algorithm divides the image into square sub-regions with a side length of 64 pixels and an overlap rate of 50%. For each sub-region, its gray-level mean is calculated. and standard deviation Any pixel within the region Output grayscale value Determined by the following formula: If ,but ;otherwise, , For pixels Original grayscale value at the location, gain factor This strategy ensures that contrast enhancement is applied only when pixel grayscale deviates significantly from local statistical characteristics, thus avoiding amplification of noise.
[0034] Finally, the linear array image acquisition module applies an oriented anisotropic diffusion filter. The diffusion tensor of this anisotropic diffusion filter is calibrated according to the principal direction of the cable surface texture. The principal direction is obtained by calculating the gradient covariance matrix of the entire image and finding its principal eigenvector. The filtering process uses a high diffusion coefficient in the dimension perpendicular to the principal direction to smooth noise, and a low diffusion coefficient in the dimension parallel to the principal direction to preserve defect edges. After the above three steps, the signal-to-noise ratio of the defect area in the output image is improved by at least 15 dB, providing a clear visual input for subsequent detection.
[0035] The multi-level defect detection and feature extraction module adopts a three-level cascaded architecture, as shown in the attached diagram. Figure 2As shown, this method enables efficient and accurate location and quantification of defects from a massive number of pixels.
[0036] The first stage is the Fast Suspected Region Detection Unit. This unit receives the preprocessed image and calculates its absolute difference map with the dynamic background template. On the difference map, the unit employs adaptive dual-threshold segmentation: a low threshold... High threshold , The standard deviation of grayscale values within a 7×7 neighborhood centered on the current pixel. and These are empirical constants, taking values of 1.5 and 3.0 respectively. The condition is met when the grayscale value is greater than... Furthermore, regions with a connected area greater than 10 pixels are initially marked as potential defect candidate regions. This step can filter out fewer than 20 candidate regions per frame, significantly reducing the subsequent computational load.
[0037] The second level is the defect confirmation and coarse classification unit. For each candidate region, the unit extracts a region of interest (ROI) image patch extending 10 pixels outward from its original image location. A Gaussian pyramid with three levels—original scale, 1 / 2 scale, and 1 / 4 scale—is constructed for this ROI image patch. At each scale, the Sobel gradients in the x and y directions are calculated, and a gradient magnitude map and a gradient direction map are synthesized. In the gradient direction map, the interval [0, 2π) is quantized into eight directional intervals, and the gradient directions of all pixels within the candidate region are statistically analyzed to form an 8-dimensional orientation histogram. Calculate the Shannon entropy of this 8-dimensional orientation histogram. , For the first The probability of each interval.
[0038] Simultaneously, the mean gradient magnitude within the candidate region is calculated on the gradient magnitude map. with standard deviation And calculate the local entropy of its spatial distribution. Based on these indicators, the following decision rules are established: If and If so, it is determined to be an edge defect (such as scratches or cracks); if and If it is, it is determined to be a planar defect (such as a bulge, dent, or impurity); if If any noise is detected, it is identified as noise interference and eliminated. This step can reduce the false alarm rate to below 5%.
[0039] The third level is the high-dimensional feature vector extraction unit. For the defect regions confirmed in the second level, a 32-dimensional comprehensive feature vector is extracted. Geometric features occupy 4 dimensions: region area (unit: pixels). 2Perimeter (unit: pixels), aspect ratio of the smallest bounding rectangle, and circularity (defined as 4π × area / perimeter). 2 Texture features occupy 16 dimensions: Based on the gray-level co-occurrence matrix, four indicators, namely contrast, correlation, energy, and homogeneity, are calculated in four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, for a total of 16 values.
[0040] The frequency domain features occupy 12 dimensions: A two-dimensional discrete Fourier transform is performed on the defect region image to convert its spectrum into polar coordinates. The 0th to 2nd order moments of the radial distribution and the 0th to 2nd order moments of the angular distribution are calculated, resulting in a total of 12 moment features. This frequency domain feature vector comprehensively characterizes the morphology, structure, and spectral properties of the defect, providing a solid data foundation for accurate classification.
[0041] The real-time classification decision module receives the aforementioned 32-dimensional feature vector and the corresponding normalized defect image patch (uniformly 32×32 pixels in size), and feeds them in parallel into two lightweight classifiers for processing. Please refer to the appendix. Figure 4 The core of this real-time classification decision module is the hybrid classification model and its decision fusion mechanism.
[0042] The first classifier is a support vector machine, with a radial basis function as its kernel function and a penalty parameter of [missing information]. With kernel function width The values were determined during offline training using 5-fold cross-validation and grid search optimization, ultimately set to 100 and 0.01 respectively. This lightweight classifier outputs... dimensional vector ( In this embodiment, the total number of defect categories is... (Including scratches, cracks, bulges, dents, impurities, and oil stains), each element is the decision function value for the sample belonging to the corresponding category.
[0043] The second classifier is a shallow convolutional neural network, with the following structure: input layer (32×32×1) → convolutional layer 1 (16 3×3 convolutional kernels, ReLU activation) → max pooling layer 1 (2×2 window) → convolutional layer 2 (32 3×3 convolutional kernels, ReLU activation) → max pooling layer 2 (2×2 window) → fully connected layer (128 neurons, ReLU activation) → output layer (6 neurons, Softmax activation). This shallow convolutional neural network was trained offline using a dataset containing 100,000 labeled image patches, employing the Adam optimizer with an initial learning rate of 0.001, a batch size of 64, and a training duration of 50 epochs.
[0044] During online inference, the outputs of both classifiers are converted into probability distributions. The decision function values of the support vector machine... Transformed using the sigmoid function: . No. The predicted probability value for each category. Convolutional neural networks directly output the probability distribution. The decision fusion unit performs a weighted average of the two: , For the first The final predicted probability value for the category. and The weighting coefficients are 0.6 and 0.4, with initial values of 0.6 and 0.4 respectively. In the fused probability distribution, the category corresponding to the maximum value is the final classification result, and this maximum value is the classification confidence score. After the system has been running for a period of time, it can be fine-tuned through online learning based on newly accumulated valid samples. and To further improve fusion performance.
[0045] The system control and feedback execution module, serving as the scheduling hub of the entire system, is based on a real-time industrial controller equipped with a multi-core processor and runs the VxWorks real-time operating system. This module communicates with the image processing unit via a high-speed PCIe bus and connects to the upper-level monitoring system via an industrial Ethernet network. When the real-time classification decision module reports a valid defect (i.e., a confidence level greater than a preset threshold of 0.85), the system control and feedback execution module immediately initiates the location calibration and feedback process. First, the module reads the line number of the defect in the image frame. Based on the resolution per line (0.1 mm / line) calibrated during system initialization, the length offset of the defect relative to the starting position of the current image frame is calculated. .
[0046] Meanwhile, the module continuously increments the pulse count from the spindle encoder. Given that each encoder pulse corresponds to a cable movement of 0.01 mm, find the absolute length of the starting position of the current image frame. Therefore, the absolute length location of the defect. The absolute length location information is encapsulated in a structured report, which includes fields such as defect type, defect area, and confidence level, and is sent to the upper-level monitoring system via industrial Ethernet using the UDP protocol, with a latency of less than 5 milliseconds.
[0047] Meanwhile, the module calculates the time required for the defect to reach the downstream inkjet marking station. The physical distance between the marking station and the camera imaging position is known to be 2 meters, and the current linear velocity of the cable is... The delay time is calculated in real time from the encoder pulse frequency. (Unit: milliseconds). The module is configured with a high-precision hardware timer. A trigger pulse with a width of 10 milliseconds is generated after a certain time. This trigger pulse drives the solenoid valve of the inkjet marking device to spray a permanent mark at the corresponding position of the defect on the cable sheath surface.
[0048] The end-to-end latency from defect detection to physical labeling is strictly controlled within 50 milliseconds, meeting the real-time requirements of high-speed production lines. Furthermore, the system control and feedback execution module is responsible for global resource scheduling: allocating the highest priority to the image acquisition thread to ensure no frame drops; allocating the second-highest priority to the illumination compensation algorithm to ensure its completion within the frame interval; and allocating dynamic priorities to the image processing and classification threads, adjusting them according to the current load to ensure balanced processing time across all stages of the pipeline.
[0049] Example 2: Based on Example 1 above, this example introduces a supplementary criterion based on curvature analysis to the second-level unit of the multi-level defect detection and feature extraction module to further improve the ability to identify small bulges and depressions.
[0050] Specifically, after constructing the multi-scale gradient pyramid, in addition to calculating the gradient direction histogram entropy and gradient magnitude distribution entropy, contour extraction is performed on the candidate region boundaries at each scale, and their local curvature is calculated. Contour extraction employs a combination of Canny edge detection and chain code tracing to obtain a closed sequence of boundary points. For any point on the boundary... Its curvature It is calculated by the second derivative of the quadratic curve fitted by five points before and after it.
[0051] Subsequently, the mean of the curvature over the entire boundary is calculated. with standard deviation For bulge-type defects, their boundaries typically exhibit a smooth, outward-convex arc shape. Positive value and Smaller; for concave defects, the boundary exhibits an inward concave shape. The value is negative; however, for linear defects such as scratches, the boundary is not closed or the curvature changes drastically. great.
[0052] Therefore, the newly added decision rule is: if the candidate region is a closed region, and and According to The positive and negative values are further distinguished into bulges or dents. This supplementary criterion is logically ANDed with the original gradient field analysis results, and the defect type is confirmed only when the two conclusions are consistent, thereby reducing the misclassification rate of bulges and dents.
[0053] Furthermore, this embodiment optimizes the hardware acceleration of the hybrid model in the real-time classification decision module. The inference process of the support vector machine classifier is ported to a field-programmable gate array (FPGA). A dedicated vector operation unit is built inside the FPGA, which can calculate the inner product of the radial basis function kernel matrix and the support vectors in parallel, reducing the single inference time from 0.8 milliseconds in the software implementation to 0.2 milliseconds.
[0054] The shallow convolutional neural network is deployed on a neural network accelerator integrated into an industrial controller, utilizing its tensor computation core to improve the execution efficiency of convolution and pooling operations by 3 times. The weighted average calculation of the decision fusion unit is also completed in the FPGA, ensuring that the total time of the entire classification decision process remains stable within 0.5 milliseconds. This hardware co-design enables the system to maintain high classification accuracy while possessing stronger resistance to load fluctuations, ensuring an end-to-end latency of less than 40 milliseconds even when multiple defects appear simultaneously in the image.
[0055] In terms of system control and feedback execution, this embodiment introduces a prediction-based advance marking mechanism. Because the cable experiences slight speed fluctuations during traction, relying solely on the current speed to calculate T_delay may introduce position errors. Therefore, the module adds short-term trend prediction of the encoder pulse frequency.
[0056] A linear regression model with a sliding window length of 100 milliseconds is used to fit the intervals of the most recent 100 pulses to predict the velocity change trend within the next 2 seconds. Based on this predicted velocity, the system is dynamically adjusted. The calculated values are shown in the figures. Experiments show that the pre-marking mechanism reduces the absolute error of the marking position from ±5 mm to within ±2 mm, significantly improving the accuracy of the marking. Meanwhile, a new "Prediction Confidence" field has been added to the structured report, reflecting the goodness of fit of the speed prediction model, for use by the upper-level system in quality traceability analysis.
[0057] Example 3: This example describes an adaptation of the system for cable sheaths made of special materials (such as a high-reflectivity metal shielding layer covered with a black polyethylene sheath). In such scenarios, conventional white light illumination easily produces strong specular reflections at the edges of the metal layer, creating large overexposed areas that mask actual defects.
[0058] Therefore, in this embodiment, the ring-shaped white light source in the illumination adaptive compensation module is replaced with a coaxial polarized light source system. This system consists of a ring-shaped LED light source emitting unpolarized light, a linear polarizer located between the light source and the cable, and a polarizer mounted at the front of the linear array camera lens with a polarization direction orthogonal to the lens. This configuration effectively filters out specular reflection components, retaining only diffuse reflection light from the sheath surface, thereby eliminating specular interference. Correspondingly, the light intensity sensor array is also replaced with a model sensitive to polarized light, and its mapping relationship with the drive current is recalibrated.
[0059] The adaptive contrast stretching algorithm in the image preprocessing and enhancement module has also been adjusted: the local sub-region division method has been changed from square to strip (64 pixels long, 8 pixels wide) along the cable axis to better match the characteristic that defects on such sheaths tend to extend axially.
[0060] In the multi-level defect detection and feature extraction module, the background template update strategy for the first level was modified. Because the background texture is more stable under polarization imaging, the time constant was extended from 5 seconds to 15 seconds to enhance robustness against slow drift.
[0061] In the second-level gradient analysis, the Sobel operator is replaced by the Scharr operator because it performs better in terms of rotation invariance and helps to capture small defects in anisotropy.
[0062] The third-level feature vector dimension is expanded to 40 dimensions, and an 8-dimensional color moment feature is added (although the image is grayscale, the representation ability is enhanced by simulating the statistical moments of the RGB channels).
[0063] The training dataset for the real-time classification decision module has also been expanded, adding 5000 new defect samples of various types of highly reflective materials. The weighting coefficients of the hybrid model... and The initial values were adjusted to 0.7 and 0.3 to give more emphasis to the reliable performance of the support vector machine under stable features.
[0064] In the system control and feedback execution module, the calibration process for each row resolution incorporates adaptive correction for different cable diameters. The diameter data measured by the laser ranging unit is used to dynamically correct the physical length corresponding to each row, as the actual arc length of the same row varies on cables of different diameters. This correction ensures that the position calibration accuracy remains within ±1 mm for cable products with diameters ranging from 10 to 50 mm.
[0065] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0066] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A real-time detection and classification system for surface defects in cable sheaths based on machine vision, characterized in that, include: Linear array image acquisition module, used to acquire complete image data of the sheath surface of the cable during continuous movement; An adaptive illumination compensation module is used to eliminate the interference of uneven ambient lighting and reflections from the cable sheath surface on imaging quality. The image preprocessing and enhancement module receives the raw image data stream from the linear array image acquisition module and performs a series of operations aimed at improving the signal-to-noise ratio of the defective area. The multi-level defect detection and feature extraction module adopts a cascaded architecture to perform coarse-to-fine defect localization and feature quantization on the preprocessed image; The real-time classification decision module receives high-dimensional feature vectors from the multi-level defect detection and feature extraction module and performs the final accurate classification of defect types and confidence assessment. The system control and feedback execution module serves as the scheduling center and execution terminal for the entire system.
2. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 1, characterized in that, The linear array image acquisition module includes a linear array camera, a pulse triggering unit synchronized with the main shaft encoder of the production line, and a laser ranging unit for auxiliary positioning. The line scan camera is installed vertically along the cable axis, and the line frequency is collected in strict synchronization with the pulse signal output by the encoder through the pulse triggering unit; The laser ranging unit measures the working distance between the cable surface and the camera lens in real time and feeds the working distance data back to the autofocus servo mechanism of the camera lens to dynamically compensate for the change in imaging focal length caused by the radial runout of the cable.
3. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 2, characterized in that, The adaptive illumination compensation module includes a ring-shaped multi-zone programmable light source and an embedded light intensity sensor array. The ring light source is arranged around the linear array camera lens, and the light-emitting surface is divided into multiple independently controlled light-emitting zones. The embedded light intensity sensor array is integrated inside the light source and is arranged in a ring to monitor the light intensity projected onto the cable surface in real time from all directions. The adaptive illumination compensation module incorporates an illumination equalization control algorithm. The algorithm aims to obtain a uniform illumination grayscale distribution, reads data from each sensor in real time, calculates the uniformity deviation of the current illumination field, and dynamically adjusts the driving current of each luminous zone until all sensor readings reach the preset equalization threshold range.
4. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 3, characterized in that, The image preprocessing and enhancement module first performs background estimation and subtraction based on a Gaussian model to eliminate periodic interference from the cable sheath substrate texture. Next, an adaptive contrast stretching algorithm based on local gray-level statistics is adopted. This adaptive contrast stretching algorithm divides the image into multiple overlapping sub-regions, calculates the mean and standard deviation of gray-level in each sub-region, and dynamically adjusts its contrast gain according to the degree of deviation of the pixel gray-level values in the sub-region from the region's statistical characteristics. Finally, an anisotropic diffusion filter with adjustable direction is applied. The diffusion coefficient of this anisotropic diffusion filter is negatively correlated with the local gradient magnitude of the image, and its diffusion direction is calibrated according to the main direction of the cable surface texture.
5. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 4, characterized in that, The multi-level defect detection and feature extraction module includes a first-level rapid suspected region detection unit, a second-level defect confirmation and coarse classification unit, and a third-level high-dimensional feature vector extraction unit. The first-level fast suspected region detection unit calculates the absolute difference map between the current frame image and the dynamically updated background template image, and performs binarization segmentation using a dual threshold that is adaptive to the local gray-level variance of the image, initially extracting all gray-level abnormal regions as suspected defect candidate regions. The second-level defect confirmation and coarse classification unit constructs a multi-scale gradient magnitude pyramid at the corresponding position in the original image for each candidate region, and calculates the statistical histogram of the gradient direction within the region and the spatial distribution entropy of the gradient magnitude at each scale. By analyzing the consistency of the gradient direction and the value of the distribution entropy, the candidate region is classified into edge defects, planar defects or noise interference. The third-level high-dimensional feature vector extraction unit extracts a set of quantized feature vectors containing geometric, texture, and frequency domain information for the defect region confirmed by the second level.
6. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 5, characterized in that, The core of the real-time classification decision module is a hybrid classification model that has been trained offline and deployed in a lightweight online manner; This hybrid classification model consists of a support vector machine classifier and a shallow convolutional neural network classifier connected in parallel. The support vector machine classifier uses a radial basis function as its kernel function, which is responsible for classifying feature vectors and outputting decision function values. The shallow convolutional neural network classifier directly uses the normalized image patch of the defect region as input to learn local pixel pattern features and output the classification probability distribution. The real-time classification decision module includes a decision fusion unit. The decision fusion unit converts the decision function value of the support vector machine classifier into a probability value through the sigmoid function, and then performs a weighted average fusion with the probability distribution output by the shallow convolutional neural network. The weighting coefficient is dynamically set according to the historical accuracy of the two classifiers on the validation set. In the fused probability distribution, the class corresponding to the highest probability value is determined as the final classification result, and the highest probability value is recorded as the confidence level of the classification result.
7. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 6, characterized in that, The system control and feedback execution module includes a real-time industrial controller; The real-time industrial controller runs a multi-tasking real-time operating system. The system control and feedback execution module receives the defect classification results, location information and confidence level from the real-time classification decision module. When the classification confidence level is greater than the preset confidence level threshold, it is determined to be a valid defect detection. For valid defects; The system control and feedback execution module accurately calculates the absolute length and position of the defect on the entire cable reel based on its position information in the linear image stream and the encoder pulse count. Then, it sends a structured report containing the defect type, location, size and confidence level to the upper monitoring system through the industrial Ethernet interface, and generates a synchronization trigger signal at the same time. The synchronous trigger signal is precisely triggered when the defect point moves with the cable to the marking station on the production line, driving the inkjet marking device to mark the corresponding position of the defect on the surface of the cable sheath. The system control and feedback execution module is also responsible for coordinating the triggering timing of the linear image acquisition module, the control cycle of the illumination adaptive compensation module, and the priority and resource allocation of each software processing thread.
8. The real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 7, characterized in that, The multi-scale gradient field analysis process used in the second-level defect confirmation and coarse classification unit is as follows: For each suspected defect candidate region, a region of interest image block with an outer expansion of 10 pixels is cropped from the corresponding position in the original image; Gaussian pyramid downsampling is performed on the image patch of the region of interest to construct an image pyramid; on each scale image, the Sobel gradient in the x and y directions is calculated, and the gradient magnitude map and gradient direction map are synthesized. On the gradient direction map, the gradient directions of all pixels within the candidate region are statistically analyzed, quantized into 8 direction intervals, forming a direction histogram, and the entropy value of the direction histogram is calculated as a measure of gradient direction consistency. On the gradient magnitude map, calculate the mean and standard deviation of the gradient magnitude within the candidate region, and calculate the local entropy of the spatial distribution of the gradient magnitude; Set a set of decision rules: if the entropy value of the orientation histogram is less than the first threshold and the average gradient magnitude is greater than the second threshold, it is determined to be an edge defect; If the entropy value of the orientation histogram is high and the entropy of the gradient magnitude spatial distribution is greater than the third threshold, it is determined to be a planar defect. If the average gradient magnitude is less than the fourth threshold, it is determined to be noise interference and filtered out.
9. A real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 8, characterized in that, The specific execution steps of the illumination equalization control algorithm are as follows: After each image acquisition cycle, the values of the eight light intensity sensors integrated within the ring light source are read. Calculate the average of these 8 values as the target light intensity; Calculate the absolute difference between each sensor reading and the target intensity; If the difference of a certain sensor is greater than the preset tolerance range, a current adjustment command is generated for the corresponding light-emitting zone of that sensor. The current adjustment amount is proportional to the difference, and the proportional coefficient is determined by pre-calibration. The adjustment command is sent to the constant current drive circuit of each zone through a digital-to-analog converter. After the adjustment is completed, wait for a short stabilization period and read the sensor values again for verification until the difference between all sensor readings and the target intensity falls within the tolerance range, or the maximum number of adjustment iterations of 5 is reached.
10. A real-time detection and classification system for surface defects of cable sheaths based on machine vision according to claim 9, characterized in that, The method for calculating the absolute length position in the system control and feedback execution module is as follows: During system initialization, the actual physical length of each line of the linear array camera image is calibrated using the laser ranging unit and recorded as the resolution of each line. During system operation, the real-time industrial controller continuously receives and counts pulse signals from the spindle encoder. When the real-time classification decision module reports a defect, it also reports the row number of the defect in the image frame; the controller reads the encoder pulse count value at that moment. Based on the defect line number and the resolution of each line, calculate the length offset of the defect relative to the starting position of the current image frame; Then, based on the total number of encoder pulses and the preset length corresponding to each pulse, the absolute length of the current image frame's starting position on the entire cable reel is calculated. Finally, the absolute length is added to the length offset to obtain the precise absolute length position of the defect.