Cold-rolled copper strip fog degraded image synthesis and restoration method
By constructing a cold-rolled copper strip mist degradation image data set and an intelligent defog network, the image degradation problem caused by mist in cold-rolled copper strip production is solved, and efficient image restoration and detection accuracy are achieved, which is suitable for automatic visual inspection in cold-rolled production.
Patent Information
- Application Number
- CN202510456176.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-12
AI Technical Summary
During the cold-rolled copper strip production process, the image degradation problem caused by mist seriously affects the effect of the automatic visual detection system, especially in strip plate-shaped visual detection and surface defect detection, and the prior art has failed to effectively solve such problems.
By collecting the original production image data of cold-rolled copper strips, a fog degradation image data set is constructed, the dark channel prior values are used to perform k-means clustering and guide filters to refine the transmittance map, synthesise the fog degradation image, and build a cold-rolled copper strip intelligent defog network, train the intelligent defog model DH_M, and embedded in the automatic visual detection system.
It effectively alleviates the problem of image degradation caused by fog, improves the performance of the automatic visual detection system, and the color and contrast of the restored image are natural, with clear details, and improves detection accuracy.
Smart Images

Figure CN120471803A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent monitoring of metallurgical rolling processes, and in particular to a method for synthesizing and restoring fog-degraded images of cold-rolled copper strips. Background Art
[0002] With the rapid development of artificial intelligence theory and machine vision technology, automated visual inspection systems have become an indispensable tool in many manufacturing industries, with applications encompassing a wide range of inspection tasks. Research has shown that the application of automated visual inspection systems in rolling production can effectively solve practical problems. Although machine vision-based automated visual inspection technology, characterized by its simple setup and flexible methods, has shown great potential in the metal strip rolling industry, image degradation caused by complex environmental factors at production sites (such as dust, fog, and uneven lighting) continues to severely restrict its industrial application. Fog, a physical phenomenon caused by the accumulation of rolling oil molecules and other aerosol particles in the air, is a key factor in image degradation during the cold rolling process. This phenomenon reduces air transparency, leading to visual blur. Image quality captured in foggy environments is often severely degraded, manifesting primarily in reduced contrast, loss of detailed textures, and fading. The presence of fog impairs the effectiveness of automated visual inspection systems, particularly for tasks requiring high-definition images, such as strip shape inspection and surface defect detection. Therefore, studying the fog-degraded image restoration method is crucial to improving the practical value of the automatic visual inspection system in the field of strip rolling.
[0003] Currently, some scholars have conducted research on image dehazing. For example, the paper "A Semi-supervised Network-Based Dehazing Algorithm for Dust and Fog Images of Coal Mining Faces" (Coal Science and Technology, 2025, 1-9) collected a large number of images of underground coal mine working faces. Based on the characteristics of dust and fog during working face operations, the paper used an atmospheric scattering model and Perlin noise to synthesize non-uniform dust and fog images onto clear images. Secondly, a dehazing algorithm based on a semi-supervised learning network was proposed. This semi-supervised learning network consists of a generator and a discriminator. The generator adopts an encoder-decoder structure, in which the encoder is mainly composed of a residual network. A spatial attention mechanism is incorporated into the residual block to enable the network to better handle non-uniform dust and fog. The paper "Deep Learning Data Augmentation Method for Image Dehazing" (Electronic Optics and Control, 2024, Vol. 31, No. 3: 81-85) addresses the lack of corresponding real fog matching data pairs in deep learning-based image dehazing tasks and proposes a fog synthesis method based on a cyclic generative adversarial network (CycleGAN). The network is trained on mismatched data pairs to learn the features of foggy images. Clear images are then assigned realistic fog features and paired with the images themselves. Finally, this dataset is used for defogging training. The paper "A Lightweight License Plate Detection and Recognition Algorithm in Foggy Weather Based on Image Adaptive Enhancement" (Journal of Wuhan University of Science and Technology, 2024, Vol. 47, No. 2: 144-153) addresses the challenge of license plate recognition due to image degradation in foggy weather by proposing a lightweight license plate detection and recognition algorithm using image adaptive enhancement. Based on the object detection network YOLOv5s and the license plate recognition network LPRNet, an improved image adaptive enhancement module is designed and cascaded before YOLOv5s. A hybrid attention (SA) mechanism is introduced to improve LPRNet. The image adaptive enhancement module consists of a parameterized image defogging and texture enhancement module and an adaptive parameter prediction module. The adaptive parameter prediction module is a lightweight convolutional neural network trained jointly with YOLOv5s to automatically provide appropriate defogging and texture enhancement parameters for images with varying degrees of fog, resulting in more accurate license plate detection results. Using the real-world labels of license plate locations and actual detection results, a hybrid attention mechanism and transfer learning strategy were employed to develop the final SA-LPRNet model, alleviating the recognition model's sensitivity to detection results and achieving higher license plate recognition accuracy. The paper "Medium-voltage Switch Image Detection Based on Guided Filtering in Foggy Environments" (Science and Technology Innovation and Application, 2025, Vol. 15, No. 4: 51-55) addresses the issues of poor image quality and low recognition rate of medium-voltage switch logos acquired under complex conditions. An algorithm for intelligent detection and recognition of medium-voltage switch images in foggy environments was proposed. Images of medium-voltage switches were captured in foggy environments and dehazed using a color attenuation prior method with fast guided filtering to optimize transmittance.
[0004] Up to now, no scholars have conducted research on the problem of fog-degraded image restoration in the production process of cold-rolled copper strip. Summary of the Invention
[0005] Based on the above-mentioned technical problem of restoring fog-degraded images in the production process of cold-rolled copper strip, a method for synthesizing and restoring fog-degraded images of cold-rolled copper strip is provided. The present invention mainly utilizes a method for synthesizing and restoring fog-degraded images of cold-rolled copper strip. Based on actual production image data, this method innovatively proposes a new method for synthesizing fog-degraded images of cold-rolled copper strip for the cold-rolling production process. By extracting dark channel prior values for k-means clustering, the estimation error of scene depth is reduced. Then, the transmittance map is refined using a guided filter, which reduces the difference between the generated image and the real image, and a dataset of fog-degraded images of cold-rolled copper strip is constructed. Finally, an intelligent defogging network for cold-rolled copper strip is built, and it is trained based on the constructed dataset to obtain an intelligent defogging model DH_M for cold-rolled copper strip. The model has a good defogging effect and is of practical significance for improving the performance of automatic visual inspection systems in the rolling field.
[0006] The technical means adopted in the present invention are as follows:
[0007] A method for synthesizing and restoring fog-degraded images of cold-rolled copper strips comprises the following steps:
[0008] Step 1: Collect the original production image dataset of cold-rolled copper strip;
[0009] Step 2: Construct a dataset of fog-degraded images of cold-rolled copper strips;
[0010] Step 3: Build a cold-rolled copper strip intelligent defogging network, use the data set to train and evaluate the network to obtain the cold-rolled copper strip intelligent defogging model DH_M;
[0011] Step 4: Embed the intelligent defogging model DH_M for cold-rolled copper strip into the automatic visual inspection system in cold rolling production.
[0012] Furthermore, the step 1 includes the following steps:
[0013] Step 11: Set up an industrial camera at the cold rolling production site to capture copper strip production video, and use a computer to intercept and process the images. Set the number of intercepted frames to f, the image pixel size to H×W, and intercept n images in total as the raw data set, recorded as Raw_dataset;
[0014] Step 12: The original dataset Raw_dataset is classified according to whether there is fog in the image through manual calibration method, and n1 degraded images with fog and n2 clear images without fog are divided, which are recorded as the degraded image dataset with fog RawHazy_dataset and the clear image dataset without fog RawClear_dataset respectively.
[0015] Furthermore, the step 2 includes the following steps:
[0016] Step 21: Synthesize the fog-degraded image;
[0017] Step 22: Synthesize haze-degraded images according to the above steps. Synthesize haze-degraded images from all images in the haze-free clear image dataset RawClear_dataset and pair them with the original images one by one to construct a haze-degraded image paired dataset, denoted as SynHazy_dataset.
[0018] Step 23: Divide the hazy degraded image dataset RawHazy_dataset and the paired dataset SynHazy_dataset into the training set Trainset and the test set Testset in a ratio of 9:1.
[0019] Furthermore, the step 21 includes the following steps:
[0020] Step 211: Select an image I from the fog-free clear image dataset RawClear_dataset rawclear ;
[0021] Step 212: Due to the limitations of the cold rolling site installation environment, the monocular depth estimation pre-trained model MiDaS_master is used to estimate the image I rawclear Scene depth map I depth ;
[0022] Step 213: Set the ambient light A and the atmospheric scattering coefficient β, according to the formula Calculate the initial transmittance map T org ;
[0023] Step 214: Image I rawclear Convert to RGB color space and extract its dark channel image I DC ;
[0024] Step 215: Dark channel image I DC Convert to a one-dimensional vector v, cluster v using the k-means clustering method, and cluster it into k categories;
[0025] Step 216: Map the clustering results to the initial transmittance map T org At the corresponding pixel position in the initial transmittance map T org Calculate the average transmittance value of each category as the cluster transmittance map, denoted as T kmeans ;
[0026] Step 217: Calculate the original image I rawclear Grayscale image I gray Used to provide texture and edge information, I gray As a guide map, the cluster transmittance map T is clustered by the guided filter. kmeans Refine it and get the refined transmittance map, which is recorded as T refine ;
[0027] Step 218: According to formula I synhazy (x)=I rawclear (x)T refine (x)+A(1-
[0028] T refine (x)), from the clear image I rawclear Synthetic fog-degraded image I synhazy .
[0029] Furthermore, the step 3 includes the following steps:
[0030] Step 31: Build an intelligent defogging network for cold-rolled copper strips;
[0031] Step 32: training the intelligent defogging network constructed in step 31;
[0032] Step 33: Use Testset to evaluate the performance of the cold-rolled copper strip intelligent defogging model DH_M.
[0033] Furthermore, the step 31 includes the following steps:
[0034] Step 311: Randomly select a fog-degraded image I from the training set Trainset hazy and a clear image I clear , set the ambient light A, for image I hazy Use DCP method to generate preliminary dehazed image I DCP and transmittance graph T DCP ;
[0035] Step 312: Build a refinement network Net1; the refinement network Net1 includes: a downsampling path, an upsampling path, and a connection structure; the downsampling path is used to reduce feature resolution while increasing the number of feature channels; the upsampling path is used to gradually restore feature resolution; the connection structure is used to fuse feature information of different scales by transferring shallow features in the contraction path to the corresponding layer of the expansion path;
[0036] Step 313: Build a refinement network Net2; the refinement network Net2 includes: a ResNet with 9 residual blocks; compress from high resolution to low resolution through two downsampling steps, extract high-level semantic features in the low-resolution space using the 9 residual blocks, then restore to the original resolution through two upsampling steps, and finally output the same number of channels as the input through a convolutional layer;
[0037] Step 314: Build a discriminator D; the discriminator D includes: a convolutional neural network with 5 convolution blocks; the discriminator D is used to determine the authenticity of the result generated by the refined network Net2;
[0038] Step 315: Construct the intelligent defogging network loss function. The loss function consists of three parts: generating adversarial loss L GAN , reconstruction loss L rec and consistency loss L idt ;
[0039] Step 316: Weighted fusion strategy of defogging results.
[0040] Furthermore, the step 315 includes the following steps:
[0041] Step 3151: Generate adversarial loss L GAN (Net2,D):
[0042]
[0043] in, Indicates that all I clear A collection of Indicates that all T DCP A collection of
[0044] Step 3152: Reconstruction loss L rec :
[0045] L rec =||I hazy -I rec2 ||;
[0046] Among them, ||·|| represents the L1 norm; L rec Represents the difference between the real foggy image and the reconstructed foggy image generated by the model
[0047] Step 3153: Obtain consistency loss L idt :
[0048] L idt =‖I clear -Net2(I DCP )‖;
[0049] Among them, ||·|| represents the L1 norm, L idt Represents a true clear image I clear The difference between the image output by the Net2 network.
[0050] Furthermore, step 316 includes the following steps:
[0051] Step 3161: Generate a transmittance map T based on the model Net1 ref Using the formula Generate the first dehazing result I rec1 , directly generate the second defogging result I through model Net2 ref ;
[0052] Step 3162: To obtain better dehazing results for edge and texture details, according to the formula Calculate I separately rec1 and I ref The contrast index CI (I rec1 ) and CI(I ref ), where σ(J) is the image standard deviation and μ(J) is the image mean;
[0053] Step 3163: Define fusion weight coefficient And calculate the final defogging result, recorded as I fused =w·I rec1 +(1-w)·I ref .
[0054] Furthermore, the step 32 includes the following steps:
[0055] Step 321: Set the training parameters of the model, including the initial learning rate lr, the learning rate decay strategy, the number of iterations epoch, and the training optimizer;
[0056] Step 322: After each iteration of training is completed, save the weight parameters and the corresponding loss value;
[0057] Step 323: After completing all epoch training, select the weight file with the smallest loss value as the cold-rolled copper strip defogging model DH_M.
[0058] Compared with the prior art, the present invention has the following advantages:
[0059] 1. The present invention provides a method for synthesizing fog-degraded images of cold-rolled copper strips. By extracting dark channel prior values for k-means clustering, the estimation error of scene depth is reduced. Then, a guided filter is used to refine the transmittance map, reducing the difference between the generated image and the real image. Finally, a fog-degraded image dataset of cold-rolled copper strips with paired data is constructed based on the atmospheric scattering model, laying the foundation for the subsequent training of an intelligent defogging model for cold-rolled copper strips.
[0060] 2. We built an intelligent defogging network for cold-rolled copper strip and trained it on a constructed fog degradation dataset, resulting in the intelligent defogging model DH_M for cold-rolled copper strip. This model demonstrated excellent defogging performance, restoring images with natural color and contrast, and clear details.
[0061] In summary, the technical solution of this invention enables the construction of a dataset of fog-degraded cold-rolled copper strip images with paired data, effectively addressing the lack of real-world image pairs. Secondly, addressing the research gap in restoring fog-degraded images in cold rolling production, the intelligent defogging model DH_M established in this invention can effectively alleviate the image degradation problem caused by fog in the automatic visual inspection system of cold rolling production, which has practical significance for improving the performance of automatic visual inspection systems in the rolling industry.
[0062] Based on the above reasons, the present invention can be widely promoted in the field of automatic visual inspection in cold rolling production. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0064] Figure 1 This is a flow chart of the method for synthesizing fog-degraded images of cold-rolled copper strips according to the present invention.
[0065] Figure 2 This is the overall structure diagram of the cold-rolled copper strip intelligent defogging network of the present invention.
[0066] Figure 3 This is the network structure diagram of Net1 of the present invention.
[0067] Figure 4 This is the network structure diagram of Net2 of the present invention.
[0068] Figure 5This is the defogging result of synthesizing fog images in the Testset by the cold-rolled copper strip defogging model DH_M of the present invention.
[0069] Figure 6 This is the defogging result of the cold-rolled copper strip defogging model DH_M of the present invention on the real fog image in the Testset.
[0070] Figure 7 It is a schematic diagram of the overall process of the present invention. DETAILED DESCRIPTION
[0071] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0072] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0073] like Figure 1-7 As shown, the present invention provides a method for synthesizing and restoring fog-degraded images of cold-rolled copper strips, comprising the following steps:
[0074] Step 1: Collect the original production image dataset of cold-rolled copper strip; Step 1 includes the following steps:
[0075] Step 11: Set up an industrial camera at the cold rolling production site to capture copper strip production video, and use a computer to intercept and process the images. Set the number of intercepted frames to f, the image pixel size to H×W, and intercept n images in total as the raw data set, recorded as Raw_dataset;
[0076] Step 12: The original dataset Raw_dataset is classified according to whether there is fog in the image through manual calibration method, and n1 degraded images with fog and n2 clear images without fog are divided, which are recorded as the degraded image dataset with fog RawHazy_dataset and the clear image dataset without fog RawClear_dataset respectively.
[0077] Step 2: Construct a dataset of fog-degraded images of cold-rolled copper strips. Step 2 includes the following steps:
[0078] Step 21: Synthesize the fog-degraded image. Step 21 includes the following steps:
[0079] Step 211: Select an image I from the fog-free clear image dataset RawClear_dataset rawclear ;
[0080] Step 212: Due to the limitations of the cold rolling site installation environment, the monocular depth estimation pre-trained model MiDaS_master is used to estimate the image I rawclear Scene depth map I depth ;
[0081] Step 213: Set the ambient light A and the atmospheric scattering coefficient β, according to the formula Calculate the initial transmittance map T org ;
[0082] Step 214: Image I rawclear Convert to RGB color space and extract its dark channel image I DC ;
[0083] Step 215: To distinguish the key target and the background in the transmittance image significantly and ensure that objects of the same category have consistent transmittance, the dark channel image I DC Convert to a one-dimensional vector v, cluster v using the k-means clustering method, and cluster it into k categories;
[0084] Step 216: Map the clustering results to the initial transmittance map T org At the corresponding pixel position in the initial transmittance map T org Calculate the average transmittance value of each category as the cluster transmittance map, denoted as T kmeans ;
[0085] Step 217: In order to smooth the noise in the transmittance image and preserve the edge features, the original image I is calculated. rawclear Grayscale image I gray Used to provide texture and edge information, I grayAs a guide map, the cluster transmittance map T is clustered by the guided filter. kmeans Refine it and get the refined transmittance map, which is recorded as T refine ;
[0086] Step 218: According to formula I synhazy (x)=I rawclear (x)T refine (x)+A(1-
[0087] T refine (x)), from the clear image I rawclear Synthetic fog-degraded image I synhazy .
[0088] Step 22: Synthesize fog-degraded images according to the steps. Synthesize corresponding fog-degraded images from all images in the fog-free clear image dataset RawClear_dataset and pair them with the original images one by one to construct a fog-degraded image paired dataset, denoted as SynHazy_dataset.
[0089] Step 23: Divide the hazy degraded image dataset RawHazy_dataset and the paired dataset SynHazy_dataset into the training set Trainset and the test set Testset in a ratio of 9:1.
[0090] Step 3: Build a cold-rolled copper strip intelligent defogging network, use the data set to train and evaluate the network to obtain the cold-rolled copper strip intelligent defogging model DH_M; Step 3 includes the following steps:
[0091] Step 31: Building a cold-rolled copper strip intelligent defogging network; Step 31 includes the following steps:
[0092] Step 311: Randomly select a fog-degraded image I from the training set Trainset hazy and a clear image I clear , set the ambient light A, for image I hazy Use DCP method to generate preliminary dehazed image I DCP and transmittance graph T DCP ;
[0093] Step 312: Build a refinement network Net1. The refinement network Net1 includes a downsampling path, an upsampling path, and a connection structure. The downsampling path is used to reduce feature resolution while increasing the number of feature channels. The upsampling path is used to gradually restore feature resolution. The connection structure is used to fuse feature information of different scales by transferring shallow features in the contraction path to the corresponding layer of the expansion path.
[0094] Step 313: Build a refinement network Net2. The refinement network Net2 includes a ResNet with 9 residual blocks. The high-resolution image is compressed to a low-resolution image through two downsampling steps. In the low-resolution space, the 9 residual blocks are used to extract high-level semantic features. The image is then restored to the original resolution through two upsampling steps. Finally, the convolutional layer outputs the same number of channels as the input.
[0095] Step 314: Build a discriminator D. Discriminator D includes a convolutional neural network with five convolutional blocks. Discriminator D is used to determine the authenticity of the results generated by the refined network Net2.
[0096] Step 315: Construct the intelligent defogging network loss function. The loss function consists of three parts: generating adversarial loss L GAN , reconstruction loss L rec and consistency loss L idt ; Step 315 comprises the following steps:
[0097] Step 3151: Generate adversarial loss L GAN (Net2,D):
[0098]
[0099] in, Indicates that all I clear A collection of Indicates that all T DCP The discriminator D distinguishes real images from generated images by maximizing the first term in the formula; the refinement network Net2 deceives the discriminator by maximizing the second term in the formula, making it unable to correctly distinguish between generated images and real images. During the training process, the generator and the discriminator compete with each other, gradually improving the realism and visual quality of the generated images.
[0100] Step 3152: Reconstruction loss L rec :
[0101] L rec =‖I hazy -I rec2 ||;
[0102] Among them, ||·|| represents the L1 norm; L rec Represents the difference between the real foggy image and the reconstructed foggy image generated by the model
[0103] Step 3153: Obtain consistency loss L idt :
[0104] L idt =‖I clear -Net2(I DCP )‖;
[0105] Among them, ||·|| represents the L1 norm, L idt Represents a true clear image I clear The difference between the image output by the Net2 network.
[0106] Step 316: Weighted fusion strategy of defogging results. Step 316 includes the following steps:
[0107] Step 3161: Generate a transmittance map T based on the model Net1 ref Using the formula Generate the first dehazing result I rec1 , directly generate the second defogging result I through model Net2 ref ;
[0108] Step 3162: To obtain better dehazing results for edge and texture details, according to the formula Calculate I separately rec1 and I ref The contrast index CI (I rec1 ) and CI(I ref ), where σ(J) is the image standard deviation and μ(J) is the image mean;
[0109] Step 3163: Define fusion weight coefficient And calculate the final defogging result, recorded as I fused =w·I rec1 +(1-w)·I ref .
[0110] Step 32: Train the intelligent defogging network constructed in step 31; step 32 includes the following steps:
[0111] Step 321: Set the training parameters of the model, including the initial learning rate lr, the learning rate decay strategy, the number of iterations epoch, and the training optimizer;
[0112] Step 322: After each iteration of training is completed, save the weight parameters and the corresponding loss value;
[0113] Step 323: After completing all epoch training, select the weight file with the smallest loss value as the cold-rolled copper strip defogging model DH_M.
[0114] Step 33: Use Testset to evaluate the performance of the cold-rolled copper strip intelligent defogging model DH_M.
[0115] Step 4: Embed the cold-rolled copper strip defogging model DH_M into the automatic visual inspection system in cold rolling production.
[0116] Example:
[0117] In one embodiment of the present invention, a method for synthesizing and restoring a fog-degraded image of a cold-rolled copper strip is provided, characterized in that the method comprises the following steps:
[0118] Step 1: Collecting the original production image dataset of cold-rolled copper strip. The specific steps include:
[0119] Step 11: Install an industrial camera at the cold rolling production site to collect copper strip cold rolling production videos. Use a computer to intercept and process the images. Set the number of intercepted frames to f = 30 and the image pixel size to H × W = 1520 × 760. A total of n = 1500 images are intercepted as the raw data set, recorded as Raw_dataset.
[0120] Step 12: Use manual calibration to classify the Raw_dataset based on whether there is fog in the image, and divide it into n1 = 100 degraded images with fog and n2 = 200 clear images without fog, which are recorded as the dataset RawHazy_dataset and the dataset RawClear_dataset respectively;
[0121] Step 2: Construct a dataset of fog-degraded images of cold-rolled copper strip. The specific steps include:
[0122] Step 21: Cold rolled copper strip fog degradation image synthesis method, the specific process is as follows Figure 1 First, take an image from RawClear_dataset and record it as I rawclear Due to the limitations of the cold rolling site installation environment, the monocular depth estimation pre-training model MiDaS_master is used to estimate the image I rawclear The scene depth map is denoted as I depth To generate fog-degraded images with different concentrations, we set the ambient light A = [0.7, 0.85, 0.92] and the atmospheric scattering coefficient β = [0.1, 0.5, 0.8], respectively. Calculate the initial transmittance map, denoted as T org . Image I rawclear Convert to RGB color space and extract its dark channel image, denoted as I DC In order to significantly distinguish the key targets and background in the transmittance image and ensure that objects of the same category have consistent transmittance, the dark channel image I DC Convert to a one-dimensional vector v, cluster v using the k-means clustering method, and cluster it into k=3 categories (copper strip, plate roller, background). Map the clustering results to the initial transmittance map T org At the corresponding pixel position in the initial transmittance map T orgCalculate the average transmittance value of each category as the cluster transmittance map, denoted as T kmeans In order to smooth the noise in the transmittance image and keep the edge features, the original image I is calculated rawclear Grayscale image I gray Used to provide texture and edge information, I gray As a guide map, the cluster transmittance map T is clustered by the guided filter. kmeans Refine it and get the refined transmittance map, which is recorded as T refine Finally, according to formula I syn h azy (x)=
[0123] I rawclear (x)T refine (x)+A(1-T refine (x)), from the clear image I rawclear Synthetic fog-degraded image I synhazy ;
[0124] Step 22: According to step 21, all images in RawClear_dataset are synthesized into corresponding fog-degraded images, and paired with the original images one by one to construct a fog-degraded image paired dataset, recorded as SynHazy_dataset;
[0125] Step 23: Divide RawHazy_dataset and SynHazy_dataset into training set Trainset and test set Testset in a ratio of 9:1 respectively. The dataset distribution is shown in Table 1.
[0126] Table 1 Distribution of data sets after division
[0127]
[0128] Step 3: Build an intelligent defogging network for cold-rolled copper strips. Use the dataset to train and evaluate the network to obtain the intelligent defogging network for cold-rolled copper strips. The specific steps include:
[0129] Step 31: Build a cold-rolled copper strip intelligent defogging network. The overall structure is as follows: Figure 2 As shown, the specific steps include:
[0130] Step 311: Take a fog-degraded image I from Trainset hazy and a clear image I clear , set the ambient light A = 0.85, for image I hazy The dark channel prior method (DCP) is used to generate the preliminary dehazed image I DCP and transmittance graph T DCP ;
[0131] Step 312: Build a refined network Net1. Net1 uses a convolutional neural network with a U-shaped structure, including a downsampling path, an upsampling path, and a connection structure. The downsampling path consists of multiple layers of Conv2D convolution layers, LeakyReLU activation function layers, and InstanceNorm2d normalization layers, which reduce feature resolution while increasing the number of feature channels; the upsampling path consists of multiple layers of ConvTranspose2D deconvolution layers, ReLU activation function layers, and InstanceNorm2d normalization layers, which are used to gradually restore feature resolution; the connection structure is used to fuse feature information of different scales by transferring shallow features in the contraction path to the corresponding layer of the expansion path. The Net1 network structure is as follows: Figure 3 As shown;
[0132] Step 313: Build a refined network Net2. Net2 uses ResNet with 9 residual blocks. First, compress from high resolution to low resolution through two downsamplings. Each downsampling consists of a Conv2D convolution layer, a ReLU activation function layer, and an InstanceNorm2d normalization layer. In the low-resolution space, 9 residual blocks are used to extract high-level semantic features. Each residual block consists of two Conv2D layers and a residual connection structure. Then restore to the original resolution through two upsamplings. Each upsampling consists of a ConvTranspose2D deconvolution layer, a ReLU activation function layer, and an InstanceNorm2d normalization layer. Finally, the convolution layer outputs the same number of channels as the input. The Net2 network structure is as follows: Figure 4 As shown;
[0133] Step 314: Build a discriminator D. D is a convolutional neural network with 5 convolutional blocks. Each convolutional block consists of a Conv2D convolution layer, a LeakyReLU activation function layer, and an InstanceNorm2d normalization layer. It is used to determine the authenticity of the results generated by Net2.
[0134] Step 315: Construct the intelligent defogging network loss function. The loss function consists of three parts: generating adversarial loss L GAN , reconstruction loss L rec and consistency loss L idt , the specific steps include:
[0135] Step 3151: Generate adversarial loss formula as
[0136] It includes all I clear A collection of It includes all T DCPThe discriminator D distinguishes real images from generated images by maximizing the first term in the formula; the refinement network Net2 deceives the discriminator by maximizing the second term in the formula, making it unable to correctly distinguish between generated images and real images. During the training process, the generator and the discriminator compete with each other, gradually improving the realism and visual quality of the generated images.
[0137] Step 3152: Reconstruction loss L rec The formula is L rec =||I hazy -I rec2 ||, ||·|| is the L1 norm; L rec The difference between the real foggy image and the reconstructed foggy image generated by the model is calculated. The goal is to minimize the difference so that the image generated by the model is as close to the original foggy image as possible.
[0138] Step 3153: Consistency loss L idt The formula is L idt =‖I clear -Net2(I DCP )‖, ||·|| is the L1 norm, L idt Used to measure the true clear image I clear The difference between the image output by the Net2 network and the image output by the Net2 network can reduce the additional artifacts or unnecessary texture information introduced by the Net2 network in the fog-free image;
[0139] Step 316: Weighted fusion strategy of defogging results; transmittance map T generated by model Net1 ref Using the formula Generate the first dehazing result I rec1 , directly generate the second defogging result I through model Net2 ref ; To obtain better dehazing results for edge and texture details, according to the formula Calculate I separately rec1 and I ref The contrast index CI (I rec1 ) and CI(I ref ), where σ(J) is the image standard deviation and μ(J) is the image mean; define the fusion weight coefficient And calculate the final defogging result, recorded as I fused =w·I rec1 +(1-w)·I ref ;
[0140] Step 32: Cold-rolled copper strip defogging network training. First, set the model training parameters, set the initial learning rate lr = 0.0002, and use the linear decay strategy for the learning rate. The number of iterations epoch = 500, and the Adam training optimizer are selected. After each iteration of training, save the weight parameters and the corresponding loss value. After completing all epochs of training, the training loss at epoch = 459 is found to be the minimum value of 0.00102. Save the weight file at epoch = 459 as the cold-rolled copper strip intelligent defogging model, denoted as DH_M.
[0141] Step 33: Use the Testset to evaluate the performance of the cold-rolled copper strip intelligent dehazing model DH_M. Table 2 shows the objective evaluation results of the cold-rolled copper strip intelligent dehazing model DH_M on foggy images generated by the Testset. It can be seen that DH_M achieves good performance in terms of both restoration degree and average inference speed. Figure 5 and Figure 6 The dehazing results of the cold-rolled copper strip intelligent dehazing model DH_M on synthetic fog images and real fog images on the Testset are given respectively. It can be seen that DH_M performs excellently in processing various degrees of fog, and the color and texture details of the restored images are closest to the real labels.
[0142] Table 2 Objective evaluation results of the cold-rolled copper strip intelligent dehazing model DH_M on foggy images generated by the Testset
[0143]
[0144] Step 4: Embedding the intelligent defogging model DH_M for cold-rolled copper strip into the automatic visual inspection system in cold rolling production can effectively improve its detection accuracy.
[0145] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0146] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0147] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0148] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0149] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0150] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for synthesizing and restoring fog-degraded images of cold-rolled copper strips, characterized in that: The following steps are involved: Step 1: Collect the original production image dataset of cold-rolled copper strip; Step 2: Construct a dataset of fog-degraded images of cold-rolled copper strips; Step 3: Build a cold-rolled copper strip intelligent defogging network, use the data set to train and evaluate the network to obtain the cold-rolled copper strip intelligent defogging model DH_M; Step 4: Embed the intelligent defogging model DH_M for cold-rolled copper strip into the automatic visual inspection system in cold rolling production.
2. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 1, characterized in that: The step 1 comprises the following steps: Step 11: Set up an industrial camera at the cold rolling production site to capture copper strip production video, and use a computer to intercept and process the images. Set the number of intercepted frames to f, the image pixel size to H×W, and intercept n images in total as the raw data set, recorded as Raw_dataset; Step 12: The original dataset Raw_dataset is classified according to whether there is fog in the image through manual calibration method, and n1 degraded images with fog and n2 clear images without fog are divided, which are recorded as the degraded image dataset with fog RawHazy_dataset and the clear image dataset without fog RawClear_dataset respectively.
3. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 1, characterized in that: The step 2 comprises the following steps: Step 21: Synthesize the fog-degraded image; Step 22: Synthesize haze-degraded images according to the above steps. Synthesize haze-degraded images from all images in the haze-free clear image dataset RawClear_dataset and pair them with the original images one by one to construct a haze-degraded image paired dataset, denoted as SynHazy_dataset. Step 23: Divide the hazy degraded image dataset RawHazy_dataset and the paired dataset SynHazy_dataset into the training set Trainset and the test set Testset in a ratio of 9:
1.
4. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 3, characterized in that: The step 21 comprises the following steps: Step 211: Select an image I from the fog-free clear image dataset RawClear_dataset rawclear ; Step 212: Due to the limitations of the cold rolling site installation environment, the monocular depth estimation pre-trained model MiDaS_master is used to estimate the image I rawclear Scene depth map I depth ; Step 213: Set the ambient light A and the atmospheric scattering coefficient β, according to the formula Calculate the initial transmittance map T org ; Step 214: Image I rawclear Convert to RGB color space and extract its dark channel image I DC ; Step 215: Dark channel image I DC Convert to a one-dimensional vector v, cluster v using the k-means clustering method, and cluster it into k categories; Step 216: Map the clustering results to the initial transmittance map T org At the corresponding pixel position in the initial transmittance map T org Calculate the average transmittance value of each category as the cluster transmittance map, denoted as T kmeans ; Step 217: Calculate the original image I rawclear Grayscale image I gray Used to provide texture and edge information, I gray As a guide map, the cluster transmittance map T is clustered by the guided filter. kmeans Refine it and get the refined transmittance map, which is recorded as T refine ; Step 218: According to formula I synhazy (x)=I rawclear (x)T refine (x)+A(1-T refine (x)), from the clear image I rawclear Synthetic fog-degraded image I synhazy .
5. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 1, characterized in that: The step 3 comprises the following steps: Step 31: Build an intelligent defogging network for cold-rolled copper strips; Step 32: training the intelligent defogging network constructed in step 31; Step 33: Use Testset to evaluate the performance of the cold-rolled copper strip intelligent defogging model DH_M.
6. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 5, characterized in that: The step 31 comprises the following steps: Step 311: Randomly select a fog-degraded image I from the training set Trainset hazy and a clear image I clear , set the ambient light A, for image I hazy Use DCP method to generate preliminary dehazed image I DCP and transmittance graph T DCP ; Step 312: Build a refinement network Net1; the refinement network Net1 includes: a downsampling path, an upsampling path, and a connection structure; the downsampling path is used to reduce feature resolution while increasing the number of feature channels; the upsampling path is used to gradually restore feature resolution; the connection structure is used to fuse feature information of different scales by transferring shallow features in the contraction path to the corresponding layer of the expansion path; Step 313: Build a refinement network Net2; the refinement network Net2 includes: a ResNet with 9 residual blocks; compress from high resolution to low resolution through two downsampling steps, extract high-level semantic features in the low-resolution space using the 9 residual blocks, then restore to the original resolution through two upsampling steps, and finally output the same number of channels as the input through a convolutional layer; Step 314: Build a discriminator D; the discriminator D includes: a convolutional neural network with 5 convolution blocks; the discriminator D is used to determine the authenticity of the result generated by the refined network Net2; Step 315: Construct the intelligent defogging network loss function. The loss function consists of three parts: generating adversarial loss L GAN , reconstruction loss L rec and consistency loss L idt ; Step 316: Weighted fusion strategy of defogging results.
7. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 6, characterized in that: The step 315 includes the following steps: Step 3151: Generate adversarial loss L GAN (Net2,D): in, Indicates that all I clear A collection of Indicates that all T DCP A collection of Step 3152: Reconstruction loss L rec : L rec =||I hazy -I rec2 ||; Among them, ||·|| represents the L1 norm; L rec Represents the difference between the real foggy image and the reconstructed foggy image generated by the model Step 3153: Obtain consistency loss L idt : L idt =‖I clear -Net2(I DCP )‖; Among them, ||·|| represents the L1 norm, L idt Represents a true clear image I clear The difference between the image output by the Net2 network.
8. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 6, characterized in that: The step 316 includes the following steps: Step 3161: Generate a transmittance map T based on the model Net1 ref Using the formula Generate the first dehazing result I rec1 , directly generate the second defogging result I through model Net2 ref ; Step 3162: To obtain better dehazing results for edge and texture details, according to the formula Calculate I separately rec1 and I ref The contrast index CI (I rec1 ) and CI(I ref ), where σ(J) is the image standard deviation and μ(J) is the image mean; Step 3163: Define fusion weight coefficient And calculate the final defogging result, recorded as I fused =w·I rec1 +(1-w)·I ref .
9. The method for synthesizing and restoring fog-degraded images of cold-rolled copper strip according to claim 5, characterized in that: The step 32 includes the following steps: Step 321: Set the training parameters of the model, including the initial learning rate lr, the learning rate decay strategy, the number of iterations epoch, and the training optimizer; Step 322: After each iteration of training is completed, save the weight parameters and the corresponding loss value; Step 323: After completing all epoch training, select the weight file with the smallest loss value as the cold-rolled copper strip defogging model DH_M.
Citation Information
Cited By
Maritime image defogging method based on multi-level transmissivity guidance
CN121639487A