Image processing model training method, image stroboscopic processing method and device

By performing stroboscopic addition processing and combined loss function design on the image processing model, the problem of difficulty in removing flicker stripes in the existing technology is solved, the accurate removal effect is achieved in any scene, and the image quality is improved.

CN118397400BActive Publication Date: 2024-09-24HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410841248.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-24
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

It is difficult to completely remove flickering stripes from images with existing technology, especially when capturing high-speed moving objects. It is difficult to completely remove irregular flickering stripes between light and dark due to the influence of light source frequency.

Method used

Provides a training method for image processing models, by performing stroboscopic addition processing on a pre-acquired set of labeled images to generate a set of degraded images, and combining the labeled images and degraded images into data pairs, using a combined loss function (including brightness consistency loss function, stroboscopic loss function, stripe prior similarity loss function and gradient loss function) to train the network model and obtain the target model for removing flicker stripes.

Benefits of technology

It improves the effect and performance of model training in image processing tasks, enhances the elimination effect and generalization ability of the model, and can accurately remove flickering stripes in images in any scene.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397400B
    Figure CN118397400B
Patent Text Reader

Abstract

The present application provides a training method for an image processing model, an image stroboscopic processing method and device. It is applied to the field of image processing technology. The method includes: performing stroboscopic addition processing on a pre-acquired set of labeled images to obtain a set of degraded images, and then combining each labeled image and the corresponding degraded image into a data pair to obtain a data set, and then training a preset network model according to the data set and a pre-acquired combined loss function to obtain a target model, and finally inputting the image to be processed into the target model to perform flicker stripe elimination processing to obtain a target image. By designing the data set and the combined loss function, the adaptability, controllability and flexibility are improved, which helps to improve the effect and performance of model training in image processing tasks, thereby improving the elimination effect and generalization ability of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a training method for an image processing model, and a method and device for image stroboscopic processing. Background Art

[0002] With the continuous development of computer technology, when shooting images, cameras often need to reduce the exposure time to capture high-speed moving objects. At this time, the influence of the frequency of the light source will produce irregular flickering stripes of light and dark in the image.

[0003] In the prior art, for flickering stripes in an image, the exposure time and frame rate of the shooting device are usually adjusted, or a long-exposure image is collected to guide the short-exposure image for restoration.

[0004] However, the application scenarios of the above method are limited, and it is difficult to completely remove the flickering stripes. Summary of the invention

[0005] The present application provides an image processing model training method, an image stroboscopic processing method and a device, so as to solve the problem in the prior art that flickering stripes in an image cannot be completely removed.

[0006] In a first aspect, the present application provides a method for training an image processing model, comprising:

[0007] Performing stroboscopic adding processing on a pre-acquired label image set to obtain a degraded image set, wherein the label image set includes a plurality of label images, and the degraded image set includes a degraded image after stroboscopic adding to each label image;

[0008] Combine each label image and the corresponding degraded image into a data pair to obtain a data set;

[0009] According to the data set and the pre-acquired combined loss function, a preset network model is trained to obtain a target model, wherein the target model is used to eliminate flickering stripes in the image;

[0010] The combined loss function includes a brightness consistency loss function, a stroboscopic loss function, a stripe prior similarity loss function, and a gradient loss function, which are weighted according to pre-set function weights.

[0011] In conjunction with the first aspect, in some embodiments,

[0012] In each training process, the stroboscopic loss part of the value of the combined loss function is determined based on the stroboscopic weight matrix and the physical characteristics of the stroboscopic stripes corresponding to the label image of this training;

[0013] The stripe prior similarity loss part in the value of the combined loss function is determined based on the cosine similarity between the label image of this training and the corresponding target image, and the stroboscopic weight matrix corresponding to the label image.

[0014] In combination with the first aspect, in some embodiments, performing stroboscopic addition processing on the pre-acquired label image set to obtain the degraded image set includes:

[0015] For each labeled image in the labeled image set, randomly generating a power grid frequency, a camera row sampling frequency and an initial phase according to preset constraints;

[0016] According to the mapping relationship between the grid frequency, the camera row sampling frequency, the initial phase and the label image, an initial stroboscopic coefficient matrix corresponding to the label image is calculated;

[0017] Calculate the target stroboscopic coefficient corresponding to the label image according to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix;

[0018] According to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image, a degraded image after adding stroboscopic to the label image is calculated;

[0019] All degraded images are aggregated to obtain the degraded image set.

[0020] In combination with the first aspect, in some embodiments, the method further includes:

[0021] For each label image, a stroboscopic weight matrix corresponding to the label image is calculated based on the initial stroboscopic coefficient matrix corresponding to the label image and the preset stroboscopic weight coefficient.

[0022] In combination with the first aspect, in some embodiments, the method further includes:

[0023] When any set of label images and degraded images in the data set is used for model training, the stroboscopic fringe intensity weights of the label images and the target image are adjusted according to the stroboscopic weight matrix corresponding to the label image, and the target image is the image output by the label image after calculation by the target model;

[0024] According to the physical characteristics of the stroboscopic stripes, performing column dimension average calculation on the adjusted label image and the adjusted target image;

[0025] According to the preset mapping relationship between the calculated label image and the calculated target image, and the stroboscopic loss function, the stroboscopic loss part corresponding to this training is calculated.

[0026] In combination with the first aspect, in some embodiments, the method further includes:

[0027] When any set of labeled images and degraded images in the data set is used for model training, the labeled images and the target images are calculated according to a preset cosine similarity formula to obtain the cosine similarity between the labeled images and the target images;

[0028] The stripe priori similarity loss part corresponding to this training is calculated based on the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe priori similarity loss function.

[0029] In combination with the first aspect, in some embodiments, the method further includes:

[0030] Performing random cropping and inversion processing on each image in the pre-acquired image set to obtain a first image set;

[0031] Performing downsampling processing on each image in the first image set to obtain a second image set;

[0032] Performing color deflection processing on each image in the second image set to obtain a third image set;

[0033] The brightness of each image in the third image set is adjusted to obtain the label image set.

[0034] In a second aspect, the present application provides a method for stroboscopic processing of an image, comprising:

[0035] Acquire an image to be processed, wherein the image to be processed includes flickering stripes;

[0036] Inputting the image to be processed into the target model to perform flicker stripe elimination processing to obtain a target image;

[0037] Wherein, the target model is trained by the training method of the image processing model described in any one of the first aspects.

[0038] In a third aspect, the present application provides a training device for an image processing model, comprising:

[0039] An adding module, used for performing stroboscopic adding processing on a pre-acquired label image set to obtain a degraded image set, wherein the label image set includes a plurality of label images, and the degraded image set includes a degraded image after stroboscopic addition to each label image;

