CN-121998955-A - Casting X-ray image defect detection method based on SAHI algorithm
Abstract
The invention provides a casting X-ray image defect detection method based on SAHI algorithm, which comprises the steps of carrying out defect labeling on an obtained casting X-ray image to obtain an initial data set, slicing and adjusting labeling the initial data set based on an overlapped graph cutting algorithm to obtain a graph cutting data set, constructing a deep learning network model, pre-training the deep learning network model based on the initial data set to obtain a pre-training model, fine-tuning the pre-training model based on the graph cutting data set to obtain a target network model, cutting the X-ray image of the casting to be detected into a plurality of overlapped image blocks based on SAHI algorithm, carrying out defect detection on the plurality of image blocks based on the target network model to obtain a plurality of detection results, mapping the detection results back to an image coordinate system of the X-ray image of the casting to be detected, and fusing to obtain a defect detection result. The invention reduces the calculation cost during model training, accelerates the training efficiency and improves the detection precision of the internal defects of the casting.
Inventors
- Wu Mengwu
- JIANG RENFENG
- HUANG QING
- HUA LIN
Assignees
- 武汉理工大学
Dates
- Publication Date
- 20260508
- Application Date
- 20260129
Claims (9)
- 1. A casting X-ray image defect detection method based on SAHI algorithm is characterized by comprising the following steps: acquiring an X-ray image of a casting, and performing defect labeling on the X-ray image of the casting to obtain an initial data set; slicing and adjusting labeling are carried out on the initial data set based on an overlapped graph cutting algorithm, and a graph cutting data set is obtained; Constructing a deep learning network model for detecting internal defects of castings, pre-training the deep learning network model based on the initial data set to obtain a pre-training model, and fine-tuning the pre-training model based on the cut map data set to obtain a target network model; dividing an X-ray image of the casting to be detected into a plurality of overlapped image blocks based on SAHI algorithm; performing defect detection on the image blocks based on the target network model to obtain a plurality of detection results corresponding to the image blocks one by one; And mapping each detection result back to the image coordinate system of the X-ray image of the casting to be detected, and fusing to obtain a defect detection result.
- 2. The method for detecting defects in an X-ray image of a casting based on SAHI algorithm according to claim 1, further comprising, prior to defect labeling of the X-ray image of the casting: And denoising and contrast enhancement are carried out on the X-ray image of the casting.
- 3. The method for detecting the defects of the X-ray image of the casting based on SAHI algorithm according to claim 2, wherein the denoising process adopts a non-local mean value filtering algorithm, and the contrast enhancement process adopts a limited contrast self-adaptive histogram equalization method.
- 4. The method for detecting defects in an X-ray image of a casting based on the SAHI algorithm according to claim 1, wherein slicing the initial dataset based on an overlap cut map algorithm includes: slicing the initial data set based on a preset first overlapping rate and a preset first size to obtain a plurality of graph cutting areas; Judging whether the size of the image cutting area positioned at the edge of the image in the initial data set is smaller than a first size; If so, reversely cutting the initial data set by taking the image edge as a starting point so that the size of each image cutting area is the same as the preset size.
- 5. The method for detecting defects in X-ray images of castings based on the SAHI algorithm according to claim 1 or 4, further comprising, after said obtaining the cut map dataset: And deleting the image blocks which do not contain defects in the cut map data set.
- 6. The method for detecting the defects of the X-ray image of the casting based on SAHI algorithm according to claim 1, wherein the pre-training model comprises a main network, a neck network and a detection head, the pre-training model is finely tuned based on the cut map data set to obtain a target network model, and the method comprises the following steps: Freezing the backbone network, training the neck network and the detection head based on the cut map data set, and obtaining a transition network model; and thawing the backbone network, and training the transition network model based on the graph cutting data set to obtain the target network model.
- 7. The method for detecting defects in an X-ray image of a casting based on SAHI algorithm according to claim 4, wherein the step of segmenting the X-ray image of the casting to be detected into a plurality of overlapping image blocks based on SAHI algorithm includes: Dividing an X-ray image of the casting to be detected into a plurality of overlapped image blocks based on SAHI algorithm, a preset second overlapping rate and a preset second size; the first overlap ratio and the second overlap ratio are equal, and the first size and the second size are equal.
- 8. The method for detecting defects in an X-ray image of a casting based on SAHI algorithm according to claim 1, further comprising, after mapping and fusing each of the detection results back into an image coordinate system of the X-ray image of the casting to be detected: and removing redundancy from the defect detection result based on a non-maximum suppression algorithm.
- 9. The method for detecting defects in X-ray images of castings based on the SAHI algorithm according to any one of claims 1 to 8, wherein the target network model is YOLO11-seg.
Description
Casting X-ray image defect detection method based on SAHI algorithm Technical Field The invention relates to the technical field of casting defect detection, in particular to a casting X-ray image defect detection method based on SAHI algorithm. Background The performance of large complex castings as key parts in important equipment such as aerospace, energy sources, petrochemical industry and the like directly influences the service life of the whole equipment. In the production and manufacturing process, the defects of shrinkage cavity, shrinkage porosity, inclusion, air holes and the like are easy to occur in a large complex casting under the influence of multiple factors such as process parameters, production environment and the like, the product performance is reduced to different degrees, and even catastrophic accidents are caused seriously. The accurate and efficient casting defect detection technology can effectively avoid the problems of economic loss and safety accidents caused by poor casting products. The existing large complex castings mainly rely on X-ray detection technology for nondestructive inspection, defects are identified through manual interpretation of X-ray images, and the problems of low efficiency, large influence of subjective factors of detection quality, high omission rate and the like exist. With the development of intelligent manufacturing and machine vision technologies, deep learning has become a research hotspot in the field of target detection with the advantages of strong learning ability, wide adaptability, good portability and the like. In order to improve the recognition accuracy of the target, various optimized deep learning target detection algorithms and network module improvement methods are sequentially proposed. The method improves the target recognition accuracy to a certain extent, but most of deep learning algorithms have better recognition effect in natural scenes and have poor effect on the detection of internal defects of castings. Specifically, the existing intelligent detection research of casting defects is mainly directly based on the training of the collected X-ray images, and is mainly aimed at improving a deep learning network model, and the problem of false leakage detection caused by the characteristics of the casting X-ray defect images on the deep learning network model is solved, wherein the specific problems are that the internal defects (such as air holes and shrinkage porosity) of the casting are usually represented as targets with smaller sizes in the X-ray images, and the inter-class differences are small and the intra-class differences are large. The traditional method generally compresses the high-resolution original image and inputs the compressed high-resolution original image into a network, so that key detail features of a small target are destroyed, spatial information is seriously lost, and detection accuracy is seriously affected. Therefore, it is needed to provide a method for detecting the defects of the X-ray image of the casting based on SAHI algorithm, which can adapt to the characteristics of the X-ray image of the casting and improve the defect detection precision. Disclosure of Invention In view of the foregoing, it is necessary to provide a method for detecting defects of an X-ray image of a casting based on SAHI algorithm, so as to solve the technical problem of false detection and omission caused by the characteristics of the X-ray image of the casting to a deep learning network model in the prior art. In order to solve the technical problems, in a first aspect, the present invention provides a method for detecting a casting X-ray image defect based on SAHI algorithm, including: acquiring an X-ray image of a casting, and performing defect labeling on the X-ray image of the casting to obtain an initial data set; slicing and adjusting labeling are carried out on the initial data set based on an overlapped graph cutting algorithm, and a graph cutting data set is obtained; Constructing a deep learning network model for detecting internal defects of castings, pre-training the deep learning network model based on the initial data set to obtain a pre-training model, and fine-tuning the pre-training model based on the cut map data set to obtain a target network model; dividing an X-ray image of the casting to be detected into a plurality of overlapped image blocks based on SAHI algorithm; performing defect detection on the image blocks based on the target network model to obtain a plurality of detection results corresponding to the image blocks one by one; And mapping each detection result back to the image coordinate system of the X-ray image of the casting to be detected, and fusing to obtain a defect detection result. In one possible implementation, before the defect labeling of the casting X-ray image, the method further includes: And denoising and contrast enhancement are carried out on the X-ray image of the casting. In on