Image preprocessing method and system

Through improved histogram equalization and residual denoising and diffusion processing, the problem of low recognition accuracy of image recognition equipment in the wire making workshop is solved, the effect of effective denoising and retaining useful content is achieved, and the accuracy of image recognition is improved.

CN119579907APending Publication Date: 2025-03-07CHINA TOBACCO ZHEJIANG IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411525387.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In the wire making workshop, image recognition equipment has low recognition accuracy due to uneven brightness of light sources and noise pollution. The existing image preprocessing methods cannot effectively denoise and retain useful content.

Method used

Improved histogram equalization and residual denoising diffusion processing are adopted to improve image brightness and uniformity through segmented images, RGB-HSI color conversion, histogram equalization and contrast limitation, and noise is removed using the residual denoising diffusion model.

Benefits of technology

Effectively denoising, retaining useful content in the target image, reducing spot-like noise, and improving image recognition accuracy, providing a foundation for improving the recognition accuracy of image recognition equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579907A_ABST
    Figure CN119579907A_ABST
Patent Text Reader

Abstract

The invention discloses an image preprocessing method and system. The preprocessing method comprises the following steps: acquiring image data of a to-be-detected area of cigarette equipment; carrying out improved histogram equalization processing on the image data of the to-be-detected area to obtain an equalized image; and performing residual de-noising diffusion processing on the equalized image to obtain a pre-processed image of the to-be-detected area of the cigarette equipment. According to the method, the useful content in the target image can be reserved while the image is denoised, the parts, which can cause subsequent misrecognition, of spots are removed, and a basis is provided for improving the image recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image preprocessing, and in particular to an image preprocessing method and system. Background Art

[0002] In order to classify and trace debris, the silk-making workshop will add image recognition equipment after the leaf segment impurity remover to identify tobacco leaves and debris removed by the leaf segment impurity remover. However, the area of ​​the belt for transporting tobacco leaves is large, so in order to ensure sufficient brightness and heat dissipation of the light source, the light source for leaf segment debris identification in the silk-making workshop usually uses two linear light sources with superimposed brightness. However, since the surface of the belt is relatively smooth, when the strongest point of the linear light source is superimposed and irradiated on the belt, reflection will occur. Therefore, the point with the strongest brightness of the linear light source cannot be directly hit on the surface of the belt, but this will lead to insufficient brightness, resulting in an increase in noise in the captured image, affecting the recognition accuracy of the image recognition device; in addition, due to external reasons such as the imperfection of tobacco leaf transmission and shooting and recording methods, the captured image is often contaminated by various noises. The input of this noise will lead to unsatisfactory recognition results.

[0003] In order to increase the recognition accuracy of image recognition equipment, it is important to preprocess the image to reduce noise before the captured image is input into the image recognition device. Currently, existing image preprocessing methods include: gamma correction, sharpening filter, frequency domain filtering, white balance adjustment, color correction, etc., but these methods can only perform simple filtering and brightening on the image, which has large errors and cannot well retain the useful content in the image. Summary of the invention

[0004] The purpose of the present invention is to provide an image preprocessing method and system, which can retain the useful content in the target image while denoising the image, remove the spots that may cause subsequent misidentification, and provide a basis for improving the accuracy of image recognition.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides an image preprocessing method, comprising:

[0007] Acquire image data of the area to be inspected of the cigarette equipment;

[0008] Performing improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image;

[0009] The equalized image is subjected to residual denoising and diffusion processing to obtain a preprocessed image of the area to be detected of the cigarette equipment.

[0010] Optionally, performing improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image includes:

[0011] Segment the image data to obtain multiple sub-images;

[0012] Perform RGB-HSI color conversion on each sub-image, calculate the average pixel value of each sub-image pixel, and divide each sub-image into two parts according to the average pixel value, wherein the two parts include a part with a pixel value not lower than the average pixel value and a part with a pixel value lower than the average pixel value;