[0040] A combination module is used to combine each label image and the corresponding degraded image into a data pair to obtain a data set;

[0041] A training module, used to train a preset network model according to the data set and a pre-acquired combined loss function to obtain a target model, wherein the target model is used to eliminate flickering stripes in the image;

[0042] The combined loss function includes a brightness consistency loss function, a stroboscopic loss function, a stripe prior similarity loss function, and a gradient loss function, which are weighted according to pre-set function weights.

[0043] In combination with the third aspect, in some embodiments, during each training process, the stroboscopic loss part in the value of the combined loss function is determined based on the stroboscopic weight matrix and the physical characteristics of the stroboscopic stripes corresponding to the label image of this training;

[0044] The stripe prior similarity loss part in the value of the combined loss function is determined based on the cosine similarity between the label image of this training and the corresponding target image, and the stroboscopic weight matrix corresponding to the label image.

[0045] In conjunction with the third aspect, in some embodiments, the adding module includes:

[0046] A random generation unit, used for randomly generating a power grid frequency, a camera row sampling frequency and an initial phase for each label image in the label image set according to a preset constraint condition;

[0047] A first calculation unit, configured to calculate an initial stroboscopic coefficient matrix corresponding to the label image according to a mapping relationship among the grid frequency, the camera row sampling frequency, the initial phase and the label image;

[0048] A second calculation unit is used to calculate the target stroboscopic coefficient corresponding to the label image according to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix;

[0049] A third calculation unit is used to calculate and obtain a degraded image after adding stroboscopic image to the label image according to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image;

[0050] The aggregation unit is used to aggregate all the degraded images to obtain the degraded image set.

[0051] In conjunction with the third aspect, in some embodiments, the device further includes:

[0052] The first calculation module is used to calculate, for each label image, a stroboscopic weight matrix corresponding to the label image according to an initial stroboscopic coefficient matrix corresponding to the label image and a preset stroboscopic weight coefficient.

[0053] In conjunction with the third aspect, in some embodiments, the device further includes:

[0054] A weight adjustment module, used for adjusting the stroboscopic fringe intensity weights of the label image and the target image according to the stroboscopic weight matrix corresponding to the label image when using any group of label images and degraded images in the data set for model training, wherein the target image is an image output by the label image after calculation by the target model;

[0055] A second calculation module is used to perform column dimension average calculation on the adjusted label image and the adjusted target image according to the physical characteristics of the stroboscopic stripes;

[0056] The third calculation module is used to calculate the stroboscopic loss part corresponding to this training according to the preset mapping relationship between the calculated label image and the calculated target image, and the stroboscopic loss function.

[0057] In conjunction with the third aspect, in some embodiments, the device further includes:

[0058] a fourth calculation module, configured to calculate the label image and the target image according to a preset cosine similarity formula when using any set of label images and degraded images in the data set for model training, so as to obtain the cosine similarity between the label image and the target image;

[0059] The fifth calculation module is used to calculate the stripe priori similarity loss part corresponding to this training according to the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe priori similarity loss function.

[0060] In conjunction with the third aspect, in some embodiments, the device further includes:

[0061] A cropping and reversing module, used for performing random cropping and reversing processing on each image in the pre-acquired image set to obtain a first image set;

[0062] A downsampling module, used for performing downsampling processing on each image in the first image set to obtain a second image set;

[0063] A color deflection module, used for performing color deflection processing on each image in the second image set to obtain a third image set;

[0064] The brightness adjustment module is used to adjust the brightness of each image in the third image set to obtain the label image set.

[0065] In a fourth aspect, the present application provides a stroboscopic image processing device, comprising:

[0066] An acquisition module, used for acquiring an image to be processed, wherein the image to be processed includes flickering stripes;

[0067] An elimination processing module is used to input the image to be processed into a target model to perform flicker stripe elimination processing to obtain a target image;

[0068] Wherein, the target model is obtained by training using the image processing model training method described in any one of the first aspects.

[0069] In a fifth aspect, the present application provides an electronic device, comprising: a processor, and a memory and a display connected to the processor in communication;

[0070] The memory stores computer-executable instructions;

[0071] The processor executes the computer-executable instructions stored in the memory to implement the image processing model training method described in any one of the first aspects and the image stroboscopic processing method described in the second aspect.

[0072] In a sixth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the method described in any of the aforementioned aspects when executed by a processor.

[0073] In a seventh aspect, the present application provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method described in any of the preceding aspects is implemented.

[0074] The training method of the image processing model, the image stroboscopic processing method and the device provided by the present application perform stroboscopic addition processing on a pre-acquired label image set to obtain a degraded image set, then combine each label image and the corresponding degraded image into a data pair to obtain a data set, and then train the preset network model according to the data set and the pre-acquired combined loss function to obtain a target model, and finally input the image to be processed into the target model to perform stroboscopic stripe elimination processing to obtain a target image. By designing the data set and the combined loss function, the adaptability, controllability and flexibility are improved, which helps to improve the effect and performance of model training in image processing tasks, thereby improving the elimination effect and generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0076] Figure 1An application scenario diagram of the image processing model training method and the image stroboscopic processing method provided in the embodiments of the present application;

[0077] Figure 2 A flowchart of a first embodiment of a method for training an image processing model provided in an embodiment of the present application;

[0078] Figure 3 A flowchart of a second embodiment of a method for training an image processing model provided in an embodiment of the present application;

[0079] Figure 4 A flowchart of a third embodiment of the training method for an image processing model provided in an embodiment of the present application;

[0080] Figure 5 is an example diagram of a stroboscopic weight matrix corresponding to an exemplary label image;

[0081] Figure 6 A flowchart of a fourth embodiment of a method for training an image processing model provided in an embodiment of the present application;

[0082] Figure 7 A schematic diagram of a flow chart of an embodiment of a stroboscopic image processing method provided in an embodiment of the present application;

[0083] Figure 8 It is a specific implementation flow chart of an exemplary image processing model training method and an image stroboscopic processing method;

[0084] Fig. 9 is a schematic diagram of an exemplary stroboscopic image;

[0085] Fig.10 is a schematic diagram of an exemplary stroboscopic image after stroboscopic removal processing;

[0086] Fig.11 A structural diagram of a first embodiment of a training device for an image processing model provided in an embodiment of the present application;

[0087] Fig.12 A schematic diagram of the structure of a second embodiment of a training device for an image processing model provided in an embodiment of the present application;

[0088] Fig.13 A schematic diagram of the structure of a third embodiment of a training device for an image processing model provided in an embodiment of the present application;

