An Image Data Enhancement Method for the Inner Wall Defects of Artillery Barrels
Through Poisson fusion and attention mechanism modules in StyleGAN2-ADA network, high-quality and diverse defect images of the inner wall of the artillery barrel are generated, solving the accuracy and efficiency of defect detection under small sample conditions, and achieving better defect detection results.
Patent Information
- Application Number
- CN202411661245.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The prior art is difficult to generate high-quality and diverse images of the inner wall of the artillery barrel under small sample conditions, resulting in limited accuracy and efficiency of deep learning models in defect detection.
Through the Poisson fusion method, the steel surface defect data set is combined with the defect-free image of the inner wall of the artillery body tube to generate realistic defect images, and a self-attention mechanism and full-dimensional dynamic convolution module are introduced into the StyleGAN2-ADA network to build a new image generation network structure.
It effectively solves the problem that defect images are difficult to obtain in the inner wall of the artillery barrel, provides rich data resources for the deep learning model, improves the quality and diversity of generated images, and thus improves the accuracy and efficiency of defect detection.
Smart Images

Figure CN119624878B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to a method for enhancing image data of defects on the inner wall of a gun barrel. Background Art
[0002] Defects on the inner wall of a gun barrel have a direct impact on the performance and safety of the gun. These defects may lead to a decrease in shooting accuracy and even trigger dangerous launch accidents. Traditional defect detection methods, such as ultrasonic detection and optical inspection, are often time-consuming and have limited accuracy. With the development of deep learning technology, it provides new possibilities for automatically and efficiently identifying defects on the inner wall of a gun barrel.
[0003] However, the training of deep learning models relies on a large amount of high-quality image data, and the acquisition of images of defects on the inner wall of a gun barrel faces unique challenges. Field collection is not only costly, but also due to the use environment of the gun, the images are often affected by physical factors such as dust, uneven illumination, and surface reflection, resulting in a decrease in image quality. In addition, due to safety and production efficiency considerations, the image data of gun barrels with defects is very limited. Therefore, developing data augmentation techniques that can work under small sample conditions is crucial for improving the performance of defect detection models.
[0004] Current data augmentation methods, such as flipping, rotation, and adding noise, although they can expand the dataset, they cannot add new defect types or scene diversity. Generative adversarial networks (GANs) have the potential to generate new samples, but they may encounter mode collapse problems during training, resulting in a lack of diversity in the generated images.
[0005] In summary, how to explore and develop new data augmentation techniques to generate high-quality and diverse defect images, so as to improve the accuracy and efficiency of defect detection on the inner wall of a gun barrel, is an urgent problem to be solved by those skilled in the art at present. Summary of the Invention
[0006] The technical solution of the present invention to solve the above technical problems is to provide a method for enhancing image data of defects on the inner wall of a gun barrel, including the following steps:
[0007] Step 1: Obtain a dataset of defects on the surface of steel, and perform preprocessing on the dataset by histogram equalization and sharpening with a Laplacian operator;
[0008] Step 2: Take the preprocessed image as the target image, and the image of the inner wall of the gun barrel without defects as the background image. Generate a mask image according to the label information of the target image, and perform Poisson fusion on the target image, the mask image, and the background image to generate an image of defects on the inner wall of the gun barrel;
[0009] Step 3: Classify the generated inner wall defect images of the gun barrel into four categories: cracks, scratches, burns, and wear, and use Labelme for image annotation to form a complete dataset of inner wall defects of the gun barrel;
[0010] Step 4: Build a StyleGAN2-ADA network architecture, including a generator and a discriminator. Add a new attention mechanism module before the upsampling layer in the synthesis network of the generator. The new attention mechanism module consists of a self-attention mechanism module and a full-dimensional dynamic convolution module in parallel;
[0011] Step 5: Initialize the network with the training weights of the steel surface defect dataset in StyleGAN2-ADA, and then send the inner wall defect dataset of the gun barrel into the StyleGAN2-ADA network with set parameters for training;
[0012] Step 6: After training, load the optimal weight file into the network to generate single-type inner wall defect images of the gun barrel according to the conditional information agreement.
[0013] Further, in the step 4, the generator includes a mapping network and a synthesis network. The mapping network includes 8 fully connected layers; the synthesis network includes 7 resolution layers, and the resolution layers range from 4*4 module to 256*256; the 4*4 module contains a convolutional layer, a torgb layer for converting the feature map into an RGB image, and two intermediate layers; the 8*8 and the remaining resolution modules contain an upsampling layer, a convolutional layer, and two intermediate layers; the new attention mechanism module is before the upsampling layer.
[0014] Further, in the step 4, the discriminator includes a fromrgb layer and 7 resolution modules from 256*256 to 4*4; each resolution module from 256*256 to 8*8 includes a skip layer to implement a residual structure, skipping the feature maps at different scales. The residual structure contains a downsampling layer and a convolutional layer; among them, after the last downsampling layer, a multi-normalization layer and a fully connected layer are connected; the last output layer is used to output the image.
[0015] Further, in the step 1, the histogram equalization increases the contrast by widening the gray values of the important parts in the image and merging the rest, and the specific formula is as follows:
[0016] s = clog(1 + r).
[0017] Further, in the step 1, the Laplacian operator sharpening further increases or decreases the gray value of the central pixel by judging the size of the gray value of the central pixel and the average gray value of other pixels in the neighborhood, and the specific formula is as follows:
[0018]
[0019] Further, in the above-mentioned step 2, the Poisson fusion includes:
[0020] Input the mask image, the original image, and the background image into the network to determine the fusion position in the background image, and perform fusion through the following formula:
[0021]
[0022] where ω is the fusion target, V is its gradient field, S is the background image, Ω is the fusion region, is the fusion boundary, the pixels inside Ω after fusion are f, and the outside is f * .
[0023] Further, in the above-mentioned step 5, the training process includes setting the learning rate, the number of batch samples, and the number of iterated thousand images, and initializing the network with the training weights of StyleGAN2-ADA using the face dataset.
[0024] The technical solution of the present invention combines the steel surface defect dataset with the defect-free image of the inner wall of the gun barrel through the Poisson fusion method to generate a realistic defect image of the inner wall of the gun barrel. This method effectively solves the problem that it is difficult to obtain the actual defect image of the inner wall of the gun barrel, and provides rich data resources for the training of the deep learning model. A parallel combination of the attention mechanism module and the all-dimensional dynamic convolution (ODconv) module is introduced into STYLEGAN2 to construct a novel image generation network structure. This structure enables the generator to simultaneously focus on local and global features, improving the quality and diversity of the generated images. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the structures shown in these drawings without creative efforts.
[0026] Figure 1 is the step flow chart of the method for enhancing the defect image data of the inner wall of the gun barrel according to the present invention;
[0027] Figure 2 is the schematic diagram of the self-attention mechanism of the present invention;
[0028] Figure 3 is the influence diagram of different resolutions on the generated images of the present invention;
[0029] Figure 4 Example diagrams of defect images with different resolutions of the present invention;
[0030] Figure 5 FID score diagram during the training process of the present invention;
[0031] Figure 6 Example diagrams of defect images in the enhanced dataset of the present invention;
[0032] Figure 7 Example diagram of defect image detection of the present invention;
[0033] Figure 8 Network architecture diagram of StyleGAN2-ADA of the present invention. Detailed implementation manners
[0034] The present invention proposes a method for enhancing defect image data of the inner wall of a gun barrel, aiming to design a method for enhancing defect image data of the inner wall of a gun barrel based on conditional enhancement and attention mechanism.
[0035] The method for enhancing defect image data of the inner wall of a gun barrel proposed by the present invention will be described in the following specific embodiments:
[0036] In the technical solution of this embodiment, as Figure 1 shown, a method for enhancing defect image data of the inner wall of a gun barrel includes the following steps:
[0037] Step 1: Obtain a dataset of surface defects of steel, and perform preprocessing on the dataset, including histogram equalization and sharpening with a Laplacian operator;
[0038] Specifically, adjust the preprocessed image to 256*256. Histogram equalization: Perform histogram equalization on the crack defect image. By widening the gray values of important parts in the image and merging the rest, the contrast is increased to solve the problem that the gray levels of the crack defect image are concentrated in the low brightness range due to insufficient light during the acquisition process; Sharpening with a Laplacian operator is an image enhancement method derived from second-order differentiation. By judging the gray value of the central pixel and the average gray value of other pixels in the neighborhood, the gray value of the central pixel is further increased or decreased to enhance the contrast at the details of other defect images and complete the sharpening process.
[0039] Step 2: Use the preprocessed image as the target image, and the image of the inner wall of the gun barrel without defects as the background image. Generate a mask image according to the label information of the target image, and perform Poisson fusion on the target image, the mask image, and the background image to generate a defect image of the inner wall of the gun barrel;
[0040] Specifically,
[0041] Step 3: Classify the generated inner wall defect images of the gun barrel into four categories: cracks, scratches, burns, and wear, and use Labelme for image annotation to form a complete dataset of inner wall defects of the gun barrel;
[0042] Step 4: Build a StyleGAN2-ADA network architecture, including a generator and a discriminator, and add a new attention mechanism module before the upsampling layer in the synthesis network of the generator. The new attention mechanism module is composed of a self-attention mechanism module and a full-dimensional dynamic convolution module in parallel;
[0043] Step 5: Initialize the network with the training weights of StyleGAN2-ADA using the steel surface defect dataset, and then send the inner wall defect dataset of the gun barrel into the StyleGAN2-ADA network with set parameters for training;
[0044] Step 6: After training, load the optimal weight file into the network to generate single-type inner wall defect images of the gun barrel according to the agreed conditional information.
[0045] Specifically, as Figure 8 shown, adding an attention mechanism is an important means to improve the model performance. By assigning different weights to each region in the image, the generation model can focus on the key information of the defect and reduce the attention to irrelevant regions, thereby improving the quality of the generated images. Compared with other attention mechanisms, when extracting image features and allocating weights, they are restricted by local connections and sequential calculations and cannot establish interactions at all positions in the global context; the self-attention mechanism can directly integrate the positional relationships between any two pixels or features in the image, is not restricted by local structures, globally and parallelly processes spatial information, and dynamically adjusts the attention weights according to the data itself to enhance the attention to defect information. The principle is as Figure 2 shown. First, the extracted feature map x is transformed into three different feature spaces f, g, and h using three matrices W f , W g and W h to obtain feature maps f(x), g(x), and h(x); secondly, f(x) is transposed and dot-product operation is performed with g(x), and then the dot-product result is normalized by softmax to obtain the attention feature map β; then β is dot-product with h(x) to obtain the self-attention feature map ο; finally, the self-attention feature map ο is added to the original convolution feature map x to obtain the final feature map y for output.
[0046] The all-dimensional dynamic convolution module aims to extract local features of images. However, traditional convolution kernels are limited by fixed parameters, resulting in a limited capture range. The all-dimensional dynamic convolution module (ODConv) enables the convolution kernel to dynamically adjust its parameters according to different inputs or latent space vectors by adding an attention mechanism. It learns the attention values along four dimensions: the dimension of the kernel space, the input channel dimension, the output channel dimension, and the kernel dimension in a parallel manner, and applies them to the corresponding convolution kernels. Without increasing the computational complexity, all the kernels in the convolution operation can capture more complex structures and rich context clues in the data, thereby enhancing the feature extraction ability of the basic convolution operation of the network. The specific formula is as follows:
[0047]
[0048] Among them, α wi ∈R represents different attention scalars assigned to the convolution kernel W i ; α si ∈R k×k represents different attention scalars assigned to each convolution kernel in the kernel space; represents different attention scalars assigned to the c in channels of each convolution kernel; represents different attention scalars assigned to the c out channels of each convolution kernel; and represent the input feature and the output feature respectively.
[0049] Although the self-attention mechanism can focus on both global information and observe local details, self-attention usually calculates the attention weights for all positions, which may weaken the network's attention to local features. To solve this problem, this application proposes to combine the self-attention mechanism and ODConv in parallel to form a new attention mechanism module. The local information is extracted through the ODConv layer, and the global information is extracted through the self-attention layer. It can not only retain local details but also use global information for feature learning, considering both local and global information simultaneously to achieve the generation of high-quality images. The comparison of information capture by the improved attention mechanism module is shown in Table 1.
[0050] Table 1 Comparison table of information capture:
[0051]
[0052] Further, in the step 4, the generator includes a mapping network and a synthesis network. The mapping network includes 8 fully connected layers; the synthesis network includes 7 resolution layers, and the resolution layers range from 4*4 module to 256*256. The 4*4 module contains a convolutional layer, a torgb layer for converting the feature map into an RGB image, and two intermediate layers; the 8*8 and the remaining resolution modules contain an upsampling layer, a convolutional layer, and two intermediate layers; the new attention mechanism module is before the upsampling layer.
[0053] Further, in the step 4, the discriminator includes a fromrgb layer and 7 resolution modules from 256*256 to 4*4. Each resolution module from 256*256 to 8*8 includes a skip layer for implementing a residual structure, skipping the feature maps at different scales. The residual structure contains a downsampling layer and a convolutional layer. After the last downsampling layer, a multi-normalization layer and a fully connected layer are connected; the last output layer is used to output an image.
[0054] Further, in the step 1, the histogram equalization is performed by widening the gray values of the important parts in the image and merging the remaining parts, thereby increasing the contrast. The specific formula is as follows:
[0055] s = clog(1 + r).
[0056] Further, in the step 1, the Laplacian operator sharpening is performed by judging the gray value of the central pixel and the average gray value of other pixels in the neighborhood, and further increasing or decreasing the gray value of the central pixel. The specific formula is as follows:
[0057]
[0058] Further, in the step 2, the Poisson fusion includes:
[0059] Inputting the mask image, the original image, and the background image into the network to determine the fusion position in the background image, and performing fusion through the following formula:
[0060]
[0061] where ω is the fusion target, V is its gradient field, S is the background image, Ω is the fusion region, is the fusion boundary, and the pixels in Ω after fusion are f, and the outside is f * .
[0062] Further, in the step 5, the training process includes setting the learning rate, the number of batch samples, and the number of iterations per thousand images, and initializing the network with the training weights of StyleGAN2-ADA using the face dataset.
[0063] Experimental Analysis:
[0064] To verify the enhancement effect of the data enhancement method proposed in this paper on the inner wall defect data of gun barrels, the generated results at different stages are analyzed.
[0065] First, images with different resolutions are selected. The images in the inner wall defect dataset of gun barrels are respectively adjusted to the sizes of 128×128, 256×256, and 512×512 resolutions and sent into the improved network for training. The results are as Figure 3 shown. It can be seen that as the resolution increases, the FID value gradually decreases. This is because for images with low resolution, the generator can obtain less effective information and cannot sufficiently learn the feature distribution of the original image, resulting in low-quality generated images.
[0066] Figure 4 The inner wall defect images of gun barrels with different resolution sizes are respectively shown, which can more directly observe the differences in the generated images. Figure 4 (a), (b), and (c) have resolutions of 128×128, 256×256, and 512×512 respectively. It can be seen that the defect features of 512×512 are more obvious and easier to observe.
[0067] Secondly, the generated images at different times are selected. As Figure 5 can be seen, the number of iterations is proportional to the quality of the generated images and inversely proportional to the FID value. At 40kimg, the FID value is 58.3666, and the generated images already have a general shape, but the quality of the generated images is low; as the number of training times increases, at 680kimg, the FID value is 24.0271, and the image quality increases. Finally, the FID value reaches 22.8156, and various types of generated defects can be clearly observed.
[0068] Finally, when generating images, according to the type labels (class_idx) of different defects input, defect images of corresponding categories (cracks (0), scratches (1), wear (2), burns (3)) are generated to achieve the balance of the number of various defects. The comparison of the number of defect images generated is shown in Table 2.
[0069] Table 2 Comparison of the Number of Defect Labels:
[0070]
[0071] Since the average detection accuracy before burn defect data augmentation was 0.843 (YOLOv7), which was relatively good compared to other types of defects, and the AP value increased significantly after a small amount of augmentation, only a small amount of data augmentation was performed on this type of defect. Considering the balance issue of the number of labels with other defect types, its quantity was increased to 698. Finally, through the data augmentation method proposed in this paper, the number of labels for various types of defects reached a balanced ratio of 1:1:1:0.7, which helped the detection model learn the characteristics of various defects and improve the generalization ability of the model. Figure 6 Examples of images of defects on the inner wall of the gun barrel in the enhanced dataset.
[0072] The YOLO network is commonly used for product defect detection in the industrial field. This application verifies the effectiveness of the proposed data augmentation method based on the YOLO model. The number of training rounds is set to 300, the division ratio of the training set, validation set, and test set is 8:1:1, and the evaluation metrics are P, R, and mAP.
[0073] First, use the data augmentation method proposed in this application to expand a small amount of the dataset of defects on the inner wall of the gun barrel (1982 images), and compare it with the non-data-augmented dataset on the YOLOv7 model to verify the effectiveness of data augmentation. The comparison is shown in Table 3.
[0074] Table 3 Comparison table of a small amount of data augmentation:
[0075]
[0076] It can be seen from Table 3 that after a small amount of data augmentation on the original dataset, the detection accuracy of defects on the inner wall of the gun barrel can be effectively improved (4.5%), indicating that as the number of images in the dataset increases, the detection accuracy of the model also increases.
[0077] Secondly, compare the data augmentation method of this application with other data augmentation methods in the YOLOv5 network to further verify the effectiveness of the data augmentation method of this paper. The results of different data augmentation methods are compared in Table 4 as follows:
[0078] Table 4(a) Comparison table of training results of data augmentation methods:
[0079]
[0080] Table 4(b) Comparison table of validation results of data augmentation methods:
[0081]
[0082] As shown in Table 4, by comparing different data augmentation methods, it can be seen that after using the method proposed in this application to augment the data set of the inner wall defects of the gun barrel, the average detection accuracy (mAP) of the model is 75.5%, which is higher than that without data augmentation (55.4%), adding noise (62.2%), rotation (64.4%), translation (62.4%), two composite augmentation methods (60.2%, 63.5%, 62.3%), and Mosaic (72.6%). This is because the data augmentation method proposed in this application not only expands the scale of the data set, but also uses the improved StyleGAN2-ADA to generate gun barrel inner wall defect images with the same distribution as the image features of the original gun barrel inner wall defect data set, effectively expanding the diversity of the original samples, and thus improving the generalization ability of the model.
[0083] Figure 7 Figure (a) is an example of the target detection result of a randomly selected image of the inner wall defect of the gun barrel. It can be seen that the method of adding noise can effectively improve the detection rate of scratches (b), which is comparable to that of this application, but it will misdetect crack defects; translation (c) will miss some defects of the wear type; rotation (d) has a certain improvement in the detection accuracy of wear and burn type defects; while after using the data augmentation method proposed in this paper (e), the misdetection rate is effectively reduced, and various types of defects can be correctly detected.
[0084] After using the data augmentation method in this paper, the improvement of the accuracy of various types of defects is shown in Table 5.
[0085] Table 5 Comparison table of the data augmentation method in this paper:
[0086]
[0087] As shown in Table 5, by comparing the P and AP of various types of defects, it can be seen that after using the method proposed in this paper to augment the data set of the inner wall defects of the gun barrel, the P and AP of various types of defects have both increased. Especially for crack and burn defects, the improvement is obvious. The P of cracks has increased by 28.7%, the AP has increased by 34.5%, the AP of burns has increased by 22.4%, and the P of wear has also increased significantly (18.4%); the overall mAP of the model has increased by 20.1%.
[0088] A data augmentation method for the inner wall defects of the gun barrel based on conditional augmentation and attention mechanism proposed in this application. Experiments have proved that the data augmentation method proposed in this application is superior to other data augmentation methods, can improve the quality of the generated images, and improve the detection accuracy of the detection model. After data augmentation by this method, the FID value is reduced by 12.6193 compared with the original network, and the detection precision rate reaches 75.5%, which is higher than the detection method for the inner wall defects of the gun barrel without data augmentation.
[0089] Using the data augmentation method proposed in this paper, the detection model can accurately detect the defects on the inner wall of the gun barrel. By detecting the shape and size of the defects, the severity of the gun damage can be judged, and relevant measures can be taken in time, which has positive significance for the use of the gun.
[0090] As described above, only the preferred specific embodiments of the present invention are provided, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for enhancing the image data of the inner wall defects of a gun barrel, characterized in that: The following steps are involved: Step 1: Obtain a steel surface defect dataset and preprocess the dataset using histogram equalization and Laplace operator sharpening; Step 2: Use the preprocessed image as the target image and the gun barrel inner wall defect-free image as the background image, generate a mask image according to the label information of the target image, perform Poisson fusion on the target image, the mask image and the background image, and generate a gun barrel inner wall defect image; Step 3: Classify the generated gun barrel inner wall defect images into four categories: cracks, scratches, burns, and wear, and use Labelme to annotate the images to form a complete gun barrel inner wall defect dataset; Step 4: Build the StyleGAN2-ADA network architecture, including the generator and the discriminator, and add a new attention mechanism module before the upsampling layer in the comprehensive network of the generator. The new attention mechanism module is composed of a self-attention mechanism module and a full-dimensional dynamic convolution module in parallel; Step 5: Use the steel surface defect dataset to initialize the network in the training weights of StyleGAN2-ADA, and then send the gun barrel inner wall defect dataset to the StyleGAN2-ADA network with set parameters for training; Step 6: After the training is completed, the optimal weight file is loaded into the network to generate a single type of gun barrel inner wall defect image agreed upon according to the condition information; The self-attention mechanism module consists of extracting the feature map x using W f , W g and W h The three matrices are transformed into three different feature spaces f, g and h to obtain feature maps f(x), g(x) and h(x); secondly, f(x) is transposed and dot-producted with g(x), and the dot-product result is softmax normalized to obtain the attention feature map β; then β is dot-producted with h(x) to obtain the self-attention feature map ο; finally, the self-attention feature map ο is added to the original convolution feature map x to obtain the final feature map y output; The full-dimensional dynamic convolution module includes adding an attention mechanism so that the convolution kernel can dynamically adjust its parameters according to different inputs or latent space vectors, and learn its attention value in parallel along the four dimensions of kernel space, input channel dimension, output channel dimension, and kernel dimension. The specific formula is: Among them, α wi ∈R represents the convolution kernel W i Different attention scalars assigned; α si ∈R k×k Represents the different attention scalars assigned to each convolution kernel in the kernel space; Represents the c of each convolution kernel in Different attention scalars for channel assignment; Represents the c of each convolution kernel out Different attention scalars for channel assignment; and They represent input features and output features respectively.
2. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 1, characterized in that: In step 4, the generator includes a mapping network and an integrated network, the mapping network includes 8 fully connected layers; the integrated network includes 7 resolution layers, and the resolution layers range from 4*4 modules to 256*256; the 4*4 module includes a convolution layer, a togg layer that converts the feature map into an RGB image, and two intermediate layers; the 8*8 and remaining resolution modules include an upsampling layer, a convolution layer and two intermediate layers; the new attention mechanism module is before the upsampling layer.
3. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 1, characterized in that: In step 4, the discriminator includes a fromrgb layer, 7 resolution modules from 256*256 to 4*4; each resolution module from 256*256 to 8*8 includes a skip layer for realizing a residual structure, skipping feature maps at different scales, and the residual structure includes a downsampling layer and a convolution layer; wherein, after the last downsampling layer, a multi-normalization layer and a fully connected layer are connected; and the last output layer is used to output the image.
4. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 1, characterized in that: In step 1, the histogram equalization increases the contrast by broadening the grayscale values of the important parts of the image and merging the rest. The specific formula is as follows: s = c log (1 + r); Among them, c is the adjustment constant, r is each pixel of the image before transformation, and s is the output pixel after transformation.
5. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 1, characterized in that: In step 1, the Laplacian operator sharpening further increases or decreases the grayscale of the central pixel by judging the grayscale of the central pixel and the average grayscale of other pixels in the neighborhood. The specific formula is as follows: in, It represents the sum of the second-order partial derivatives of the gray value of the central pixel f, that is, the change characteristics of the central gray value and the gray value of the pixels in the (x, y) neighborhood.
6. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 5, characterized in that: In step 2, the Poisson fusion includes: The mask image, original image, and background image are input into the network, the fusion position in the background image is determined, and the fusion is performed using the following formula: Among them, ω is the fusion target, V is its gradient field, S is the background image, Ω is the fusion area, is the fusion boundary. After fusion, the pixels inside Ω are f and the pixels outside are f * .
7. The method for enhancing the image data of the inner wall defect of a gun barrel according to claim 1, characterized in that: In step 5, the training process includes setting the learning rate, the number of batch samples, and the number of thousands of images for iteration, and initializing the network using the training weights of the face dataset in StyleGAN2-ADA.
Citation Information
Patent Citations
Data enhancement method based on big law algorithm and channel attention mechanism
CN116912144A