CN-121994806-A - Ductile cast iron pipe defect detection method based on machine vision
Abstract
The invention relates to the technical field of machine vision and industrial defect detection, in particular to a ductile cast iron pipe defect detection method based on machine vision, which comprises the steps of acquiring target image data of the surface of a ductile cast iron pipe to be detected through image acquisition equipment arranged on a ductile cast iron pipe transmission pipeline; the method comprises the steps of generating a texture feature vector and a defect feature vector, generating a defect detection result based on a feature mutual information quantity between the texture feature vector and the defect feature vector, if the feature mutual information quantity is smaller than a mutual information threshold, generating the defect detection result, wherein the mutual information threshold is a threshold which is determined based on training samples or verification sample statistics, and if the feature mutual information quantity is larger than or equal to the mutual information threshold, adjusting network parameters and re-executing a feature tensor generation step until the feature mutual information quantity is smaller than the mutual information threshold or reaches a preset maximum iteration number, wherein the maximum iteration number is an iteration upper limit preset in a model training stage, and the method avoids feature collapse or misjudgment when deep features are fused.
Inventors
- LEI YU
- ZHAN PENG
- BAI YUNJIE
- Niu Zhoufeng
- CHENG JIAXIN
Assignees
- 西安邮电大学
- 陕西格伟奇节能科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260410
Claims (10)
- 1. The ductile cast iron pipe defect detection method based on machine vision is characterized by comprising the following steps of: Acquiring target image data of the surface of the ductile cast iron pipe to be detected through image acquisition equipment arranged on a ductile cast iron pipe transmission pipeline, wherein the image acquisition equipment at least comprises an industrial camera; inputting the target image data into a pre-trained feature decoupling network to generate a mixed feature tensor of the target image data in a feature latent space; Calculating the feature mutual information quantity between the texture feature vector and the defect feature vector based on the joint probability distribution of the texture feature vector and the defect feature vector and the respective edge probability distribution; if the mutual information quantity of the features is smaller than a mutual information threshold, performing defect detection on the target image data based on the defect feature vector to generate a defect detection result, wherein the mutual information threshold is a threshold determined based on training samples or verification sample statistics; If the characteristic mutual information quantity is larger than or equal to the mutual information threshold value, adjusting network parameters of the characteristic decoupling network, and returning to the step of inputting the target image data into the characteristic decoupling network trained in advance and generating a mixed characteristic tensor of the target image data in a characteristic latent space until the characteristic mutual information quantity is smaller than the mutual information threshold value or reaches a preset maximum iteration number, wherein the maximum iteration number is an iteration upper limit preset in a model training stage.
- 2. The machine vision-based ductile iron pipe defect detection method according to claim 1 wherein the performing orthogonal separation processing on the mixed feature tensor to generate a texture feature vector and a defect feature vector comprises: Extracting background texture distribution data and topology damage data in the mixed feature tensor based on a preset image segmentation and morphology topology analysis algorithm, wherein the background texture distribution data are used for representing gray distribution, texture direction distribution and texture period distribution of a continuous surface area in target image data, and the topology damage data are used for representing edge morphology, area connectivity and area cavity characteristics of a discontinuous area in the target image data; Mapping the background texture distribution data into the texture feature vector by using a first orthogonal projection matrix; And mapping the topological damage data into the defect feature vector by using a second orthogonal projection matrix, wherein the second orthogonal projection matrix is orthogonal to the first orthogonal projection matrix.
- 3. The machine vision-based ductile iron pipe defect detection method according to claim 1 wherein the performing defect detection on the target image data based on the defect feature vector to generate a defect detection result comprises: Inputting the defect feature vector into a pre-trained classification network to generate an initial class activation diagram; Acquiring a reference class activation diagram which is generated in advance based on the training of the flawless ductile cast iron pipe sample image; respectively determining a high response area center of the initial class activation diagram and a high response area center of the reference class activation diagram, wherein the high response area center is a geometric center of a pixel area with a response value larger than a preset response threshold value in the corresponding class activation diagram; Calculating the space distance between the center of the high response area of the initial class activation diagram and the center of the high response area of the reference class activation diagram, and normalizing the space distance according to the diagonal length of the target image data to obtain the focus offset rate of the attention; And if the focus offset rate is greater than a preset offset rate threshold, judging that the target image data has a real structural defect, and generating a first defect detection result, wherein the offset rate threshold is a threshold predetermined based on statistical distribution of defect-free samples and defect samples.
- 4. The machine vision-based ductile iron pipe defect detection method according to claim 3 further comprising: Under the condition that the focus offset rate is smaller than or equal to the preset offset rate threshold value, judging that the target image data only has pseudo defect interference, and generating a second defect detection result; And outputting the second defect detection result.
- 5. The machine vision-based ductile iron pipe defect detection method according to claim 1 wherein the adjusting network parameters of the feature decoupling network comprises: performing image reconstruction processing based on the texture feature vector and the defect feature vector to generate reconstructed image data; calculating a semantic reconstruction loss value between the reconstructed image data and the target image data, wherein the semantic reconstruction loss value is determined based on at least one of a pixel difference and a feature difference; And if the semantic reconstruction loss value is larger than a preset loss threshold value, updating the network weight of the characteristic decoupling network based on a preset gradient descent algorithm, wherein the loss threshold value is a threshold value predetermined based on training sample reconstruction error distribution.
- 6. The machine vision-based ductile iron pipe defect detection method according to claim 5 further comprising: under the condition that the semantic reconstruction loss value is smaller than or equal to the preset loss threshold value, keeping the current network weight of the characteristic decoupling network unchanged; Network convergence status flag data corresponding to the current target image data is generated, the network convergence status flag data being used to characterize that the current network weights are not updated in the current iteration.
- 7. The machine vision-based ductile iron pipe defect detection method according to claim 1 further comprising, after the acquiring the target image data: The illumination angle is switched by controlling the light source module, and the ductile cast iron pipe to be detected is controlled to rotate at a constant speed around the axis of the ductile cast iron pipe to be detected, so that a plurality of associated image data in different preset illumination conditions and different circumferential positions are obtained; inputting the plurality of associated image data into the feature decoupling network to generate a plurality of associated texture feature vectors; respectively calculating the statistical variances of the plurality of associated texture feature vectors according to the same feature dimension, and averaging the statistical variances of the feature dimensions to obtain a texture characterization invariance variance; and if the texture characterization invariance variance is smaller than a preset variance threshold, confirming that the feature decoupling network has feature extraction stability, wherein the variance threshold is a threshold predetermined based on texture feature fluctuation ranges of non-defective samples under different illumination conditions and different circumference positions.
- 8. The machine vision-based ductile iron pipe defect detection method according to claim 7 further comprising: retraining the feature decoupling network under the condition that the texture characterization invariance variance is greater than or equal to the preset variance threshold; And after the retraining process is finished, returning to execute the step of switching the illumination angle by controlling the light source module, and controlling the ductile cast iron pipe to be detected to rotate at a constant speed around the axis of the ductile cast iron pipe to be detected, so as to obtain a plurality of associated image data in different preset illumination conditions and different circumferential positions.
- 9. The machine vision-based ductile iron pipe defect detection method according to claim 2 wherein the background texture distribution data comprises annealed scale texture data, water spot texture data, and rough and heavy skin texture data; the topology damage data includes microcrack morphology data, cold shut morphology data, and air hole morphology data.
- 10. The machine vision-based ductile iron pipe defect detection method according to claim 3 further comprising, after the generating the first defect detection result: extracting high-frequency edge feature coordinates in the first defect detection result; mapping the high-frequency edge feature coordinates into space prior vectors by using a preset position coding function, and splicing and fusing the space prior vectors and mixed feature tensors in the feature latent space, wherein the position coding function is used for converting the space coordinates into fixed-length vector representations; constructing a preset feature shielding mask based on the space prior vector, wherein the feature shielding mask is used for marking pixel areas consistent with the distribution of the texture feature vector; And performing weight reduction processing on the pixel area by using the characteristic shielding mask so as to inhibit pseudo defect texture response.
Description
Ductile cast iron pipe defect detection method based on machine vision Technical Field The invention relates to the technical field of machine vision and industrial defect detection, in particular to a ductile cast iron pipe defect detection method based on machine vision. Background The machine vision defect detection is an important means of industrial quality inspection, and the technical essence of the machine vision defect detection is that the automatic positioning and classification of defects are realized by collecting surface images of products and extracting image features by utilizing a deep learning network; At present, for large-curvature cylindrical application scenes such as ductile cast iron pipes, under the working conditions of complex dynamic illumination and high-speed rotation in industrial sites, the inherent large-area annealing scale, water cooling spots and other compliant background textures on the surfaces of the pipes are highly coupled with micro cracks, air holes and other real defects on the gradient of bottom pixels; Therefore, how to perform strict orthogonal decoupling and stripping on the random texture and the true topological structure defect under the complex background interference effectively inhibits the pseudo defect so as to improve the robustness of the model, and becomes the technical problem of computer vision to be solved. Disclosure of Invention The invention aims to provide a machine vision-based ductile cast iron pipe defect detection method, which solves the following technical problems: The method has the advantages that the characteristic confusion and misjudgment caused by curved surface illumination nonlinear distortion and residual high-frequency noise are avoided, the inherent morphological randomness and the real structural defect of the material are more easily stripped in the mathematical level, the characteristic collapse of a model is prevented, the high robustness of the system is endowed under the complex background and dynamic illumination interference, the interference of the pseudo defect to a downstream module is blocked, and the system-level characteristic immunity of a full link is realized. The aim of the invention can be achieved by the following technical scheme: The ductile cast iron pipe defect detection method based on machine vision comprises the following steps: Acquiring target image data of the surface of the ductile cast iron pipe to be detected through image acquisition equipment arranged on a ductile cast iron pipe transmission pipeline, wherein the image acquisition equipment at least comprises an industrial camera; Inputting the target image data into a pre-trained feature decoupling network to generate a mixed feature tensor of the target image data in a feature latent space; performing orthogonal separation processing on the mixed feature tensor to generate a texture feature vector and a defect feature vector; Calculating the feature mutual information quantity between the texture feature vector and the defect feature vector based on the joint probability distribution of the texture feature vector and the defect feature vector and the respective edge probability distribution; if the mutual information quantity of the features is smaller than a mutual information threshold, performing defect detection on the target image data based on the defect feature vector to generate a defect detection result, wherein the mutual information threshold is a threshold determined based on training samples or verification sample statistics; If the characteristic mutual information quantity is larger than or equal to the mutual information threshold value, adjusting network parameters of the characteristic decoupling network, and returning to the step of inputting the target image data into the characteristic decoupling network trained in advance and generating a mixed characteristic tensor of the target image data in a characteristic latent space until the characteristic mutual information quantity is smaller than the mutual information threshold value or reaches a preset maximum iteration number, wherein the maximum iteration number is an iteration upper limit preset in a model training stage. Optionally, performing orthogonal separation processing on the mixed feature tensor to generate a texture feature vector and a defect feature vector, including: Extracting background texture distribution data and topology damage data in the mixed feature tensor based on a preset image segmentation and morphology topology analysis algorithm, wherein the background texture distribution data are used for representing gray distribution, texture direction distribution and texture period distribution of a continuous surface area in target image data, and the topology damage data are used for representing edge morphology, area connectivity and area cavity characteristics of a discontinuous area in the target image data; Mapping the background texture distr