[0089] Fig.14 A schematic diagram of the structure of a fourth embodiment of a training device for an image processing model provided in an embodiment of the present application;

[0090] Fig.15 A schematic diagram of the structure of a fifth embodiment of a stroboscopic image processing device provided in an embodiment of the present application;

[0091] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0092] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0093] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0094] With the continuous advancement of science and technology and the improvement of people's living standards, many existing electronic devices have camera functions, so people can use electronic devices to record their lives, such as smart phones, smart cameras, etc., and can also monitor specific scenes through electronic devices to ensure people's life safety and property safety, such as surveillance cameras in shopping malls, surveillance equipment at home, and surveillance cameras on the road. Some existing intelligent robots are also equipped with cameras with camera functions, such as home service robots such as sweeping robots. Intelligent robots can establish work maps through the surrounding scenes captured by the camera to achieve accurate obstacle avoidance. In order to ensure the quality of the work of equipment equipped with cameras, the quality of the pictures or videos taken is crucial. When shooting images, it is often necessary to reduce the exposure time to capture high-speed moving objects. At this time, the influence of the frequency of the light source will produce irregular flickering stripes of light and dark in the image. This results in poor image quality. In order to improve image quality, the conventional techniques usually adjust the exposure time and frame rate of the shooting device, or collect long-exposure images to guide short-exposure images for restoration. For example, the correction coefficient of each row is determined by the brightness of each row of pixels in a frame of image, and the correction coefficient is fitted into a sine curve through amplitude, period, initial phase, phase offset and upper and lower offsets of the curve. Finally, the correction coefficient is multiplied by each pixel point of the corresponding row to obtain the corrected image. However, the target brightness of the above method is difficult to determine, which results in low accuracy and is easily affected by overly bright or dark areas in the scene, resulting in large deviations. Therefore, in actual application scenarios, it is impossible to completely remove the flickering stripes in the image.

[0095] In response to the above problems, the present application provides a training method for an image processing model, an image stroboscopic processing method and device, and obtains a model that can accurately remove flickering stripes in an image, and the model is used to accurately eliminate flickering stripes in images of any scene. Specifically, in some shooting scenes, in order to capture high-speed moving objects, the exposure time is usually reduced, which leads to flickering stripes in the captured image, affecting the quality of the image. If the exposure time and frame rate of the shooting device are adjusted, although the flickering stripes in the image will be reduced, it will still affect the quality of the image shooting. Therefore, this method is not suitable for any scene. In view of these problems, the inventor has studied whether it is possible to improve the effect and generalization ability of the model by formulating a data set with high accuracy and strong diversity, and then designing a high-quality combined loss function, so as to be able to remove flickering stripes in the image in any scene. Based on this, the technical solution of the present application is proposed.

[0096] Figure 1 The application scenario diagram of the image processing model training method and the image stroboscopic processing method provided in the embodiment of the present application is as follows: Figure 1 As shown, the scene includes at least one electronic device and a data collection platform, wherein the electronic device and the data collection platform are communicatively connected, the electronic device is used to generate a data set, design a combined loss function, and train a preset network model according to the data set and the combined loss function, thereby obtaining a target model that can eliminate flickering stripes in the image, and then inputting the processed image input by the user into the target model for processing to obtain a target image that completely removes flickering stripes, and the electronic device can be a smart phone, a laptop, a server, or a cloud server, etc., which can communicate with external devices and perform data processing. The data collection platform can be any device that can collect and store image data. The data collection platform sends the collected image data to the electronic device, and the electronic device produces a data set based on the received image data.

[0097] Optionally, when the user inputs the processed image to the electronic device, it can be input to the electronic device through a terminal device, or it can be sent through a control configured in the electronic device. This application does not specifically limit the above specific implementation method.

[0098] It should be noted that the communication connection between the electronic device and the data collection platform can be a wired connection, connecting the device through physical cables such as data cables and network cables, such as Universal Serial Bus (USB), High-Definition Multimedia Interface (HDMI), Ethernet and other interfaces to connect the device for data transmission. It can also be a wireless connection, communicating through radio wave signals, such as wireless fidelity (WiFi), Bluetooth, infrared and other wireless technologies to achieve communication between devices. Or it can be a remote connection, connecting devices through network technologies such as the Internet to achieve remote control and data transmission, such as cloud services, remote desktops, etc. It can also be a near field communication (NFC) connection, which realizes the connection between devices through near field communication technology, usually used for applications such as file transfer; low-power Bluetooth connection, used for short-distance communication connection between devices, such as the connection of smart bracelets, smart watches and other devices; wireless communication technology connection, used for low-speed, short-distance communication connection between devices, suitable for low-power IoT devices. This application does not specifically limit the specific method of communication connection between physical devices.

[0099] This application does not specifically limit the specific form and type of any of the above-mentioned physical devices.

[0100] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0101] Figure 2 A flowchart of a first embodiment of a training method for an image processing model provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method includes:

[0102] S201: Perform stroboscopic addition processing on a pre-acquired label image set to obtain a degraded image set.

[0103] In this step, in order to completely remove the flickering stripes in the captured image or video in any shooting scene, thereby improving the image quality, a model can be used to calculate the flickering stripes removal, which requires a data set that can be used to train the network model. In order to improve the universality and robustness of the data set, strobe light is added to each image in the pre-acquired label image set, thereby obtaining a degraded image set. The label image set includes multiple label images, and the degraded image set includes degraded images after strobe light is added to each label image.

[0104] Specifically, for each label image in the label image set, according to the preset constraints, the power grid frequency, the camera row sampling frequency and the initial phase are randomly generated, and the initial stroboscopic coefficient matrix corresponding to the label image is calculated according to the mapping relationship between the power grid frequency, the camera row sampling frequency, the initial phase and the label image. According to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix, the target stroboscopic coefficient corresponding to the label image is calculated. According to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image, the degraded image after adding stroboscopic to the label image is calculated.

[0105] S202: Combine each label image and the corresponding degraded image into a data pair to obtain a data set.

[0106] In this step, after obtaining the degraded image corresponding to each label image, the label image and the corresponding degraded image are combined into a data pair to obtain a data set, thereby improving the authenticity of the data, making the subsequent training model more representative and authentic, and helping the model to more comprehensively learn the ability to remove flickering stripes.

[0107] S203: According to the data set and the pre-acquired combined loss function, the preset network model is trained to obtain a target model.