[0013] Performing histogram equalization processing on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value, respectively, to obtain the histogram equalization processing results of the two parts of each sub-image;

[0014] The histogram equalization processing results of the two parts of each sub-image are combined to obtain each enhanced sub-image;

[0015] Perform contrast limitation on each enhanced sub-image;

[0016] Bilinear interpolation is used to combine the contrast-limited sub-images, and HSI-RGB color conversion is performed to obtain a balanced image.

[0017] Optionally, the histogram equalization processing is performed on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value to obtain the histogram equalization processing results of the two parts of each sub-image, wherein the process of performing the histogram equalization processing on the part of each sub-image with a pixel value not lower than the average pixel value includes:

[0018] Obtain the total number of pixels in the portion above and below the average pixel value in the sub-image and the brightness components corresponding to the pixels;

[0019] Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted;

[0020] According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part with a value not less than the average pixel, an original histogram of the part with a value not less than the average pixel is obtained;

[0021] Based on the original histogram of the portion of pixel values ​​not less than the average pixel value, a cumulative histogram of the portion of pixel values ​​not less than the average pixel value is obtained;

[0022] The brightness component corresponding to each pixel is transformed by using the transformation function to obtain the transformed brightness component of each pixel;

[0023] Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel;

[0024] Based on the corrected brightness components of each pixel, a histogram equalization processing result not lower than the average pixel value is obtained.

[0025] Optionally, the histogram equalization processing is performed on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value to obtain the histogram equalization processing result of the two parts of each sub-image, wherein the process of performing the histogram equalization processing on the part of each sub-image with a pixel value lower than the average pixel value includes:

[0026] Obtain the total number of pixels in the portion of the sub-image that is lower than the average pixel value and the brightness component corresponding to the pixels;

[0027] Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted;

[0028] According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part below the average pixel value, an original histogram of the part below the average pixel value is obtained;

[0029] Based on the original histogram of the portion of pixel values ​​below the average, a cumulative histogram of the portion of pixel values ​​below the average is obtained;

[0030] The brightness component corresponding to each pixel is transformed by using the transformation function to obtain the transformed brightness component of each pixel;

[0031] Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel;

[0032] Based on the corrected brightness components of each pixel, a histogram equalization processing result of the portion below the average pixel value is obtained.

[0033] Optionally, the transformation function is expressed as follows:

[0034] j=INT[(lL)P m +0.5]

[0035] Among them, P m is the m-th order cumulative brightness component value; L represents the brightness component level; INT() represents rounding; j represents the transformed brightness component.

[0036] Optionally, the equalized image is subjected to residual denoising and diffusion processing to obtain a preprocessed image of the area to be detected of the cigarette device, including:

[0037] Acquire a target image of the area to be inspected of the cigarette equipment;

[0038] Using the trained residual denoising diffusion model, the target image is gradually forward diffused to obtain the diffused noise image IT ; The forward diffusion includes residual diffusion and noise diffusion, and the diffusion time step t ranges from T to 0;

[0039] Based on the residual network and noise network in the trained residual denoising diffusion model, the residual and noise at each time step are predicted;

[0040] According to the residual and noise at each time step, I T Remove the residual and noise and restore the image I at the previous time step T -1, until time step t=0, a preprocessed image of the area to be detected of the cigarette equipment is obtained.

[0041] Optionally, the step of acquiring the trained residual denoising diffusion model includes:

[0042] Acquire a training data set, wherein the training data set includes original images and corresponding degraded images of a to-be-detected area of ​​a cigarette device at different angles;

[0043] The training data set is input into the initial residual denoising diffusion model, and the optimal parameters of the model are obtained through training; wherein the initial residual denoising diffusion model includes a forward diffusion unit, a prediction unit and a generation unit, the prediction unit includes a residual network and a noise network, and the generation unit includes a Wiener deconvolution model and a DnCNN denoising model; wherein a periodic calling strategy is adopted during the training process of the generation unit: the calling order and frequency of the Wiener deconvolution model and the DnCNN denoising model are dynamically adjusted according to the noise characteristics of the image and the restoration effect evaluation index;

