Visual detection method and system for cable laying and computer readable storage medium
By performing video frame extraction and multi-scale feature calculation on infrared target videos, combined with the sparse trajectory intensity strategy, the problem of low cable detection efficiency and accuracy in the existing technology is solved, and accurate tracking, detection and identification of cables are achieved.
Patent Information
- Application Number
- CN202410728604.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-20
AI Technical Summary
Cable detection methods in the existing technology cannot achieve accurate tracking and detection, resulting in low detection efficiency and reduced accuracy in complex backgrounds, and simple contrast difference processing will introduce clutter, leading to erroneous detection.
A visual inspection method for cable laying is adopted to obtain spatial weighting by acquiring infrared target video, video frame extraction, blind element detection, smoothing and prior weighting preprocessing, regional division, multi-scale local feature calculation and sparse trajectory intensity strategy. map and time domain weighted map, correct the target position, and output a binary map.
It achieves accurate detection and tracking of cable appearance, improves detection accuracy, reduces false detections, and can effectively identify cables in complex backgrounds.
Smart Images

Figure CN118674748A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of cable appearance detection, and in particular relates to a visual detection method, a detection system and a computer-readable storage medium for cable laying. Background Art
[0002] In the power industry, cables are an important part of electricity and are usually used to transmit data. Therefore, whether the appearance of the cables is intact also affects the overall power environment. In the prior art, cable detection is mostly based on single-frame detection methods and sequence-based detection methods, which perform single-target detection on cables. This detection does not have the effect of tracking detection, resulting in low efficiency of cable detection. When the background of the detection cable becomes complex, the detection accuracy will also decrease. When a simple contrast difference is used to improve the detection results, clutter will be introduced while enhancing the detection target, including noise points and bright edges, resulting in incorrect detection of cables and difficulty in detecting cable background areas.
[0003] Therefore, a new detection method is needed to track, detect and locate the target. Summary of the invention
[0004] The purpose of the present invention is to provide a visual inspection method for cable laying, which is used to solve the technical problems of low cable accuracy and inability to track and inspect in the prior art.
[0005] Another object of the present invention is to provide an inspection system using a visual inspection method for cable laying.
[0006] Another object of the present invention is to provide a computer-readable storage medium.
[0007] The technical solution of the present invention to solve the technical problem is:
[0008] A visual inspection method for cable laying comprises the following steps:
[0009] S1: Obtain infrared target video of the cable and extract video frames to obtain continuous infrared small target images;
[0010] S2: performing blind pixel detection, smoothing and prior weighting preprocessing operations on the infrared small target image in sequence to obtain a preprocessed infrared small target image;
[0011] S3: Divide the preprocessed infrared small target image into regions to obtain the potential region, inner neighborhood and outer neighborhood of the preprocessed infrared small target image. Obtain multi-scale local contrast features through the contrast difference between the inner neighborhood, outer neighborhood and the potential region. Obtain multi-scale local variance through the grayscale values of the inner neighborhood, outer neighborhood and the potential region. According to the multi-scale local contrast features and multi-scale local variance and using the robust regional density level strategy, calculate and obtain the spatial weighted map of the potential region.
[0012] S4: using the abundance to calculate the change value of the pixel grayscale in different regions after different frames are divided, and obtaining the time domain weighted graph of the infrared small target image at different times;
[0013] S5: Multiply the calculated spatial weighted map and the temporal weighted map to obtain the final target eigenvalue, and determine whether the target eigenvalue is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target, and the sparse trajectory intensity strategy is used to correct the moving position of the infrared small target, and output the corrected binary map of the continuous infrared small target. If not, return to step S2.
[0014] The step S2 specifically includes the following steps:
[0015] S2.1: Take the time domain average of K consecutive frames of infrared small target images to obtain the average image The specific calculation formula is as follows:
[0016]
[0017] in, Represents the average image The temporal mean value of the grayscale at the coordinate (i, j) in the middle, f(i, j, k) represents the grayscale value of the pixel at the coordinate (i, j) in the k-th frame of the infrared small target image, and K represents the frame number;
[0018] S2.2: Average image Find the spatial average C and calculate the average image The absolute value D(i,j) of the difference between the grayscale time domain mean and the spatial domain mean C is calculated as follows:
[0019]
[0020] Where M represents the average image The width of N represents the average image The height of , C represents the spatial average of the average image I;
[0021] S2.3: According to the blind pixel judgment threshold σ(i,j), grayscale time domain mean The absolute value D(i,j) of the difference between the coordinates (i,j) and the spatial average value C is used to determine whether the absolute value D(i,j) of the infrared small target image at the coordinate (i,j) is greater than 3σ(i,j). If so, the coordinate (i,j) is a blind pixel, and the identification value here is 0; if not, the coordinate (i,j) is a valid pixel, and the identification value here is 1; the specific calculation formula is as follows:
[0022]
[0023] Among them, σ(i,j) represents the blind pixel judgment threshold, μ(i,j) represents the mean value of the pixels of the infrared small target image in the kth frame;
[0024] S2.4: Compensate for the blind pixel obtained in step S2.3. The specific calculation formula is as follows:
[0025]
[0026] Wherein, f'(i,j,k) represents the gray value of the compensated pixel at the coordinate (i,j) of the kth frame, f(i-1,j,k) and f(i+1,j,k) represent the gray values of the non-blind pixels of the two adjacent pixels on the left and right of the coordinate (i,j);
[0027] S2.5: The infrared small target image is smoothed by combining a two-dimensional Gaussian function and a hierarchical gradient strategy, and the final pre-processed infrared small target image is obtained by weighted harmonic mean. The edge features of the pre-processed infrared small target image are weighted by a priori weighted normalization weights. The specific calculation formula is as follows:
[0028]
[0029] I pre =w×I G ;
[0030]
[0031] Among them, I G represents the smoothed infrared image, C G (m, n) represents the coefficient of the Gaussian gradient kernel at the position (m, n), f(i+m, j+n) is the grayscale value of the pixel at the position (i+m, j+n) of the input image, and the two-dimensional Gaussian function uses a two-dimensional Gaussian function with a kernel size of 4×4. The ranges of m and n are from -2 to 2, respectively, indicating that the Gaussian kernel operation is performed within a 5×5 window; I prerepresents the preprocessed infrared small target image, w represents the prior weighted normalization weight; PI represents the weighted harmonic mean of the corner information of the preprocessed infrared small target image, m1 represents the corner information of the infrared moving small target image pixel, m2 represents the edge information of the infrared moving small target image pixel, S represents the corner indicator of the infrared moving small target image pixel, E represents the edge indicator of the infrared moving small target image pixel, Max represents the maximum value, and Min represents the minimum value.
[0032] The step S3 specifically comprises the following steps:
[0033] S3.1: Divide the preprocessed infrared small target image into regions to obtain the potential region, inner neighborhood and outer neighborhood of the preprocessed infrared small target image;
[0034] S3.2: The multi-scale local contrast feature is obtained by the contrast difference between the inner neighborhood, the outer neighborhood and the potential area, and the multi-scale local variance is obtained by the grayscale value of the potential area, the inner neighborhood and the outer neighborhood. The specific calculation formula is as follows:
[0035]
[0036] MLCT = G(IB)*G(OB);
[0037]
[0038] Among them, OB is the outer neighborhood; IB refers to the inner neighborhood, m t Represents the average grayscale value of the target potential area, m(IB i ) represents the average grayscale value of the i-th inner neighborhood. m(OB i ) represents the average grayscale of the i-th outer neighborhood; G(IB) represents the contrast difference between the inner neighborhood and the target potential area, G(OB) represents the contrast difference between the outer neighborhood and the target potential area, MLCT represents the multi-scale local contrast feature of the infrared small target image; MLV represents the multi-scale local variance of the infrared small target image, x1,…,x n represents the grayscale values of the pixels in the inner neighborhood, outer neighborhood, and target potential area respectively, and x represents the average grayscale value level of the pixels in the inner neighborhood, outer neighborhood, and target potential area;
[0039] S3.3: Based on the multi-scale local contrast features, multi-scale local variance and the robust regional density level strategy, the spatial weighted map of the potential area is calculated; the specific calculation formula is as follows:
[0040]
[0041]
[0042] RRIL i=(M k (i)-min((mean(i),median)))*(M k (i)-M kmin (i));
[0043] Among them, RRIL represents the spatial weighted map of the final potential region, RRILT represents the robust regional density level of the potential target region, and represents the robust regional intensity level calculated by the i-th region of the outer neighborhood and the inner neighborhood, RRILi represents the robust regional intensity level of the i-th sub-region, M k (i) represents the average value of the first k maximum pixel grayscale values in the ith sub-region, mean represents the mean calculation of the pixel grayscale value in the ith sub-region, median represents the median calculation of the pixel grayscale value in the ith sub-region, and M kmin (i) represents the average value of the last k minimum pixel grayscale values in the i-th sub-region.
[0044] The step S4 specifically comprises the following steps:
[0045] S4.1: Use the abundance to calculate the change value of the pixel grayscale in different regions after different frame divisions, and obtain the time domain weighted graph T of the infrared small target image at different times W ; The specific calculation formula is as follows:
[0046] T W = kur(I seq );
[0047]
[0048] Among them, Iseq is the pixel grayscale value in the input image sequence after preprocessing, kur represents the abundance of the pixel grayscale value of the input preprocessed image, X represents the corresponding pixel grayscale value after the video frame is divided into regions; μ is the mean of the pixel grayscale value, σ is the standard deviation of the pixel grayscale value, and E is the expected operation.
[0049] The step S5 specifically comprises the following steps:
[0050] S5.1: Multiply the calculated spatial weighted map and the temporal weighted map to obtain the final target eigenvalue T, and determine whether the target eigenvalue is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target. The specific calculation formula is as follows:
[0051] T=T W *RRIL;
[0052] T Z =m+v*var;
[0053] Where T represents the final target feature value; T Z represents the adaptive threshold; m represents the mean of the target potential area; var represents the variance of the target potential area, and v is an adjustable parameter with a range of [0.5, 1];
[0054] S5.2: Use the sparse trajectory intensity strategy to correct the moving position of the infrared small target and output the corrected binary image of the continuous infrared small target; the specific steps are as follows:
[0055] S5.2.1: According to the distribution of the grayscale values of the pixels corresponding to the two target potential regions, υ c and d , calculate the similarity S(c,d), the optical flow consistency FC of the infrared small target trajectory, and the sparse trajectory intensity I st ; The specific calculation formula is as follows:
[0056] S(c,d)=exp(-W(υ c ,υ d ));
[0057] FC=v cd ·Γ(v c ) / max(|v cd |,|Γ(v c )|) 2 ;
[0058] I st =(FC+1)×S(c,d) / 2;
[0059] Among them, S(c, d) represents the similarity of the grayscale values of the pixels corresponding to the potential areas of two adjacent targets, W represents the calculation of the Wasserstein distance formula; FC represents the optical flow consistency of the motion trajectory of the infrared small target, v cd Indicates that from c to d vector, Γ(υ c ) indicates υ c Optical flow; I st represents the sparse trajectory intensity;
[0060] S5.2.2: Determine whether the sparse trajectory strength is greater than the set sparse trajectory strength threshold. If so, the trajectory connected by all potential areas is the true trajectory, the detected moving target position area is correct, and the corrected binary image of the continuous infrared small target is output; if not, return to step S2.
[0061] The infrared target video includes real-time shooting by an infrared high-speed camera, infrared target images with continuous frames crawled by a crawler, and videos with continuous frames crawled by a crawler.
[0062] A detection system using a visual detection method for cable laying, comprising:
[0063] Data acquisition and preprocessing module, used to collect infrared target images or videos in real time and perform blind pixel detection and preprocessing operations;
[0064] A spatiotemporal weighted graph calculation module, used for calculating a spatial weighted graph and a temporal weighted graph of the target potential area;
[0065] A small target detection module is used to fuse the calculated spatial weighted graph and temporal weighted graph to obtain the final spatiotemporal target features and perform small target detection;
[0066] The correction module is used to detect the wrong target position and correct the wrong target position.
[0067] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located executes a visual inspection method for cable laying.
[0068] The beneficial effects of the present invention are as follows: a continuous infrared small target image is obtained by extracting video frames from an infrared target video, and the infrared small target image is subjected to blind pixel detection, smoothing and prior weighted preprocessing operations in sequence to obtain a preprocessed infrared small target image; the preprocessed infrared small target image is divided into regions, and a multi-scale local variance is obtained according to the grayscale values between different regions; a spatial weighted map of a potential region is calculated according to the multi-scale local contrast feature, the multi-scale local variance and a robust regional density level strategy; the obtained spatial weighted map can comprehensively detect the error detection problems that occur during the detection process, and a sparse trajectory intensity strategy is used to correct the error detection. , further improve the detection accuracy, so as to obtain the effect of accurate detection of cable appearance and tracking detection of cables; use abundance to calculate the change value of pixel grayscale in different regions after different frames are divided, and obtain the time domain weighted map of the infrared small target image at different times. The obtained time domain weighted map can comprehensively solve the problem of detection and processing difficulties when the target moves to the edge of the high radiation area or there is a bright background area around the target; use the spatial weighted map and the time domain weighted map to obtain the final target feature value. When the target feature value is greater than the adaptive threshold, the sparse trajectory intensity strategy is used to correct the moving position of the infrared small target, and the corrected binary map of the continuous infrared small target is output. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 is a flow chart of a visual inspection method for cable laying of the present invention;
[0070] Figure 2 yes Figure 1 A simplified flowchart of the process. DETAILED DESCRIPTION
[0071] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0072] Embodiment 1:
[0073] like Figure 1 , Figure 2 As shown, a visual inspection method for cable laying of the present invention comprises the following steps:
[0074] S1: Obtain infrared target video of the cable and extract video frames, wherein the infrared target video includes real-time shooting by an infrared high-speed camera, infrared target images with continuous frames crawled by a crawler, and videos with continuous frames crawled by a crawler; obtain continuous infrared small target images;
[0075] S2: performing blind pixel detection, smoothing and prior weighting preprocessing operations on the infrared small target image in sequence to obtain a preprocessed infrared small target image;
[0076] Blind pixels refer to pixels whose output signals do not conform to the normal law of photoelectric conversion. They can be expressed in two forms in the image: one is fixed noise, and the other is pixel flickering changes. Fixed noise means that the pixel output is always a fixed value. Although it affects the visual effect of the image, it has little effect on infrared moving target detection. Irregular flickering pixels have light and dark changes that are irrelevant to the scene. They can neither be judged as foreground targets nor effectively describe the background, which makes target detection difficult. Therefore, this step first performs blind pixel detection on the infrared small target image.
[0077] S2.1: Take the time domain average of K consecutive frames of infrared small target images to obtain the average image The specific calculation formula is as follows:
[0078]
[0079] in, Represents the average image The temporal mean value of the grayscale at the coordinate (i, j) in the middle, f(i, j, k) represents the grayscale value of the pixel at the coordinate (i, j) in the k-th frame of the infrared small target image, and K represents the frame number;
[0080] S2.2: Average image Find the spatial average C and calculate the average image The absolute value D(i,j) of the difference between the grayscale time domain mean and the spatial domain mean C is calculated as follows:
[0081]
[0082] Where M represents the average image The width of N represents the average image The height of C represents the average image The spatial average value of
[0083] S2.3: According to the blind pixel judgment threshold σ(i,j), grayscale time domain mean The absolute value D(i,j) of the difference between the coordinates (i,j) and the spatial average value C is used to determine whether the absolute value D(i,j) of the infrared small target image at the coordinate (i,j) is greater than 3σ(i,j). If so, the coordinate (i,j) is a blind pixel, and the identification value here is 0; if not, the coordinate (i,j) is a valid pixel, and the identification value here is 1; the specific calculation formula is as follows:
[0084]
[0085] Among them, σ(i,j) represents the blind pixel judgment threshold, μ(i,j) represents the mean value of the pixels of the infrared small target image in the kth frame;
[0086] S2.4: Compensate for the blind pixel obtained in step S2.3. The specific calculation formula is as follows:
[0087]
[0088] Wherein, f'(i,j,k) represents the gray value of the compensated pixel at the coordinate (i,j) of the kth frame, f(i-1,j,k) and f(i+1,j,k) represent the gray values of the non-blind pixels of the two adjacent pixels on the left and right of the coordinate (i,j);
[0089] S2.5: Smoothing the infrared small target image by combining a two-dimensional Gaussian function and a hierarchical gradient strategy. Preferably, a two-dimensional Gaussian function with a kernel size of 4×4 is used;
[0090] The target is moving and the background is changing. Using only edge information to enhance the target may miss the target, because small targets are point-like in most cases. It is also unreasonable to use only corner information for image enhancement. When the target moves to the edge of the bright background, if only the corner features are considered, the target features will be ignored. This may cause the target to be missed. Therefore, the weighted harmonic mean is used to obtain the final preprocessed infrared small target image, and the edge features of the preprocessed infrared small target image are weighted by the prior weighted normalization weights. The specific calculation formula is as follows:
[0091]
[0092] I pre =w×I G ;
[0093]
[0094] Among them, I G represents the smoothed infrared image, C G (m, n) represents the coefficient of the Gaussian gradient kernel at the position (m, n), f(i+m, j+n) is the grayscale value of the pixel at the position (i+m, j+n) of the input image, and the two-dimensional Gaussian function uses a two-dimensional Gaussian function with a kernel size of 4×4. The ranges of m and n are from -2 to 2, respectively, indicating that the Gaussian kernel operation is performed within a 5×5 window; I pre represents the preprocessed infrared small target image, w represents the prior weighted normalization weight; PI represents the weighted harmonic mean of the corner information of the preprocessed infrared small target image, m1 represents the corner information of the infrared moving small target image pixel, m2 represents the edge information of the infrared moving small target image pixel, S represents the corner indicator of the infrared moving small target image pixel, E represents the edge indicator of the infrared moving small target image pixel, Max represents the maximum value, and Min represents the minimum value.
[0095] Through the above steps, the background of the infrared small target image can be well suppressed, and the infrared moving small target can be enhanced, so that the probability of the target being detected is greatly improved.
[0096] S3: Divide the preprocessed infrared small target image into regions to obtain the potential region, inner neighborhood and outer neighborhood of the preprocessed infrared small target image. Obtain multi-scale local contrast features through the contrast difference between the inner neighborhood, outer neighborhood and the potential region. Obtain multi-scale local variance through the grayscale values of the inner neighborhood, outer neighborhood and the potential region. According to the multi-scale local contrast features and multi-scale local variance and using the robust regional density level strategy, calculate and obtain the spatial weighted map of the potential region.
[0097] S3.1: Divide the preprocessed infrared small target image into regions. Preferably, a three-layer filter with window sizes of 2×2, 3×3 and 5×5 is used to segment the final preprocessed infrared small target image, and obtain the potential region, inner neighborhood and outer neighborhood of the target in turn. The inner neighborhood includes 8 sub-regions, and the outer neighborhood includes 16 sub-regions.
[0098] S3.2: The multi-scale local contrast feature is obtained by the contrast difference between the inner neighborhood, the outer neighborhood and the potential area, and the multi-scale local variance is obtained by the grayscale value of the potential area, the inner neighborhood and the outer neighborhood. The specific calculation formula is as follows:
[0099]
[0100] MLCT = G(IB)*G(OB);
[0101]
[0102] Among them, OB is the outer neighborhood; IB refers to the inner neighborhood, m t Represents the average grayscale value of the target potential area, m(IB i ) represents the average grayscale value of the i-th inner neighborhood. m(OB i ) represents the average grayscale of the i-th outer neighborhood; G(IB) represents the contrast difference between the inner neighborhood and the target potential area, G(OB) represents the contrast difference between the outer neighborhood and the target potential area, MLCT represents the multi-scale local contrast feature of the infrared small target image; MLV represents the multi-scale local variance of the infrared small target image, x1,…,x n represents the grayscale values of the pixels in the inner neighborhood, outer neighborhood, and target potential area respectively, and x represents the average grayscale value level of the pixels in the inner neighborhood, outer neighborhood, and target potential area;
[0103] S3.3: Based on the multi-scale local contrast features, multi-scale local variance and the robust regional density level strategy, the spatial weighted map of the potential area is calculated; the specific calculation formula is as follows:
[0104]
[0105] RRIL i =(M k (i)-min((mean(i),median)))*(M k (i)-M kmin (i));
[0106] Among them, RRIL represents the spatial weighted map of the final potential region, RRILT represents the robust regional density level of the potential target region, and represents the robust regional intensity level calculated by the i-th region of the outer neighborhood and the inner neighborhood, RRILi represents the robust regional intensity level of the i-th sub-region, M k (i) represents the average value of the first k maximum pixel grayscale values in the ith sub-region, mean represents the mean calculation of the pixel grayscale value in the ith sub-region, median represents the median calculation of the pixel grayscale value in the ith sub-region, and M kmin (i) represents the average value of the last k minimum pixel grayscale values in the i-th sub-region.
[0107] S4: In infrared images, moving targets have higher grayscale values than the surrounding background. When a small infrared target passes through a certain position, the grayscale of that position changes from dark to bright and then from bright to dark. The temporal intensity distribution curve formed by the target movement is similar to the Gaussian distribution. In probability theory and statistics, abundance is a measure of the "tail" of the probability distribution of a real-valued random variable. Abundance can describe the steepness and temperature of the distribution. Therefore, the abundance is used to calculate the change in the grayscale of pixels in different regions after different frame divisions, and the temporal weighted graph T of the infrared small target image at different times is obtained. W ; The specific calculation formula is as follows:
[0108] T W = kur(I seq );
[0109]
[0110] Among them, Iseq is the pixel grayscale value in the input image sequence after preprocessing, kur represents the abundance of the pixel grayscale value of the input preprocessed image, X represents the corresponding pixel grayscale value after the video frame is divided into regions; μ is the mean of the pixel grayscale value, σ is the standard deviation of the pixel grayscale value, and E is the expected operation.
[0111] S5: multiply the calculated spatial weighted map and the temporal weighted map to obtain the final target feature value, and determine whether the target feature value is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target, and the moving position of the infrared small target is corrected using the sparse trajectory intensity strategy, and the corrected binary map of the continuous infrared small target is output. If not, return to step S2;
[0112] S5.1: Multiply the calculated spatial weighted map and the temporal weighted map to obtain the final target eigenvalue T, and determine whether the target eigenvalue is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target. The specific calculation formula is as follows:
[0113] T=T W *RRIL;
[0114] T Z =m+v*var;
[0115] Where T represents the final target feature value; T Z represents the adaptive threshold; m represents the mean of the target potential area; var represents the variance of the target potential area, and v is an adjustable parameter with a range of [0.5, 1];
[0116] S5.2: Use the sparse trajectory intensity strategy to correct the moving position of the infrared small target and output the corrected binary image of the continuous infrared small target; the specific steps are as follows:
[0117] S5.2.1: According to the distribution of the grayscale values of the pixels corresponding to the two target potential regions, υ c and d , calculate the similarity S(c,d), the optical flow consistency FC of the infrared small target trajectory, and the sparse trajectory intensity I st ; The specific calculation formula is as follows:
[0118] S(c,d)=exp(-W(υ c ,υ d ));
[0119] FC=v cd ·Γ(v c ) / max(|v cd |,|Γ(v c )|) 2 ;
[0120] I st =(FC+1)×S(c,d) / 2;
[0121] Among them, S(c, d) represents the similarity of the grayscale values of the pixels corresponding to the potential areas of two adjacent targets, W represents the calculation of the Wasserstein distance formula; FC represents the optical flow consistency of the motion trajectory of the infrared small target, v cd Indicates that from c to d vector, Γ(υ c ) indicates υ c Optical flow of I st represents the sparse trajectory intensity;
[0122] S5.2.2: Determine whether the sparse trajectory strength is greater than the set sparse trajectory strength threshold. If so, the trajectory connecting all potential areas is the true trajectory, the detected moving target position area is correct, and the corrected binary image of the continuous infrared small target is output; if not, return to step S2, re-detect the incorrectly detected infrared small target position area, and replace the incorrect area with the obtained correct position area.
[0123] Through this sparse trajectory strength strategy, the position area of the small moving target can be continuously corrected, thereby better improving the detection accuracy and reducing missed detection or false detection caused by complex background interference.
[0124] Embodiment 2:
[0125] A detection system using a visual detection method for cable laying, comprising:
[0126] Data acquisition and preprocessing module, used to collect infrared target images or videos in real time and perform blind pixel detection and preprocessing operations;
[0127] A spatiotemporal weighted graph calculation module, used for calculating a spatial weighted graph and a temporal weighted graph of the target potential area;
[0128] A small target detection module is used to fuse the calculated spatial weighted graph and temporal weighted graph to obtain the final spatiotemporal target features and perform small target detection;
[0129] The correction module is used to detect the wrong target position and correct the wrong target position.
[0130] Embodiment 3:
[0131] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located executes a visual inspection method for cable laying.
[0132] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
Claims
1. A visual inspection method for cable laying, characterized in that: The following steps are involved: S1: Obtain infrared target video of the cable and extract video frames to obtain continuous infrared small target images; S2: performing blind pixel detection, smoothing and prior weighting preprocessing operations on the infrared small target image in sequence to obtain a preprocessed infrared small target image; S3: Divide the preprocessed infrared small target image into regions to obtain the potential region, inner neighborhood and outer neighborhood of the preprocessed infrared small target image. Obtain multi-scale local contrast features through the contrast difference between the inner neighborhood, outer neighborhood and the potential region. Obtain multi-scale local variance through the grayscale values of the inner neighborhood, outer neighborhood and the potential region. According to the multi-scale local contrast features and multi-scale local variance and using the robust regional density level strategy, calculate and obtain the spatial weighted map of the potential region. S4: using the abundance to calculate the change value of the pixel grayscale in different regions after different frames are divided, and obtaining the time domain weighted graph of the infrared small target image at different times; S5: Multiply the calculated spatial weighted map and the temporal weighted map to obtain the final target eigenvalue, and determine whether the target eigenvalue is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target, and the sparse trajectory intensity strategy is used to correct the moving position of the infrared small target, and output the corrected binary map of the continuous infrared small target. If not, return to step S2.
2. The visual inspection method for cable laying according to claim 1, characterized in that: The step S2 specifically includes the following steps: S2.1: Take the time domain average of K consecutive frames of infrared small target images to obtain the average image The specific calculation formula is as follows: in, Represents the average image The temporal mean value of the grayscale at the coordinate (i, j) in the middle, f(i, j, k) represents the grayscale value of the pixel at the coordinate (i, j) in the k-th frame of the infrared small target image, and K represents the frame number; S2.2: Average image Find the spatial average C and calculate the average image The absolute value D(i,j) of the difference between the grayscale time domain mean and the spatial domain mean C is calculated as follows: Where M represents the average image The width of N represents the average image The height of C represents the average image The spatial average value of S2.3: According to the blind pixel judgment threshold σ(i,j), grayscale time domain mean The absolute value D(i,j) of the difference between the coordinates (i,j) and the spatial average value C is used to determine whether the absolute value D(i,j) of the infrared small target image at the coordinate (i,j) is greater than 3σ(i,j). If so, the coordinate (i,j) is a blind pixel, and the identification value here is 0; if not, the coordinate (i,j) is a valid pixel, and the identification value here is 1; the specific calculation formula is as follows: Among them, σ(i,j) represents the blind pixel judgment threshold, μ(i,j) represents the mean value of the pixels of the infrared small target image in the kth frame; S2.4: Compensate for the blind pixel obtained in step S2.
3. The specific calculation formula is as follows: Wherein, f'(i,j,k) represents the gray value of the compensated pixel at the coordinate (i,j) of the kth frame, f(i-1,j,k) and f(i+1,j,k) represent the gray values of the non-blind pixels of the two adjacent pixels on the left and right of the coordinate (i,j); S2.5: The infrared small target image is smoothed by combining a two-dimensional Gaussian function and a hierarchical gradient strategy, and the final pre-processed infrared small target image is obtained by weighted harmonic mean. The edge features of the pre-processed infrared small target image are weighted by a priori weighted normalization weights. The specific calculation formula is as follows: I pre =w×I G ; Among them, I G represents the smoothed infrared image, C G (m, n) represents the coefficient of the Gaussian gradient kernel at the position (m, n), f(i+m, j+n) is the grayscale value of the pixel at the position (i+m, j+n) of the input image, and the two-dimensional Gaussian function uses a two-dimensional Gaussian function with a kernel size of 4×4. The ranges of m and n are from -2 to 2, respectively, indicating that the Gaussian kernel operation is performed within a 5×5 window; I pre represents the preprocessed infrared small target image, w represents the prior weighted normalization weight; PI represents the weighted harmonic mean of the corner information of the preprocessed infrared small target image, m1 represents the corner information of the infrared moving small target image pixel, m2 represents the edge information of the infrared moving small target image pixel, S represents the corner indicator of the infrared moving small target image pixel, E represents the edge indicator of the infrared moving small target image pixel, Max represents the maximum value, and Min represents the minimum value.
3. The visual inspection method for cable laying according to claim 1, characterized in that: The step S3 specifically comprises the following steps: S3.1: Divide the preprocessed infrared small target image into regions to obtain a potential region, an inner neighborhood, and an outer neighborhood of the preprocessed infrared small target image; S3.2: The multi-scale local contrast feature is obtained by the contrast difference between the inner neighborhood, the outer neighborhood and the potential area, and the multi-scale local variance is obtained by the grayscale value of the potential area, the inner neighborhood and the outer neighborhood. The specific calculation formula is as follows: MLCT = G(IB)*G(OB); Among them, OB is the outer neighborhood; IB refers to the inner neighborhood, m t Represents the average grayscale value of the target potential area, m(IB i ) represents the average grayscale value of the i-th inner neighborhood. m(OB i ) represents the average grayscale of the i-th outer neighborhood; G(IB) represents the contrast difference between the inner neighborhood and the target potential area, G(OB) represents the contrast difference between the outer neighborhood and the target potential area, MLCT represents the multi-scale local contrast feature of the infrared small target image; MLV represents the multi-scale local variance of the infrared small target image, x1,…,x n Represents the grayscale values of the inner neighborhood, outer neighborhood, and target potential area pixels respectively, Represents the average grayscale value of pixels in the inner neighborhood, outer neighborhood, and target potential area; S3.3: Based on the multi-scale local contrast features, multi-scale local variance and the robust regional density level strategy, the spatial weighted map of the potential area is calculated; the specific calculation formula is as follows: RRIL i = (M k (i) - min((mean(i), median))) * (M k (i) - M kmin (i)); where RRIL represents The final spatially weighted map of latent regions, RRIL T represents the robust region density level of potential target regions, and represents the robust regional intensity level calculated by the i-th region of the outer neighborhood and the inner neighborhood, RRIL i represents the robust regional intensity level of the ith sub-region, Mk(i) represents the average of the first k maximum pixel grayscale values of the ith sub-region, mean represents the mean calculation of the pixel grayscale value of the ith sub-region, median represents the median calculation of the pixel grayscale value of the ith sub-region, and M kmin (i) represents the average value of the last k minimum pixel grayscale values in the i-th sub-region.
4. The visual inspection method for cable laying according to claim 1, characterized in that: The step S4 specifically comprises the following steps: S4.1: Use the abundance to calculate the change value of the pixel grayscale in different regions after different frame divisions, and obtain the time domain weighted graph T of the infrared small target image at different times W ; The specific calculation formula is as follows: T W =kur(I seq ); Among them, Iseq is the pixel grayscale value in the input image sequence after preprocessing, kur represents the abundance of the pixel grayscale value of the input preprocessed image, X represents the corresponding pixel grayscale value after the video frame is divided into regions; μ is the mean of the pixel grayscale value, σ is the standard deviation of the pixel grayscale value, and E is the expected operation.
5. The visual inspection method for cable laying according to claim 1, characterized in that: The step S5 specifically comprises the following steps: S5.1: Multiply the calculated spatial weighted graph and temporal weighted graph to obtain the final target eigenvalue T, judge whether the target feature value is greater than the adaptive threshold. If so, the target potential area is the moving position of the infrared small target. The specific calculation formula is as follows: T=T W *RRIL; T Z =m+v*var; Where T represents the final target feature value; T Z represents the adaptive threshold; m represents the mean of the target potential area; var represents the variance of the target potential area, and v is an adjustable parameter with a range of [0.5, 1]; S5.2: Use the sparse trajectory intensity strategy to correct the moving position of the infrared small target and output the corrected binary image of the continuous infrared small target; the specific steps are as follows: S5.2.1: According to the distribution of the grayscale values of the pixels corresponding to the two target potential regions, υ c and d , calculate the similarity S(c,d), the optical flow consistency FC of the infrared small target trajectory, and the sparse trajectory intensity I st ; The specific calculation formula is as follows: S(c,d)=exp(-W(υ c ,υ d )); FC=v cd ·Γ(in c ) / max(in cd ,Γ(in c )) 2 ; I st =(FC+1)×S(c,d) / 2; Among them, S(c, d) represents the similarity of the grayscale values of the pixels corresponding to the potential areas of two adjacent targets, W represents the calculation of the Wasserstein distance formula; FC represents the optical flow consistency of the motion trajectory of the infrared small target, v cd Indicates that from c to d vector, Γ(υ c ) indicates υ c Optical flow; I st represents the sparse trajectory intensity; S5.2.2: Determine whether the sparse trajectory strength is greater than the set sparse trajectory strength threshold. If so, the trajectory connected by all potential areas is the true trajectory, the detected moving target position area is correct, and the corrected binary image of the continuous infrared small target is output; if not, return to step S2.
6. The visual inspection method for cable laying according to claim 1, characterized in that :The infrared target video includes real-time shooting by an infrared high-speed camera, infrared target images with continuous frames crawled by a crawler, and videos with continuous frames crawled by a crawler.
7. A detection system using the visual detection method for cable laying according to any one of claims 1 to 6, characterized in that: include Data acquisition and preprocessing module, used to collect infrared target images or videos in real time and perform blind pixel detection and preprocessing operations; A spatiotemporal weighted graph calculation module, used for calculating a spatial weighted graph and a temporal weighted graph of the target potential area; A small target detection module is used to fuse the calculated spatial weighted graph and temporal weighted graph to obtain the final spatiotemporal target features and perform small target detection; The correction module is used to detect the wrong target position and correct the wrong target position.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the device where the computer-readable storage medium is located executes the design method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Infrared focal plane array blind pixel detection method and device
CN104330164A
Sparse trajectory smoothing error correction system and method
CN109765588A
Air infrared moving target detection method and device combined with space-time information
CN115830061A
PCB golden finger elbow forming device
CN117960947A
Cited By
Data line detection system and method based on weighted calculation
CN119359609A
A data line detection system and method based on weighted calculation
CN119359609B