[0108] In this step, after the data set is formulated, in order to restore the image with flickering stripes and thus improve the image quality, the pre-set network model can be trained according to the data set and the pre-acquired combined loss function, so as to obtain a target model that can accurately remove flickering stripes in the image, wherein the combined loss function includes a brightness consistency loss function weighted according to a pre-set function weight, a flicker loss function, a stripe prior similarity loss function, and a gradient loss function.

[0109] Specifically, the combined loss function can be expressed by the following formula:

[0110]

[0111] in, is the brightness consistency loss function The weight of is the flicker loss function The weight of is the stripe prior similarity loss function The weight of is the gradient loss function The weight of .

[0112] Optionally, the pre-set network model can be a deep convolutional neural network, a generative adversarial network, a deep residual network, a recurrent neural network, a long short-term memory network, an attention mechanism model, a densely connected convolutional network, etc. This application does not specifically limit the type and specific structure of the network model.

[0113] Optionally, during each training process, the stroboscopic loss part in the value of the combined loss function is determined based on the stroboscopic weight matrix corresponding to the label image of this training and the physical characteristics of the stroboscopic stripes, and the stripe prior similarity loss part in the value of the combined loss function is determined based on the cosine similarity between the label image of this training and the corresponding target image, as well as the stroboscopic weight matrix corresponding to the label image.

[0114] Optionally, the flicker loss part can be calculated by the following formula:

[0115]

[0116] in, represents the flicker loss, m, n, c represent the number of rows, columns, and color channels of the image, express norm, represents the multiplication of corresponding elements, It means that the column dimension of the image is averaged, and the result is the mean of the pixels in each row of the image.

[0117] The stripe prior similarity loss can be calculated by the following formula:

[0118]

[0119] in, represents the stripe prior similarity loss, m and n represent the number of rows and columns of the image, represents the stroboscopic weight matrix corresponding to the label image, Indicates similarity.

[0120] For example, the training of the model is described by taking the recurrent neural network as an example. First, the recurrent neural network model is constructed, and recurrent neural network units such as long short-term memory network or gated recurrent unit are selected, and the attention mechanism is introduced into the model. The images in the dataset are input into the recurrent neural network model to learn how to remove the flickering stripes. The labeled images without flickering in the dataset and the images output by the model are compared and the loss function is combined to calculate the loss. , where the weight value is set to , , . Then, the model parameters are updated through the back-propagation algorithm. For example, common optimization algorithms such as adaptive moment estimation and stochastic gradient descent are used to optimize the model parameters. The trained model is then evaluated using the validation set to calculate the similarity between the generated image and the target image in the validation set. Evaluation indicators that can be used include peak signal-to-noise ratio and structural similarity index to evaluate the image quality until the preset evaluation threshold is reached, the model training is completed, and the target model is obtained.

[0121] The training method of the image processing model provided in this embodiment performs stroboscopic addition processing on a pre-acquired label image set to obtain a degraded image set, then combines each label image and the corresponding degraded image into a data pair to obtain a data set, and finally trains a preset network model according to the data set and the pre-acquired combined loss function to obtain a target model. By designing the data set and the combined loss function, the adaptability, controllability and flexibility are improved, which helps to improve the effect and performance of model training in image processing tasks, thereby improving the elimination effect and generalization ability of the model.

[0122] Figure 3 A flow chart of the second embodiment of the training method of the image processing model provided in the embodiment of the present application is shown in FIG. Figure 3 As shown, based on the above embodiment, step S201 specifically includes:

[0123] S301: For each labeled image in the labeled image set, randomly generate a power grid frequency, a camera row sampling frequency and an initial phase according to preset constraints.

[0124] S302: According to the mapping relationship among the power grid frequency, the camera row sampling frequency, the initial phase and the label image, an initial stroboscopic coefficient matrix corresponding to the label image is calculated.

[0125] S303: Calculate the target stroboscopic coefficient corresponding to the label image according to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix.

[0126] S304: According to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image, a degraded image after adding stroboscopic image to the label image is calculated.

[0127] In order to enable the model to better learn how to accurately remove flickering stripes based on the data set, flicker can be added to each label image to form a data pair, and then the network model can be accurately trained. It can be seen from the existing technology that flicker presents a sine and cosine curve distribution.

[0128] For each labeled image in the labeled image set, the grid frequency, camera row sampling frequency and initial phase are generated according to the pre-set constraints, where the constraints can be set as follows: , randomly generate truncated normal distribution u values, that is, limit the randomly generated u values ​​to be normally distributed and within the constraint range, where, is the grid frequency, which can be 50HZ or 60HZ. is the camera row sampling frequency. The initial phase of the curve is randomly generated with uniform distribution, and the value range is .

[0129] For example, the constraints on the grid frequency and the camera row sampling frequency can constrain their mean to be , the variance is , the constraint range is .

[0130] After obtaining the grid frequency, the camera row sampling frequency and the initial phase, the initial stroboscopic coefficient matrix corresponding to the label image can be calculated according to the preset formula. Specifically, the column vector of the label image is first calculated. The formula for calculating the column vector is expressed as:

[0131]

[0132] Where k represents the column vector of the label image, u represents the ratio of the power grid frequency to the camera row sampling frequency, represents the initial phase, and m represents the number of rows of the label image.

[0133] It should be noted that It is the calculation of the initial column vector of the label image. Through the calculation of the above formula, its value range is changed from [-1, 1] to [-1, 0]. Its purpose is to make the image brightness uniformly darker during the degradation process, avoid pixel value overflow and reduce the learning burden of the network.

[0134] After calculating the column vector k, copy k columns, resulting in a size of To obtain the matrix K, in order to make the values ​​in the same row of the matrix K different, random numbers are uniformly sampled in the interval [0, 1] ,like Then the coefficients of each column of matrix K are offset, and then the matrix K is copied by channel to obtain a size of The initial stroboscopic coefficient matrix H. The matrix K can be expressed by the following formula:

[0135]

[0136] in, is a randomly generated horizontal gradient matrix, For example, the matrix The value range of is [0.8, 1], .

[0137] After obtaining the initial stroboscopic coefficient matrix of the label image, in order to obtain the target stroboscopic coefficient corresponding to the label, the target stroboscopic coefficient is calculated according to the mapping relationship between the target stroboscopic coefficient and the initial stroboscopic coefficient matrix H. The mapping relationship between the target stroboscopic coefficient and the initial stroboscopic coefficient matrix H is expressed as:

[0138]

[0139] in, represents the target flicker coefficient, c represents the color channel of the image, Indicates the flicker intensity of each color channel.

[0140] Optional, The values ​​in each color channel are randomly generated. Specifically, is a random number uniformly sampled in the interval [a, b], and a random number uniformly sampled in the interval [0, 1] ,like , then the flicker intensity of the three channels R, G, and B are all obtained by random generation. Then the flicker intensities of the three channels R, G, and B are unified into a randomly generated value.