[0044] Based on the optimal parameters of the model, a trained residual denoising diffusion model is obtained.

[0045] Optionally, the target image is forward diffused step by step to obtain a diffused noise image I T ,include:

[0046] Get Image I t-1 The residual and Gaussian noise;

[0047] To image I t-1 Add image I t-1 The residual and Gaussian noise of generate the diffusion image I of the next time step t t , the formula is as follows:

[0048]

[0049] Among them, α t I res Represents image I t-1 The residual of Represents image It-1 Gaussian noise; α t and are the speed numbers of the control residual and Gaussian noise, I res and ∈ represent residual and random noise respectively;

[0050] Starting from t = 1, repeat the above single time step diffusion step until it diffuses to the maximum time step T, and obtain the noise image I t .

[0051] Optionally, the image I is acquired t-1 The steps of calculating the residuals include:

[0052] Using multi-scale analysis method, image I t-1 Decomposing into sub-bands of different scales, the multi-scale analysis method is a wavelet transform method or a Laplace pyramid method;

[0053] Image-based t-1 And sub-bands of different scales, calculate the residual at each scale, that is, image I t-1 and the differences between sub-bands of different scales;

[0054] The residuals at each scale are enhanced using a nonlinear function, and the enhanced residuals are denoised to obtain the denoised residuals at each scale;

[0055] The denoised residuals at each scale are spliced ​​to obtain image I t-1 The residual.

[0056] In a second aspect, the present invention provides an image preprocessing system, comprising:

[0057] A data acquisition module, used to acquire image data of the area to be detected of the cigarette equipment;

[0058] An equalization processing module is used to perform improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image;

[0059] The residual denoising diffusion module is used to perform residual denoising diffusion processing on the equalized image to obtain a pre-processed image of the area to be detected of the cigarette equipment.

[0060] Compared with the prior art, the present invention has the following beneficial effects:

[0061] The present invention provides an image preprocessing method and system, which improves image brightness and uniformity by means of histogram equalization, removes noise by residual denoising diffusion processing, retains useful content in the target image, removes spots that may cause subsequent misidentification, and provides a basis for improving image recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 FIG. 1 is a flow chart of an image preprocessing method according to an embodiment of the present invention;

[0063] Figure 2 The figure is a schematic diagram of image segmentation in one embodiment of the present invention;

[0064] Figure 3 The figure is a schematic diagram of image data captured in one embodiment of the present invention;

[0065] Figure 4 FIG. 1 is a schematic diagram of image data processed by the image preprocessing method of the present invention in one embodiment of the present invention; DETAILED DESCRIPTION

[0066] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0067] Example 1

[0068] refer to Figure 1 The present invention provides an image preprocessing method, comprising the following steps:

[0069] S01: Acquire image data of the area to be inspected of the cigarette equipment;

[0070] S02: performing improved histogram equalization processing on the image data of the area to be detected to obtain an image processed by equalization;

[0071] SO3: Perform residual denoising and diffusion processing on the equalized image to obtain a preprocessed image of the area to be detected in the cigarette equipment.

[0072] Specifically, in this embodiment, a camera installed on the production line is used to take full coverage photos of the area to be inspected of the cigarette equipment to obtain image data of the area to be inspected of the cigarette equipment.

[0073] The present invention provides an image preprocessing method, which improves image brightness and uniformity by means of histogram equalization, removes noise by residual denoising diffusion processing, retains useful content in the target image, removes spots that may cause subsequent misidentification, and provides a basis for improving image recognition accuracy.

[0074] In this embodiment, in step S02, the image data of the to-be-detected area is subjected to improved histogram equalization processing to obtain an image subjected to equalization processing, which specifically includes:

[0075] S021: Segment the image data to obtain multiple sub-images; Figure 2As shown, 3×3 image segmentation is performed to obtain 9 sub-images;

