Video rain and snow removal method based on explicit optical flow alignment and fusion
Through explicit optical flow alignment and fusion technology, optical flow motion information and multi-frame fusion are used to extract inter-frame timing and intra-frame spatial information in the video, which solves the problem of poor rain and snow removal in the existing technology and achieves a better Effective video removal of rain and snow and real-time processing capabilities.
Patent Information
- Application Number
- CN202111096445.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-07-30
- Filing Date
- 2021-09-17
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-17
AI Technical Summary
Existing video rain and snow removal methods ignore the relationship between rain and snow and the background texture of the video image, resulting in poor removal results. Furthermore, neural network-based methods require a large amount of data training and are difficult to process video streams in real time.
Using a method based on explicit optical flow alignment and fusion, through the data preprocessing, explicit optical flow calculation, multi-frame fusion and objective function optimization steps of the training part, optical flow motion information and multi-frame fusion are used to extract inter-frame temporal motion and frame Internal spatial position information is used to locate and remove rain and snow textures.
It achieves more effective rain and snow texture positioning and removal, improves the effect of video rain and snow removal, is suitable for video application scenarios such as slow live broadcast, and ensures real-time processing and recognition accuracy.
Smart Images

Figure CN113781353B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of video processing, and in particular relates to a video rain and snow removal method based on explicit optical flow alignment and fusion. Background Art
[0002] In real life, because rain and snow will cause a certain degree of obstruction on the road conditions, driving a vehicle in bad weather with heavy rain or snow is very dangerous; removing the obstruction caused by rain and snow during slow live broadcast will cause poor viewing effect and interfere with the application scenario of object recognition. The above situations require post-production rain and snow removal processing of the video.
[0003] At present, most of the research on video rain and snow removal is based on model-driven methods, which treat rain and snow as noise components and separate them using low-rank sparse decomposition algorithms, or filter them from the frequency domain perspective to achieve the purpose of rain and snow removal. This type of method ignores the relationship between rain and snow and the background texture of the video image, and will more or less remove the texture details of the rain-free area, resulting in poor removal effect.
[0004] There is also a data-driven method that uses a neural network model and combines it with a large amount of data for training. The disadvantage of this method is that it requires a large amount of paired data, and real sample data is difficult to obtain and the acquisition method is cumbersome. If synthetic rain and snow are used to expand the data, the distribution of synthetic samples will be different from that of real samples, resulting in poor training generalization effect. At the same time, this type of method is difficult to process video streams in real time. Summary of the invention
[0005] In view of the above problems, the present invention provides a video rain and snow removal method based on explicit optical flow alignment and fusion, which is used to solve the problem of rain and snow blocking the picture and affecting the viewing effect in video application scenarios such as slow live broadcast.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] A first aspect of the present invention provides a video rain and snow removal method based on explicit optical flow alignment and fusion, comprising:
[0008] The training part includes data preprocessing, display optical flow calculation, multi-frame fusion and objective function optimization steps, and the reasoning part includes video preprocessing, model reasoning and video synthesis steps;
[0009] The data preprocessing is used to process the video frames and obtain training sample pairs, and the training sample pairs are submitted to explicit optical flow calculation and objective function optimization processing;
[0010] The explicit optical flow calculation first calculates the optical flow motion information of the input current frame and the left and right adjacent frames, then calculates the estimated frame of the current frame based on the optical flow motion information, and finally transmits the estimated frame and the current frame to the multi-frame fusion at the same time;
[0011] Multi-frame fusion is used to guide the positioning and removal of rain and snow textures in the current frame based on the spatial relative motion information obtained by explicit optical flow estimation, and the fused prediction frame is submitted to the objective function optimization for parameter update;
[0012] Objective function optimization is used to optimize the loss function between the multi-frame fusion output image and the reference image provided by data preprocessing by gradient descent method for model training;
[0013] Video preprocessing is used to process the input video sequence of a rainy and snowy scene into several groups of image sequences for model reasoning and video synthesis;
[0014] Model inference is based on the explicit optical flow calculation and multi-frame fusion steps of the training part, and the predicted output frame is calculated based on the input current frame and the left and right adjacent frames of the current frame;
[0015] Video synthesis is used to synthesize the predicted output frames and save them in the form of a generated video.
[0016] Preferably, the training part further includes a visualization and adjustment step, and the visualization and adjustment are used to standardize the image sequence output by the multi-frame fusion step and the hyperparameters generated in the training part by the objective function optimization, and perform visualization and adjustment operations.
[0017] Preferably, the sample pair includes a continuous frame sequence in a rainy and snowy scene and a corresponding reference frame in a normal scene, the continuous frame sequence in the rainy and snowy scene includes a current frame to be processed, a left adjacent frame of the current frame and a right adjacent frame of the previous frame, and the corresponding reference frame in the normal scene is the processed current frame.
[0018] Preferably, for a static scene, the video sequences of the rainy and snowy scene and the normal scene in the sample pair are obtained by shooting the same scene in rainy and snowy weather and clear weather of the same duration at the same location using the same camera equipment at the same time period to obtain the sample sequence.
[0019] Preferably, the video sequence of the rain and snow scene in the sample pair is a video sequence of the rain and snow scene simulated by a synthesis method.
[0020] Preferably, the optical flow motion information calculation process is as follows: an estimated frame is obtained through a number of sequentially arranged sampling, affine transformation and optical flow estimation.
[0021] Preferably, the multi-frame fusion includes multiple convolution layers and ReLU activation layers with different convolution kernel sizes.
[0022] Preferably, each group of image sequences consists of a total of three frames, namely, a current frame and its left and right adjacent frames.
[0023] Yet another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of any of the above-described methods are implemented.
[0024] The present invention has the following beneficial effects:
[0025] (1) In explicit optical flow estimation, the optical flow information between the current frame and the left and right adjacent frames is used to perform an affine transformation on the current frame, fully obtaining the prediction information of the current frame from the perspective of the adjacent frames, thereby extracting the temporal motion information between frames;
[0026] (2) Multiple convolutional layers with different kernel sizes are used in multi-frame fusion, which provides feature information of different receptive fields of view in space, thereby extracting spatial position information within the frame;
[0027] (3) The extraction of inter-frame temporal motion information and intra-frame spatial position information can be integrated to better locate and remove rain and snow textures;
[0028] (4) The technical solution provided by the present invention solves the problem of rain and snow blocking the screen in video application scenarios such as slow live broadcast, affecting the viewing effect, and the problem of reduced recognition accuracy due to interference from rain and snow in real-life recognition scenarios of faces or other objects. The rain and snow blocking in the video can be automatically and real-time removed to restore a clear video scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flowchart of a video rain and snow removal method based on explicit optical flow alignment and fusion according to an embodiment of the present invention;
[0030] Figure 2 is a flowchart of explicit optical flow calculation in an embodiment of the present invention;
[0031] Figure 3 This is a real snow scene picture in a specific application example;
[0032] Figure 4 This is a picture showing the effect of the video after being processed by the video rain and snow removal method based on explicit optical flow alignment and fusion according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] Example 1
[0035] Reference Figure 1 , shown is a flow chart of a video rain and snow removal method based on explicit optical flow alignment and fusion according to an embodiment of the present invention, including a training part and a reasoning part, wherein the training part further includes data preprocessing, explicit optical flow calculation, multi-frame fusion and objective function optimization steps, and the reasoning part further includes video preprocessing, model reasoning and video synthesis steps. The training part includes data preprocessing, display optical flow calculation, multi-frame fusion and objective function optimization steps, and the reasoning part includes video preprocessing, model reasoning and video synthesis steps; the data preprocessing is used to process video frames and obtain training sample pairs, and the training sample pairs are handed over to explicit optical flow calculation and objective function optimization processing; the explicit optical flow calculation first calculates the optical flow motion information of the input current frame and the left and right adjacent frames, and then calculates the estimated frame of the current frame from the optical flow motion information, and finally the estimated frame is obtained. The counting frame and the current frame are passed to multi-frame fusion at the same time; multi-frame fusion is used to guide the positioning and removal of rain and snow texture in the current frame according to the spatial relative motion information obtained by explicit optical flow estimation, and the fused prediction frame is handed over to the objective function optimization for parameter update; the objective function optimization is used to optimize the loss function between the image output by multi-frame fusion and the reference image provided by data preprocessing by gradient descent method for model training; video preprocessing is used to process the input video sequence of a rain and snow scene into several groups of image sequences, which are provided to model reasoning and video synthesis; model reasoning is based on the explicit optical flow calculation and multi-frame fusion steps of the training part, and calculates the predicted output frame according to the input current frame and the left and right adjacent frames of the current frame; video synthesis is used to synthesize the predicted output frame and save it in video form.
[0036] Example 2
[0037] On the basis of Example 1, the video rain and snow removal method based on explicit optical flow alignment and fusion in the embodiment of the present invention further includes a visualization and adjustment step, and the visualization and adjustment are used to standardize the image sequence output by the multi-frame fusion step and the hyperparameters generated in the training part of the objective function optimization, and perform visualization and adjustment operations.
[0038] In the specific application example, for the data preprocessing step, the image sequence to be trained is processed into a training sample pair suitable for the model. The sample pair consists of a continuous frame sequence X in a rainy and snowy scene. <x t0, x t1 , x t2 > and the corresponding reference frame Y=y in the normal scene t1 Composition, where x t1 Indicates the current frame to be processed, x t0 Indicates the left adjacent frame of the current frame, x t2 Indicates the right adjacent frame of the current frame, y t1 Represents the current frame after processing.
[0039] There are many ways to obtain video sequences of rainy and snowy scenes and normal scenes in sample pairs. One is to use the same camera equipment to shoot the same scene of rainy and snowy weather and sunny weather of the same length at the same location at the same time to obtain the sample sequence. This method is only suitable for static scenes. The other is to use synthesis to simulate rainy and snowy scenes. This method is suitable for most scenes.
[0040] In the specific application example, for explicit optical flow calculation, the input sequence X in this step is <x t0 , x t1 , x t2 >, it needs to be calculated twice based on the left and right adjacent frames, <x t0 , x t1 >For example, we need to calculate the estimated frame W of the current frame t0→t1 =Flow1(x t0 , x t1 ), where Flow1(.) includes affine transformation Warp, optical flow estimation FlowBlock and sampling Resize, optical flow information F b It is calculated by the optical flow estimation FlowBlock. The parameter b is related to the number of optical flow estimation FlowBlock, 1<b≤λ, λ is the number of optical flow estimation FlowBlock, λ>1, and the calculation formula is,
[0041]
[0042] F b The calculation process is as follows,
[0043]
[0044] The final output estimated frame is W t0→t1 ,
[0045] W t0→t1 =Resize(Warp(x t0 , F λ )).
[0046] like Figure 2 The following is the structural flow chart of step Flow1(.) when λ=3. The input sequence <xt0 , x t1 >After 1 / 2 times sampling, the optical flow information F is first calculated by the optical flow estimation FlowBlock 1 , and then with F 1 Calculated together through affine transformation Warp and Then with and Together with the next optical flow estimate, we get F 2 According to the above calculation formula, we can finally get Figure 2 The estimated frame W in t0→t1 , completing the calculation process of step Flow1(.).
[0047] for <x t1 , x t2 >The estimated frame W t2→t1 The calculation process Flow2 is similar to the calculation process of the above step Flow1, the only difference is the last step w t2→t1 =Flow2(x t1 , x t2 )=Resize(Warp(x t2 , -F λ )).
[0048] In the specific application example, for multi-frame fusion, the frames are estimated based on the explicit optical flow. <W t0→t1 , W t2→t1 > and the current frame x t1 The feature texture matching relationship is used to locate and remove the rain and snow area. The fusion step consists of multiple convolution layers with different convolution kernel sizes and ReLU activation layers. The convolution layer is a filter used to extract image features, and the ReLU activation layer is a nonlinear function that improves the fitting ability of the model. The activation function is expressed as:
[0049] ReLU(z)=max(0,z)
[0050] The overall logic of multi-frame fusion can be expressed as:
[0051]
[0052] The fused prediction frame Submit it to the objective function optimization step for parameter update.
[0053] In the specific application example, for the objective function optimization step, the prediction sequence The reference sequence Y=y corresponding to the normal scene t1 The reconstruction loss function between As the objective function, the optimal parameters θ of the optical flow estimation FlowBlock and multi-frame fusion Fusion that can minimize the objective function are found through the gradient descent method.
[0054]
[0055]
[0056] In the specific application example, for the visualization and adjustment steps, the data output by multi-frame fusion is Save it in the form of a picture to facilitate visualization and statistical analysis of some hyperparameters in the training part, such as the training learning rate, the number of training iterations, the number of sequences used in each training, batch_size, etc. According to these hyperparameters, the training progress and direction can be adjusted to facilitate control of the training part.
[0057] In the specific application example, the video preprocessing step is responsible for converting the video sequence to be processed into an image sequence in combination with the scene switching, and then generating the input sequence X' in each scene in turn according to the model requirements.
[0058] X′= <x′ t-1 , x′ t , x′ t+1 >(1 <t<n)
[0059] Where n is the number of frames in each scene, starting from the second frame, each sequence consists of the current frame x′ t Its left and right adjacent frames <x′ t-1 , x′ t+1 >It consists of three frames in total and is processed by the model inference module.
[0060] In the specific application example, for the model inference step, this step consists of explicit optical flow calculation and multi-frame fusion, receiving the sequence from the preprocessing module <x′ t-1 , x′ t , x′ t+1 >, process to get the predicted frame
[0061] W′ t-1→t =Flow1(x′ t-1 , x′ t )
[0062] W′ t+1→t =Flow2(x′ t , x′ t+1 )
[0063]
[0064] In a specific application example, for the video synthesis step, this step converts the processed frame sequence into Resynthesize the video in timestamp order to complete the entire task process.
[0065] The effect of the video rain and snow removal method based on explicit optical flow alignment and fusion in the above embodiment is as follows: Figure 3 and Figure 4 As shown, Figure 3 This is a real snow scene picture. Figure 4 This is the effect picture after processing.
[0066] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the video rain and snow removal method based on explicit optical flow alignment and fusion in any of the above embodiments are implemented.
[0067] The computer program may be stored in a non-volatile computer-readable storage medium, and when the computer program is executed, it may include the process of the embodiments of the above methods. Among them, any reference to memory, storage, database or other medium used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0068] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0069] It should be understood that the exemplary embodiments described herein are illustrative rather than restrictive. Although one or more embodiments of the present invention have been described in conjunction with the accompanying drawings, it should be understood by those skilled in the art that various changes in form and detail may be made without departing from the spirit and scope of the present invention as defined by the appended claims.
Claims
1. A video rain and snow removal method based on explicit optical flow alignment and fusion, It is characterized in that include: The training part includes data preprocessing, display optical flow calculation, multi-frame fusion and objective function optimization steps, and the reasoning part includes video preprocessing, model reasoning and video synthesis steps; The data preprocessing is used to process the video frames and obtain training sample pairs, and the training sample pairs are submitted to explicit optical flow calculation and objective function optimization processing; The explicit optical flow calculation first calculates the optical flow motion information of the input current frame and the left and right adjacent frames, then calculates the estimated frame of the current frame based on the optical flow motion information, and finally transmits the estimated frame and the current frame to the multi-frame fusion at the same time; Multi-frame fusion is used to guide the positioning and removal of rain and snow textures in the current frame based on the spatial relative motion information obtained by explicit optical flow estimation, and the fused prediction frame is submitted to the objective function optimization for parameter update; Objective function optimization is used to optimize the loss function between the multi-frame fusion output image and the reference image provided by data preprocessing by gradient descent method for model training; Video preprocessing is used to process the input video sequence of a rainy and snowy scene into several groups of image sequences for model reasoning and video synthesis; Model inference is based on the explicit optical flow calculation and multi-frame fusion steps of the training part, and the predicted output frame is calculated based on the input current frame and the left and right adjacent frames of the current frame; Video synthesis is used to synthesize the predicted output frames and save them in the form of a generated video.
2. The video rain and snow removal method based on explicit optical flow alignment and fusion as claimed in claim 1, It is characterized in that The training part further includes visualization and adjustment steps, which are used to standardize the image sequence output by the multi-frame fusion step and the hyperparameters generated in the training part by the objective function optimization, and perform visualization and adjustment operations.
3. The video rain and snow removal method based on explicit optical flow alignment and fusion as claimed in claim 1 or 2, It is characterized in that The sample pair includes a continuous frame sequence in a rainy and snowy scene and a corresponding reference frame in a normal scene. The continuous frame sequence in the rainy and snowy scene includes a current frame to be processed, a left adjacent frame of the current frame and a right adjacent frame of the previous frame. The corresponding reference frame in the normal scene is the processed current frame.
4. The video snow removal method based on explicit optical flow alignment and fusion as claimed in claim 3, It is characterized in that For still scenes, the video sequences of rainy and snowy scenes and normal scenes in the sample pairs are obtained by shooting the same scene in rainy and snowy weather and sunny weather of the same duration at the same location using the same camera equipment at the same time period to obtain the sample sequences.
5. The video snow removal method based on explicit optical flow alignment and fusion as claimed in claim 3, It is characterized in that The video sequences of rainy and snowy scenes in the sample pair are simulated by synthesis.
6. The video rain and snow removal method based on explicit optical flow alignment and fusion as claimed in claim 1 or 2, It is characterized in that The optical flow motion information calculation process is as follows: an estimated frame is obtained through a number of sequentially arranged sampling, affine transformation and optical flow estimation.
7. The video rain and snow removal method based on explicit optical flow alignment and fusion as claimed in claim 1 or 2, It is characterized in that Multi-frame fusion includes multiple convolutional layers with different kernel sizes and ReLU activation layers.
8. The video rain and snow removal method based on explicit optical flow alignment and fusion as claimed in claim 1 or 2, It is characterized in that Each set of image sequences consists of a total of three frames: the current frame and its left and right adjacent frames.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Fuzzy video detection method integrating optical flow algorithm and deep learning
CN111476314A
Video rain removing method and device based on bidirectional time domain consistency
CN112634178A
Method and system for generating multidimensional maps of a scene using a plurality of sensors of various types
US20180232947A1
Video synthesis method, model training method, device, and storage medium
US20210243383A1