[0141] therefore The formula can be expressed as:

[0142]

[0143] After obtaining the target stroboscopic coefficient corresponding to the label image, stroboscopic can be added to the label image according to the mapping relationship between the label image and the degraded image, thereby obtaining the degraded image after stroboscopic addition to the label image. The specific mapping relationship can be expressed as:

[0144]

[0145] in, represents the label image, represents the degraded image after adding strobe to the label image, (i, j) represents the pixel coordinates of the image, c represents the color channel of the image, Indicates the flicker intensity of each color channel, is the grid frequency, which can be 50HZ or 60HZ. is the camera row sampling frequency, Indicates the initial phase of the randomly generated uniformly distributed curve, with a value range of .

[0146] It should be noted that since each label image in the label image set is different, the corresponding parameters are also different. Therefore, in the process of adding strobe to the label image, it is necessary to add strobe to each label image separately according to the above mapping relationship formula, so as to obtain a degraded image after adding strobe to each label image.

[0147] S305: Aggregate all degraded images to obtain a degraded image set.

[0148] After obtaining the degraded image after adding stroboscopic light to each label image, all the degraded images are aggregated to obtain a degraded image set.

[0149] The training method of the image processing model provided in the present embodiment randomly generates a power grid frequency, a camera row sampling frequency and an initial phase for each label image in the label image set according to preset constraints, calculates an initial stroboscopic coefficient matrix corresponding to the label image according to a mapping relationship among the power grid frequency, the camera row sampling frequency, the initial phase and the label image, calculates a target stroboscopic coefficient corresponding to the label image according to a mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix, calculates a degraded image after adding stroboscopic image to the label image according to a mapping relationship among the target stroboscopic coefficient, the label image and the corresponding degraded image, and aggregates all the degraded images to obtain a degraded image set.

[0150] Figure 4 The flowchart of the third embodiment of the training method of the image processing model provided in the embodiment of the present application is as follows: Figure 4 As shown, based on the above embodiment, the method further includes:

[0151] S401: For each label image, a stroboscopic weight matrix corresponding to the label image is calculated according to an initial stroboscopic coefficient matrix corresponding to the label image and a preset stroboscopic weight coefficient.

[0152] In each training process, the loss of the input image needs to be calculated. In real stroboscopic images, since the distribution of stroboscopic stripes is a sine-cosine curve, there are obvious differences in the strength of stroboscopic stripes in different areas of the image. Therefore, a higher weight can be applied to the area with stronger stripes, so that the network can focus more on the restoration here. Therefore, for each label image, the corresponding stroboscopic weight matrix is ​​calculated, and the stroboscopic stripe intensity weights of the label image and the target image are adjusted according to the calculated stroboscopic weight matrix. Among them, the target image is the image output by the label image calculated by the target model.

[0153] Specifically, the calculation of the stroboscopic weight matrix corresponding to the label image can be calculated according to the mapping relationship between the preset parameter coefficients and the initial stroboscopic coefficient matrix H corresponding to the label image, and the formula can be expressed as:

[0154]

[0155] in, represents the stroboscopic weight matrix corresponding to the label image, H represents the initial stroboscopic coefficient matrix corresponding to the label image, and is a pre-set parameter coefficient, for example, it can be .

[0156] It should be noted that each label image corresponds to a stroboscopic weight matrix.

[0157] For example, Figure 5 is an example diagram of a stroboscopic weight matrix corresponding to an exemplary label image, such as Figure 5 As shown, an exemplary label image is calculated by the above formula to obtain the corresponding stroboscopic weight matrix.

[0158] S402: When any set of label images and degraded images in the data set is used for model training, the stroboscopic fringe intensity weights of the label image and the target image are adjusted according to the stroboscopic weight matrix corresponding to the label image.

[0159] S403: performing column dimension average calculation on the adjusted label image and the adjusted target image according to the physical characteristics of the stroboscopic stripes.

[0160] S404: According to a preset mapping relationship between the calculated label image and the calculated target image, and a stroboscopic loss function, a stroboscopic loss part corresponding to the current training is calculated.

[0161] When model training is performed on any set of label images and degraded images in the sampling data set, for the calculation of the stroboscopic loss corresponding to this training, it is first necessary to readjust the stroboscopic streak intensity weights of the label image and the target image according to the stroboscopic weight matrix corresponding to the label image of this training calculated in the above steps. According to the physical characteristics of the stroboscopic signal, its intensity is distributed by row, and the stroboscopic loss can constrain each row of the target image and the label image. Therefore, according to the physical characteristics of the stroboscopic streaks, the adjusted label image and the adjusted target image can be averaged in the column dimension to calculate the mean of each row of pixels, and then the stroboscopic loss part is calculated according to the pre-set mapping relationship between the calculated label image and the calculated target image.

[0162] Specifically, the stroboscopic loss part of this training can be calculated according to the following formula:

[0163]

[0164] in, represents the flicker loss, m, n, c represent the number of rows, columns, and color channels of the image, express norm, represents the multiplication of corresponding elements, It means that the column dimension of the image is averaged, and the result is the mean of the pixels in each row of the image.

[0165] S405: When any set of label images and degraded images in the data set is used for model training, the label image and the target image are calculated according to a preset cosine similarity formula to obtain the cosine similarity between the label image and the target image.

[0166] S406: Calculate the stripe priori similarity loss corresponding to this training according to the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe priori similarity loss function.

[0167] When any set of labeled images and degraded images in the data set are used for model training, in order to accurately train the model so that the image channel information can be constrained, the image channel information can be constrained by using the cosine similarity through the stripe prior similarity loss.

[0168] Specifically, firstly, the cosine similarity between the label image and the target image is calculated according to the pre-set cosine similarity formula, which is specifically expressed as:

[0169]

[0170] in, Indicates similarity, It means summing the channel dimensions of the image. Indicates the channel dimension of the image norm, Represents a very small number and is used for division by zero protection.

[0171] After the cosine similarity between the label image and the target image is calculated, the stripe prior similarity loss corresponding to this training is calculated based on the cosine similarity between the label image and the target image.

[0172] Specifically, the stripe prior similarity loss part of this training can be calculated according to the following formula:

[0173]

[0174] in, represents the stripe prior similarity loss, m and n represent the number of rows and columns of the image, represents the stroboscopic weight matrix corresponding to the label image, Indicates similarity.

[0175] Optionally, the brightness consistency loss part of this training can be calculated by the following formula:

[0176]