[0076] S022: performing RGB-HSI color conversion on each sub-image, and calculating the average pixel value of each sub-image pixel, and dividing each sub-image into two parts according to the average pixel value, wherein the two parts include a part with a pixel value not lower than the average pixel value and a part with a pixel value lower than the average pixel value;

[0077] Specifically, for the RGB-HSI color conversion of the sub-image, the sub-image is changed from RGB coordinates to HSI coordinates, as shown below:

[0078]

[0079]

[0080] Among them, R, G, B represent the red, green and blue three-channel components in the RGB coordinates respectively, H represents the chroma component, S represents the saturation component, and I represents the brightness component.

[0081] S023: performing histogram equalization processing on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value, respectively, to obtain a histogram equalization processing result of the two parts of each sub-image;

[0082] Specifically, the histogram equalization process is performed on the part of each sub-image that is not less than the average pixel value, which specifically includes:

[0083] Obtain the total number of pixels in the portion above and below the average pixel value in the sub-image and the brightness components corresponding to the pixels;

[0084] Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted;

[0085] According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part not lower than the average pixel value, the original histogram of the part not lower than the average pixel value is obtained. The formula is as follows:

[0086]

[0087] Wherein, n is the total number of pixels in the portion not less than the average pixel value; i represents the brightness component level, i=0, 1, 2, ..., L-1, L; L represents the number of brightness component levels, and P(i) represents the brightness component of the i-th level;

[0088] Based on the original histogram of the part with pixel values ​​not lower than the average, the cumulative histogram of the part with pixel values ​​not lower than the average is obtained. The formula is as follows:

[0089]

[0090] Among them, Pm is the m-th order cumulative brightness component value, k is a positive integer, m=0, 1, 2, ..., L-1, L.

[0091] The brightness component corresponding to each pixel is transformed using the transformation function to obtain the transformed brightness component of each pixel. The formula is as follows:

[0092] j=INT[(lL)Pm+0.5]

[0093] Among them, INT() is rounding, and j represents the brightness component after transformation.

[0094] Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel;

[0095] Based on the corrected brightness components of each pixel, a histogram equalization processing result not lower than the average pixel value is obtained.

[0096] Specifically, the histogram equalization process is performed on the portion of each sub-image with a pixel value lower than the average pixel value, which specifically includes:

[0097] Obtain the total number of pixels in the portion of the sub-image that is lower than the average pixel value and the brightness component corresponding to the pixels;

[0098] Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted;

[0099] According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part below the average pixel value, the original histogram of the part below the average pixel value is obtained; the formula refers to the above-mentioned process of performing histogram equalization on the part of each sub-image that is not below the average pixel value;

[0100] Based on the original histogram of the portion of pixel values ​​below the average, a cumulative histogram of the portion of pixel values ​​below the average is obtained;

[0101] The brightness component corresponding to each pixel is transformed by using the transformation function to obtain the transformed brightness component of each pixel;

[0102] Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel;

[0103] Based on the corrected brightness components of each pixel, a histogram equalization processing result of the portion below the average pixel value is obtained.

[0104] S024: merging the histogram equalization processing results of the two parts of each sub-image to obtain enhanced sub-images;

[0105] S025: Contrast limitation is performed on each enhanced sub-image to ensure that the brightness value of each sub-image is within a specific range to avoid over-exposure or overly dark areas. In this embodiment, the pixel value can be simply limited to the average value of the low-brightness and high-brightness pixel values ​​of the previously processed image, and the value outside the range is directly assigned to the limit value. This method is a conventional technical method and will not be described in detail here.

[0106] S025: combining the contrast-limited sub-images by bilinear interpolation and performing HSI-RGB color conversion to obtain a balanced image;

[0107] Specifically, the HSI-RGB color conversion formula is as follows:

[0108] 0≤H<120:

[0109] B=I(1-S)

[0110]

[0111] G=3I-(R+B)

[0112] When 120≤H<240:

[0113] R=I(1-S)

[0114]