[0177] in, represents the brightness consistency loss, m, n, c represent the number of rows, columns, and color channels of the image, express Norm.

[0178] It should be noted that the brightness consistency loss is used to keep the overall brightness of the target image consistent with the label image.

[0179] Optional, gradient loss Taking into account the physical characteristics of the stroboscopic signal, the image gradient is constrained in the horizontal and vertical directions, and the calculation formula is as follows, where: Represents the horizontal gradient of the image, which is the image before Column and back The difference between the columns, Represents the vertical gradient of the image, which is the image before Line and Back The difference between the two. express The square of the norm.

[0180]

[0181] It should be noted that the gradient loss is used to maintain horizontal consistency while reducing the vertical gradient to make flicker removal more complete.

[0182] In a possible implementation, during the model training process, the loss of each label image can be calculated using the loss function formula of each part in the above steps of this embodiment.

[0183] The training method of the image processing model provided in the present embodiment calculates the stroboscopic weight matrix corresponding to the label image according to the initial stroboscopic coefficient matrix corresponding to the label image and the preset stroboscopic weight coefficient for each label image, and then when any group of label images and degraded images in the data set are used for model training, the stroboscopic stripe intensity weights of the label image and the target image are adjusted according to the stroboscopic weight matrix corresponding to the label image, and the column dimension average calculation is performed on the adjusted label image and the adjusted target image according to the physical characteristics of the stroboscopic stripes, and the stroboscopic loss part corresponding to this training is calculated according to the preset mapping relationship between the calculated label image and the calculated target image, and the stroboscopic loss function, and when any group of label images and degraded images in the data set are used for model training, the label image and the target image are calculated according to the preset cosine similarity formula to obtain the cosine similarity between the label image and the target image, and the stripe prior similarity loss part corresponding to this training is calculated according to the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe prior similarity loss function. The stroboscopic loss is calculated to guide the network restoration according to the stroboscopic intensity distribution characteristics, and the stripe prior similarity loss is used to reduce the color deflection at the stripe restoration point, keeping the color of the target image consistent with the label image, thus ensuring the accuracy of the target model.

[0184] Figure 6 A flowchart of a fourth embodiment of the training method for an image processing model provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, based on the above embodiment, the method further includes:

[0185] S601: Perform random cropping and inversion processing on each image in a pre-acquired image set to obtain a first image set.

[0186] S602: Perform downsampling processing on each image in the first image set to obtain a second image set.

[0187] S603: Perform color deflection processing on each image in the second image set to obtain a third image set.

[0188] S604: Perform brightness adjustment on each image in the third image set to obtain a label image set.

[0189] In this step, in order to accurately train the network model and obtain a target model that can accurately remove flickering stripes in the image, it is necessary to ensure the diversity of the data during the data set preparation process. Therefore, after obtaining the image set in advance, each image in the image set is randomly cropped and inverted. Specifically, first read the RGB three-channel image in the image set. , normalize the image values ​​to the distribution range of [0, 1]. Then, randomly crop each image to different sizes, with a cropping width of A random integer value in the range, with a clipping height of A random integer value in the range. are the target width and height of the pre-set dataset, respectively. are the width and height of the original data respectively. Then, a random number is obtained by uniformly sampling in the interval [0, 1] ,like Then each cropped image is horizontally flipped to obtain a randomly cropped and flipped image. .in, represents each image in the image collection, express After randomly cropping and reversing the images, the processed images are aggregated to obtain a first image set.

[0190] After obtaining the first image set, in order to reduce the computational complexity and remove redundant information, the first image set is downsampled. Specifically, the first image set is downsampled by nearest neighbor interpolation or bilinear interpolation. Image size, making the dataset image size uniform to the target width and height , get the scaled image The processed images are aggregated to obtain a second image set.

[0191] Among them, the nearest neighbor interpolation is to find the nearest pixel in the original image for each target pixel, and assign its pixel value to the target pixel. This method is simple to calculate, but may cause a mosaic effect in the image, especially at the edges and details. Bilinear interpolation uses the weighted average of the four nearest pixels around the target pixel to calculate the value of the target pixel. This method can produce smoother and more realistic images, especially when processing areas with continuous color changes. The specific implementation method of downsampling can be through nearest neighbor interpolation, bilinear interpolation, or a combination of the two. The specific implementation method is not specifically limited in this embodiment.

[0192] After obtaining the second image set, in order to further enhance the data and increase the diversity of the data, the images in the second image set may be subjected to color deflection and brightness adjustment processing.

[0193] Specifically, the scaled image in the second image set The color channel values ​​of the Representing images All pixel values ​​in the corresponding color channel. First, a random number is uniformly sampled in the interval [0, 1] , if then Keep the image color unchanged. Then the image R channel is deflected, if Then the image G channel is deflected, if Then deflect the image B channel to get the image , the processed images are aggregated to obtain a third image set. Among them, is a pre-set threshold, for example, , , , the pre-set deflection coefficient is a uniformly sampled random value in the interval [2, 3]. By color deflection, the network can be prevented from generally restoring the stripes to one or several colors commonly seen in the training data set, forcing the network to refer to the surrounding colors for restoration.

[0194] It should be noted that the above color deflection processing can be expressed by the formula:

[0195]

[0196] in, is a pre-set threshold value, with a value of [0,1]. is a uniformly sampled random number in the interval [0, 1]. is the deflection coefficient, which is a uniformly sampled random value in the interval [2, 3].

[0197] There will be uneven lighting in outdoor environments at night. The brightness of the entire image or a random local area can be adjusted gradually to simulate different light source environments. The process of adjusting the brightness of an image is to uniformly sample random numbers in the interval [0, 1]. ,like The image remains unchanged if , then multiply the image by the brightness adjustment matrix M, where M is a randomly generated gradient matrix. For example, the value range of the matrix M is [0.3, 1.2]. The images after brightness adjustment are used as label images for network training, and a set of label images is obtained.

[0198] For images Brightness adjustment can be expressed by the following formula:

[0199]

[0200] in, is a uniformly sampled random number in the interval [0,1].

[0201] The training method of the image processing model provided in this embodiment randomly crops and inverts each image in a pre-acquired image set to obtain a first image set, downsamples each image in the first image set to obtain a second image set, performs color deflection processing on each image in the second image set to obtain a third image set, and adjusts the brightness of each image in the third image set to obtain a label image set. By randomly cropping and inverting each image as described above, the diversity of data is increased, and the size of the image is reduced by downsampling, the computational complexity is reduced or redundant information is removed, and data enhancement is achieved by color deflection and brightness adjustment, which can further increase data diversity and provide a data basis for model training.

[0202] Figure 7 The flowchart of the stroboscopic processing method of the image provided in the embodiment of the present application is as follows: Figure 7 As shown, the method includes:

[0203] S701: Acquire an image to be processed.

[0204] S702: Input the image to be processed into the target model to perform flicker stripe elimination processing to obtain a target image.

[0205] In actual shooting scenes, the image captured by the camera has irregular flickering stripes of light and dark due to the frequency of the ambient light source. In order to improve the image quality, restore the image, and remove the flickering stripes, the user sends the captured image to be processed to an electronic device that can perform image restoration, and the electronic device receives the image to be processed. The electronic device receives the image to be processed by the user directly operating the electronic device through USB, cloud disk, etc., directly manipulating the control of the electronic device to upload the image to be processed, or the user uses a terminal device to transmit the image to be processed through the communication link between the terminal device and the electronic device. This embodiment does not specifically limit the specific implementation method of obtaining the image to be processed.

[0206] After acquiring the image to be processed, the image to be processed is input into the target model trained by the training method of the image processing model of each of the above embodiments for image restoration processing, thereby obtaining a target image, wherein the target image is an image of the image to be processed with flickering stripes eliminated.

[0207] The stroboscopic image processing method provided in this embodiment obtains an image to be processed, and inputs the image to be processed into a target model to perform stroboscopic stripe removal processing to obtain a target image. The stroboscopic stripes in the image are completely removed through the pre-trained target model.

[0208] Figure 8 FIG. 1 is a flowchart of a specific implementation of an exemplary image processing model training method and an image stroboscopic processing method, such as Figure 8 As shown, the method includes:

[0209] S801: original data.

[0210] In this step, in order to accurately train the network model, a large amount of data is required for model training. Therefore, the original data in the existing technology can be obtained through the data collection platform, such as the common image datasets ImageNet, CIFAR-10, etc.

[0211] S802: Dataset creation.

[0212] In order to enable the network model to better learn the ability to remove flickering stripes, a data set can be prepared based on the original data obtained in the above steps. The label image (GT) can be obtained by randomly cropping and reversing, downsampling, color deflecting, and brightness adjusting the original data, and stroboscopic addition is performed on the label image to obtain a stroboscopic image (degraded image). The specific implementation process of the above processing is the same as the specific implementation of steps S601-S604 and step S201 in the aforementioned embodiment, and will not be repeated here.

[0213] S803: Loss function.

[0214] Similarly, in order to enable the network model to better learn the ability to remove flickering stripes and have higher adaptability and generalization ability, a loss function, that is, a combined loss function, can be designed in advance, and then the model is trained. The calculation of the combined loss function during the training process is the same as the specific implementation of the aforementioned method embodiment 3, and will not be repeated here.

[0215] S804: Model training.

[0216] After obtaining the data set and the combined loss function, the network model can be trained according to the obtained data set and the combined loss function. The specific implementation process is the same as step S203 in the aforementioned embodiment and will not be repeated here.

[0217] S805: Stroboscopic image.

[0218] S806: Restore the image.

[0219] After completing the model training, the actual captured image, i.e., the stroboscopic image, can be obtained and processed by the trained model to achieve image restoration and obtain a restored image with the flickering stripes removed. The specific practice process of steps S805-S806 is the same as the specific practice process of steps S701-S702 in the aforementioned embodiment, and will not be repeated here.

[0220] For example, Fig. 9 is a schematic diagram of an exemplary stroboscopic image, Fig.10 is a schematic diagram of an exemplary stroboscopic image after stroboscopic removal processing, combined with Fig. 9 and Fig.10 It can be seen that the target model obtained through training in this application is Fig. 9 The stroboscopic image is processed in the image processing, thereby achieving accurate removal of the flickering stripes.

[0221] Fig.11 A structural diagram of a first embodiment of a training device for an image processing model provided in an embodiment of the present application, such as Fig.11 As shown, the training device 1100 of the image processing model includes:

[0222] The adding module 1101 is used to perform stroboscopic adding processing on the pre-acquired label image set to obtain a degraded image set, wherein the label image set includes multiple label images, and the degraded image set includes a degraded image after stroboscopic addition to each label image.

[0223] The combining module 1102 is used to combine each label image and the corresponding degraded image into a data pair to obtain a data set.

[0224] The training module 1103 is used to train the preset network model according to the data set and the pre-acquired combined loss function to obtain a target model, and the target model is used to eliminate the flickering stripes in the image;

[0225] Among them, the combined loss function includes a brightness consistency loss function, a stroboscopic loss function, a stripe prior similarity loss function, and a gradient loss function that are weighted according to pre-set function weights.

[0226] Optionally, during each training process, the stroboscopic loss part in the value of the combined loss function is determined based on the stroboscopic weight matrix corresponding to the label image of this training and the physical characteristics of the stroboscopic stripes.

[0227] The stripe prior similarity loss part in the value of the combined loss function is determined based on the cosine similarity between the label image of this training and the corresponding target image, and the stroboscopic weight matrix corresponding to the label image.

[0228] Fig.12 The structural diagram of the second embodiment of the training device of the image processing model provided in the embodiment of the present application is as follows: Fig.12 As shown, the adding module 1101 specifically includes:

[0229] The random generation unit 1201 is used to randomly generate a power grid frequency, a camera row sampling frequency and an initial phase for each label image in the label image set according to a preset constraint condition;

[0230] The first calculation unit 1202 is used to calculate an initial stroboscopic coefficient matrix corresponding to the label image according to a mapping relationship among a power grid frequency, a camera row sampling frequency, an initial phase and the label image;

[0231] The second calculation unit 1203 is used to calculate the target stroboscopic coefficient corresponding to the label image according to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix;

[0232] The third calculation unit 1204 is used to calculate and obtain a degraded image after adding stroboscopic image to the label image according to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image;

[0233] The aggregation unit 1205 is used to aggregate all the degraded images to obtain a degraded image set.

[0234] Fig.13 The structural diagram of the third embodiment of the training device of the image processing model provided in the embodiment of the present application is as follows: Fig.13 As shown, the training device 1100 of the image processing model further includes:

[0235] The first calculation module 1301 is used to calculate, for each label image, a stroboscopic weight matrix corresponding to the label image according to an initial stroboscopic coefficient matrix corresponding to the label image and a preset stroboscopic weight coefficient.

[0236] Optionally, the image processing model training device 1100 further includes:

[0237] The weight adjustment module 1302 is used to adjust the stroboscopic stripe intensity weights of the label image and the target image according to the stroboscopic weight matrix corresponding to the label image when using any group of label images and degraded images in the data set for model training. The target image is the image output by the label image calculated by the target model.