[0115] B=3I-(R+G)

[0116] When 240≤H<360:

[0117] G=I(1-S)

[0118]

[0119] R=3I-(G+B)

[0120] Among them, R, G, B represent the red, green and blue three-channel components in the RGB coordinates respectively, H represents the chroma component, S represents the saturation component, and I represents the brightness component.

[0121] In this embodiment, in step S03, the equalized image is subjected to residual denoising diffusion processing to obtain a preprocessed image of the area to be detected of the cigarette device, wherein the residual denoising diffusion processing is performed using the residual denoising diffusion model (RDDM) model. Specifically, the RDDM model can solve the unexplainable problem of a single denoising process in image restoration. In RDDM, the diffusion process is decoupled into residual diffusion and noise diffusion. Residual diffusion gives priority to certainty, indicating the directional diffusion from the target image to the conditional input image, while noise diffusion emphasizes diversity, indicating random perturbations in the diffusion process. Therefore, RDDM can unify different tasks that require different certainty or diversity, such as image generation and restoration. Therefore, the residual denoising diffusion model (RDDM) is a unified framework for image generation and restoration. The residual in RDDM clearly indicates the forward diffusion direction, that is, RDDM introduces the residual (I res ) so that it involves the diffusion of both residual and noise and explicitly guides the inverse generation process for image restoration.

[0122] Therefore, the process of step S03 specifically includes:

[0123] (1) Target image acquisition:

[0124] Acquire a target image of the area to be inspected of the cigarette equipment;

[0125] (2) Forward diffusion:

[0126] The forward diffusion unit in the trained residual denoising diffusion model is used to gradually forward diffuse the target image to obtain the diffused noise image I T ; The forward diffusion includes residual diffusion and noise diffusion, and the diffusion time step t ranges from T to 0;

[0127] Specifically, the diffused noise image I T The acquisition process includes:

[0128] Get Image I t-1 The residual and Gaussian noise;

[0129] To image I t-1 Add image I t-1 The residual and Gaussian noise of the next time step t generate the diffusion image I t , the formula is as follows:

[0130]

[0131] Among them, α t I res Represents image I t-1 The residual of Represents image I t-1 Gaussian noise; α t and are the speed numbers of the control residual and Gaussian noise, I res and ∈ represent residual and random noise respectively;

[0132] Starting from t = 1, repeat the above single time step diffusion step until it diffuses to the maximum time step T, and obtain the noise image I t .

[0133] Wherein, the acquired image I t-1 The steps of calculating the residuals include:

[0134] Using multi-scale analysis method, image I t-1 Decomposing into sub-bands of different scales, the multi-scale analysis method is a wavelet transform method or a Laplace pyramid method;

[0135] Image-based t-1 And sub-bands of different scales, calculate the residual at each scale, that is, image I t-1 and the differences between sub-bands of different scales;

[0136] The residuals at each scale are enhanced using a nonlinear function, and the enhanced residuals are denoised to obtain the denoised residuals at each scale;

[0137] The denoised residuals at each scale are spliced ​​to obtain image I t-1 The residual.

[0138] (3) Residual and noise prediction:

[0139] Based on the residual network and noise network in the trained residual denoising diffusion model, the residual and noise at each time step are predicted;

[0140] (4) Image generation and restoration:

[0141] The generative diffusion unit in the trained residual denoising diffusion model is used to extract I from the noisy image according to the residual and noise at each time step. T Remove the residual and noise and restore the image I at the previous time step T -1, until time step t=0, a preprocessed image of the area to be detected of the cigarette equipment is obtained.

[0142] In this embodiment, the step of obtaining the trained residual denoising diffusion model includes:

[0143] Acquire a training data set, wherein the training data set includes original images and corresponding degraded images of a to-be-detected area of ​​a cigarette device at different angles;

[0144] The training data set is input into the initial residual denoising diffusion model, and the optimal parameters of the model are obtained through training; wherein the initial residual denoising diffusion model includes a forward diffusion unit, a prediction unit and a generation unit, the prediction unit includes a residual network and a noise network, and the generation unit includes a Wiener deconvolution model and a DnCNN denoising model; wherein a periodic calling strategy is adopted during the training process of the generation unit: the calling order and frequency of the Wiener deconvolution model and the DnCNN denoising model are dynamically adjusted according to the noise characteristics of the image and the restoration effect evaluation index;

[0145] Based on the optimal parameters of the model, a trained residual denoising diffusion model is obtained.

[0146] Specifically, multi-model integration processing is also used in the training process of the generation unit, including:

[0147] 1. Model selection

[0148] Model diversity: First, you need to choose from a variety of different types of deconvolution models and denoising models. Wiener deconvolution is suitable for dealing with image blur; the denoising model DnCNN is good at removing image noise.

[0149] Model evaluation: Before ensembling, each model needs to be evaluated individually to ensure that they each have good performance on their specific task.

[0150] 2. Model Fusion Strategy

[0151] Fusion method:

[0152] Voting method: At the pixel level or region level, the final restored value (restored image) is determined by majority voting based on the prediction results of multiple models. This method is more effective when the model prediction results vary greatly.

[0153] Fusion order: The fusion order of the models can be flexibly arranged according to the specific requirements of the task. For example, denoising can be performed first, followed by deconvolution to reduce the impact of noise on the deconvolution effect.

[0154] 3. Implementation steps

[0155] Data preparation: Collect and prepare datasets for training and testing.

[0156] Model training: Train the selected deconvolution model and denoising model separately.

[0157] Model fusion: Integrate the output results of multiple models according to the fusion method.

[0158] Result verification: Comparative experiments are conducted to verify whether the performance of the integrated model is better than that of a single model.

[0159] Specifically, a periodic calling strategy is adopted during the training process of the generation unit to improve the image restoration effect and model flexibility, wherein the periodic calling strategy includes:

[0160] 1. Adaptive model selection mechanism

[0161] Noise characteristic analysis: During the image generation and restoration process, the noise characteristics of the current image are dynamically analyzed, such as noise intensity, distribution, etc. This can be achieved through statistical methods or specialized noise estimation algorithms.

[0162] Restoration effect evaluation: The peak signal-to-noise ratio (PSNR) is set as the restoration effect evaluation index to evaluate the restoration effect of the current model.

[0163] 2. Adjust the model calling order and frequency

[0164] Dynamic adjustment: According to the noise characteristics of the image and the restoration effect evaluation index, the calling order and frequency of different models are dynamically adjusted. For example, in areas or stages with high noise intensity, the DnCNN denoising model can be called first; in areas or stages with severe blur, the Wiener deconvolution model can be called first.

[0165] At the same time, the order and frequency of model calls can be adjusted in a timely manner according to the changing trend of the recovery effect to achieve the best recovery effect.

[0166] Periodic evaluation: Set a certain time period or number of iterations to periodically evaluate the model's recovery effect. The evaluation results will serve as the basis for adjusting the model call strategy.

[0167] 3. Implementation steps

[0168] Initialization: Set the initial model calling order and frequency.

[0169] Periodic evaluation: The recovery effect of the model is evaluated in each evaluation cycle.

[0170] Adjustment strategy: Dynamically adjust the model calling order and frequency based on the evaluation results.

[0171] Continuous optimization: Through continuous iteration and optimization, the model calling strategy is made more adaptable to the noise characteristics and restoration requirements of the current image.

[0172] Example 2

[0173] The embodiment of the present invention introduces an image preprocessing system, including:

[0174] A data acquisition module, used to acquire image data of the area to be detected of the cigarette equipment;

[0175] An equalization processing module is used to perform improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image;

[0176] The residual denoising diffusion module is used to perform residual denoising diffusion processing on the equalized image to obtain a pre-processed image of the area to be detected of the cigarette equipment.

[0177] Example 3