[0238] The second calculation module 1303 is used to perform column dimension average calculation on the adjusted label image and the adjusted target image according to the physical characteristics of the stroboscopic stripes;

[0239] The third calculation module 1304 is used to calculate the stroboscopic loss part corresponding to this training according to the preset mapping relationship between the calculated label image and the calculated target image, and the stroboscopic loss function.

[0240] In a possible implementation, the image processing model training device 1100 further includes:

[0241] The fourth calculation module 1305 is used to calculate the label image and the target image according to a preset cosine similarity formula to obtain the cosine similarity between the label image and the target image when using any set of label images and degraded images in the data set for model training.

[0242] The fifth calculation module 1306 is used to calculate the stripe priori similarity loss part corresponding to the current training according to the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe priori similarity loss function.

[0243] Fig.14 A structural diagram of a fourth embodiment of a training device for an image processing model provided in an embodiment of the present application is shown in FIG. Fig.14 As shown, the training device 1100 of the image processing model further includes:

[0244] The cropping and reversing module 1401 is used to perform random cropping and reversing processing on each image in the pre-acquired image set to obtain a first image set.

[0245] The down-sampling module 1402 is used to perform down-sampling processing on each image in the first image set to obtain a second image set.

[0246] The color deflection module 1403 is used to perform color deflection processing on each image in the second image set to obtain a third image set.

[0247] The brightness adjustment module 1404 is used to adjust the brightness of each image in the third image set to obtain a label image set.

[0248] The image processing model training device provided in each of the above embodiments is used to execute the image processing model training method in any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0249] Fig.15 This is a schematic diagram of the structure of an embodiment of a stroboscopic image processing device provided in an embodiment of the present application, such as Fig.15 As shown, the image stroboscopic processing device 1500 includes:

[0250] The acquisition module 1501 is used to acquire the image to be processed, where the image to be processed includes flickering stripes.

[0251] The elimination processing module 1502 is used to input the image to be processed into the target model to perform flicker stripe elimination processing to obtain the target image;

[0252] The target model is obtained by training using the image processing model training method in any of the aforementioned method embodiments.

[0253] The image stroboscopic processing device provided in each of the above embodiments is used to execute the image stroboscopic processing method in any of the above method embodiments. Its implementation principle and technical effect are similar and will not be described in detail here.

[0254] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.16 As shown, the electronic device 1600 includes: a processor 1602, and a memory 1601 communicatively connected to the processor 1602;

[0255] The memory 1601 stores computer executable instructions;

[0256] The processor 1602 executes the computer-executable instructions stored in the memory 1601 to implement the training method of the image processing model in any method embodiment and the stroboscopic processing method of the image in any method embodiment.

[0257] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to execute the methods provided in the various embodiments described above.

[0258] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0259] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0260] An embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution provided by any of the above method embodiments can be implemented.

[0261] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0262] It is to be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. In the embodiments of the present application, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0263] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0264] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A training method for an image processing model, characterized in that: include: For each labeled image in the labeled image set, the power grid frequency, camera row sampling frequency and initial phase are randomly generated according to the pre-set constraints; According to the mapping relationship between the grid frequency, the camera row sampling frequency, the initial phase and the label image, an initial stroboscopic coefficient matrix corresponding to the label image is calculated; Calculate the target stroboscopic coefficient corresponding to the label image according to the mapping relationship between the flicker intensity of each color channel corresponding to the randomly generated label image and the initial stroboscopic coefficient matrix; According to the mapping relationship between the target stroboscopic coefficient, the label image and the corresponding degraded image, a degraded image after adding stroboscopic to the label image is calculated; Aggregating all degraded images to obtain a degraded image set, wherein the label image set includes a plurality of label images, and the degraded image set includes a degraded image after stroboscopic light is added to each label image; Combine each label image and the corresponding degraded image into a data pair to obtain a data set; According to the data set and the pre-acquired combined loss function, a preset network model is trained to obtain a target model, wherein the target model is used to eliminate flickering stripes in the image; The combined loss function includes a brightness consistency loss function, a stroboscopic loss function, a stripe prior similarity loss function, and a gradient loss function, which are weighted according to a preset function weight.

2. The method according to claim 1, characterized in that: In each training process, the stroboscopic loss part of the value of the combined loss function is determined based on the stroboscopic weight matrix corresponding to the label image of this training and the physical characteristics of the stroboscopic stripes; The stripe prior similarity loss part in the value of the combined loss function is determined based on the cosine similarity between the label image of this training and the corresponding target image, and the stroboscopic weight matrix corresponding to the label image.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: For each label image, a stroboscopic weight matrix corresponding to the label image is calculated based on the initial stroboscopic coefficient matrix corresponding to the label image and a preset stroboscopic weight coefficient.

4. The method according to claim 3, characterized in that The method further comprises: When any set of label images and degraded images in the data set is used for model training, the stroboscopic fringe intensity weights of the label images and the target image are adjusted according to the stroboscopic weight matrix corresponding to the label image, and the target image is the image output by the label image after calculation by the target model; According to the physical characteristics of the stroboscopic stripes, a column dimension average calculation is performed on the adjusted label image and the adjusted target image; According to the preset mapping relationship between the calculated label image and the calculated target image, and the stroboscopic loss function, the stroboscopic loss part corresponding to this training is calculated.

5. The method according to claim 3, characterized in that: The method further comprises: When any set of labeled images and degraded images in the data set is used for model training, the labeled images and the target images are calculated according to a preset cosine similarity formula to obtain the cosine similarity between the labeled images and the target images; The stripe priori similarity loss part corresponding to this training is calculated based on the cosine similarity, the stroboscopic weight matrix corresponding to the label image, and the stripe priori similarity loss function.

6. The method according to claim 1, characterized in that The method further comprises: Performing random cropping and inversion processing on each image in the pre-acquired image set to obtain a first image set; Performing downsampling processing on each image in the first image set to obtain a second image set; Performing color deflection processing on each image in the second image set to obtain a third image set; The brightness of each image in the third image set is adjusted to obtain the label image set.

7. A method for stroboscopic processing of an image, characterized in that: include: Acquire an image to be processed, wherein the image to be processed includes flickering stripes; Inputting the image to be processed into the target model to perform flicker stripe elimination processing to obtain a target image; Wherein, the target model is obtained by training using the image processing model training method described in any one of claims 1 to 6.

8. An electronic device, characterized in that: include: A processor, a memory and a display connected in communication with the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the training method of the image processing model as described in any one of claims 1 to 6 and the stroboscopic processing method of the image as described in claim 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.