[0178] The belt monitoring area behind the blade segment impurity remover in the silk-making workshop was photographed, and the image data taken was as follows: Figure 3 As shown, it can be seen that in addition to the relatively complete tobacco leaves, there are also many small black spots (tobacco leaf fragments, dust, etc.);

[0179] The image data captured this time is preprocessed using an image preprocessing method mentioned in Example 1 to obtain a processed image, such as Figure 4 As shown;

[0180] In summary, the image preprocessing method provided by the present invention can effectively remove noise, retain useful content (relatively complete tobacco leaves) in the target image, remove spots that may cause subsequent misidentification, and provide a basis for improving image recognition accuracy.

[0181] Example 4

[0182] In this embodiment, the present invention further introduces a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in Embodiment 1 are implemented.

[0183] Example 5

[0184] In this embodiment, the present invention further introduces a computer device, including:

[0185] A memory for storing instructions;

[0186] The processor is used to execute the instruction so that the device performs the operation of implementing the image preprocessing method as described in Example 1.

[0187] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0188] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0189] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0191] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. An image preprocessing method, characterized in that: include: Acquire image data of the area to be inspected of the cigarette equipment; Performing improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image; The equalized image is subjected to residual denoising and diffusion processing to obtain a preprocessed image of the area to be detected of the cigarette equipment.

2. The image preprocessing method according to claim 1, characterized in that: Performing improved histogram equalization processing on the image data of the area to be detected to obtain an image processed by equalization, including: Segment the image data to obtain multiple sub-images; Perform RGB-HSI color conversion on each sub-image, calculate the average pixel value of each sub-image pixel, and divide each sub-image into two parts according to the average pixel value, wherein the two parts include a part with a pixel value not lower than the average pixel value and a part with a pixel value lower than the average pixel value; Performing histogram equalization processing on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value, respectively, to obtain the histogram equalization processing results of the two parts of each sub-image; The histogram equalization processing results of the two parts of each sub-image are combined to obtain each enhanced sub-image; Perform contrast limitation on each enhanced sub-image; Bilinear interpolation is used to combine the contrast-limited sub-images, and HSI-RGB color conversion is performed to obtain a balanced image.

3. The image preprocessing method according to claim 2, characterized in that: The histogram equalization processing is performed on the part of each sub-image with a pixel value not lower than the average pixel value and the part of each sub-image with a pixel value lower than the average pixel value to obtain the histogram equalization processing results of the two parts of each sub-image, wherein the histogram equalization processing process for the part of each sub-image with a pixel value not lower than the average pixel value includes: Obtain the total number of pixels in the portion above and below the average pixel value in the sub-image and the brightness components corresponding to the pixels; Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted; According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part with a value not less than the average pixel, an original histogram of the part with a value not less than the average pixel is obtained; Based on the original histogram of the portion of pixel values ​​not less than the average pixel value, a cumulative histogram of the portion of pixel values ​​not less than the average pixel value is obtained; The brightness component corresponding to each pixel is transformed by using the transformation function to obtain the transformed brightness component of each pixel; Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel; Based on the corrected brightness components of each pixel, a histogram equalization processing result not lower than the average pixel value is obtained.

4. The image preprocessing method according to claim 3, characterized in that: The histogram equalization processing is performed on the part of each sub-image that is not lower than the average pixel value and the part of each sub-image that is lower than the average pixel value, respectively, to obtain the histogram equalization processing results of the two parts of each sub-image, wherein the histogram equalization processing process for the part of each sub-image that is lower than the average pixel value includes: Obtain the total number of pixels in the portion of the sub-image that is lower than the average pixel value and the brightness component corresponding to the pixels; Based on the brightness components corresponding to each pixel, the number of pixels corresponding to each level of the brightness components is counted; According to the number of pixels corresponding to each level of the brightness component and the total number of pixels in the part below the average pixel value, an original histogram of the part below the average pixel value is obtained; Based on the original histogram of the portion of pixel values ​​below the average, a cumulative histogram of the portion of pixel values ​​below the average is obtained; The brightness component corresponding to each pixel is transformed by using the transformation function to obtain the transformed brightness component of each pixel; Determine a transformation relationship between the brightness component corresponding to each pixel and the brightness component after transformation, and use the transformation relationship to correct the brightness component of each pixel; Based on the corrected brightness components of each pixel, a histogram equalization processing result of the portion below the average pixel value is obtained.

5. The image preprocessing method according to claim 4, characterized in that: The transformation function is expressed as follows: j=INT[(1-L)P m +0.5] Among them, P m is the m-th order cumulative brightness component value; L represents the brightness component level; INT() represents rounding; j represents the transformed brightness component.

6. The image preprocessing method according to claim 5, characterized in that: The equalized image is subjected to residual denoising and diffusion processing to obtain a preprocessed image of the area to be detected of the cigarette device, including: Acquire a target image of the area to be inspected of the cigarette equipment; Using the trained residual denoising diffusion model, the target image is gradually forward diffused to obtain the diffused noise image I T ; The forward diffusion includes residual diffusion and noise diffusion, and the diffusion time step t ranges from T to 0; Based on the residual network and noise network in the trained residual denoising diffusion model, the residual and noise at each time step are predicted; According to the residual and noise at each time step, I T Remove the residual and noise and restore the image I at the previous time step T-1 , until time step t = 0, a preprocessed image of the area to be detected of the cigarette equipment is obtained.

7. The image preprocessing method according to claim 6, characterized in that: The steps of obtaining the trained residual denoising diffusion model include: Acquire a training data set, wherein the training data set includes original images and corresponding degraded images of a to-be-detected area of ​​a cigarette device at different angles; The training data set is input into the initial residual denoising diffusion model, and the optimal parameters of the model are obtained through training; wherein the initial residual denoising diffusion model includes a forward diffusion unit, a prediction unit and a generation unit, the prediction unit includes a residual network and a noise network, and the generation unit includes a Wiener deconvolution model and a DnCNN denoising model; wherein a periodic calling strategy is adopted during the training process of the generation unit: the calling order and frequency of the Wiener deconvolution model and the DnCNN denoising model are dynamically adjusted according to the noise characteristics of the image and the restoration effect evaluation index; Based on the optimal parameters of the model, a trained residual denoising diffusion model is obtained.

8. The image preprocessing method according to claim 7, characterized in that: The target image is forward diffused step by step to obtain the diffused noise image I T ,include: Get Image I t-1 The residual and Gaussian noise; To image I t-1 Add image I t-1 The residual and Gaussian noise of generate the diffusion image I of the next time step t t , the formula is as follows: Among them, α t L res Represents image I t-1 The residual of Represents image I t-1 Gaussian noise; α t and are the speed numbers of the control residual and Gaussian noise, I res and ∈ represent residual and random noise respectively; Starting from t = 1, repeat the above single time step diffusion step until it diffuses to the maximum time step T, and obtain the noise image I t .

9. The image preprocessing method according to claim 8, characterized in that: The acquired image I t-1 The steps of calculating the residuals include: Using multi-scale analysis method, image I t-1 Decomposing into sub-bands of different scales, the multi-scale analysis method is a wavelet transform method or a Laplace pyramid method; Image-based t-1 And sub-bands of different scales, calculate the residual at each scale, that is, image I t-1 and the differences between sub-bands of different scales; The residuals at each scale are enhanced using a nonlinear function, and the enhanced residuals are denoised to obtain the denoised residuals at each scale; The denoised residuals at each scale are spliced ​​to obtain image I t-1 The residual.

10. An image preprocessing system, characterized in that: include: A data acquisition module, used to acquire image data of the area to be detected of the cigarette equipment; An equalization processing module is used to perform improved histogram equalization processing on the image data of the area to be detected to obtain an equalized image; The residual denoising diffusion module is used to perform residual denoising diffusion processing on the equalized image to obtain a pre-processed image of the area to be detected of the cigarette equipment.