Optical flow estimation method and system based on uncertainty guided decoupling propagation and adaptive sampling
Through the optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling, the problem of high computational cost of existing optical flow models in complex situations is solved, a balance between optical flow accuracy and cost is achieved, and improved Improves the computational efficiency and accuracy of optical flow estimation.
Patent Information
- Application Number
- CN202410722477.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-10-01
AI Technical Summary
When existing optical flow models deal with complex situations such as fast movement of objects, occlusion, blur, and unclear textures, the calculation cost is high and it is difficult to achieve a balance between accuracy and cost, resulting in a gap between the accuracy of lightweight models and traditional models. , and research has not yet paid sufficient attention to how to reduce computational costs while maintaining good accuracy.
An optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling is used to obtain image enhancement feature data, build a matching distribution matrix and local correlation features, divide effective and ineffective optical flow areas, and conduct decoupled propagation and dynamics. Adaptive sampling reduces the number of iterations and calculations, achieving a balance between optical flow accuracy and cost.
It effectively reduces the computational requirements of the optical flow estimation task, reduces the calculation amount of the model, improves the accuracy of optical flow prediction within a limited number of iterations, provides a reliable optimization direction, reduces the optical flow optimization of outliers, and reduces to calculate the cost.
Smart Images

Figure CN118735965A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision processing, and in particular, relates to an optical flow estimation method and system based on uncertainty-guided decoupled propagation and adaptive sampling. Background Art
[0002] Optical flow estimation is a basic task in computer vision, which obtains the motion information of images by finding matching pixels between two frames. However, the performance of previous optical flow models in dealing with complex situations such as fast-moving objects, occlusion, blur, and unclear textures still needs to be improved.
[0003] At present, optical flow has been widely used in various real-world scenarios represented by video editing, key point tracking, real-time positioning and map construction. In real-time scenarios, the model needs to have efficient computing performance to ensure real-time response, which means that while pursuing the model to estimate high-precision optical flow, it is necessary to take into account the control of its computational amount to achieve an effective balance between accuracy and computational cost. However, existing optical flow models usually use a large number of reference point query iteration operations, resulting in expensive computational costs, which greatly limits its application in real-world scenarios. Compared with traditional optical flow models with excellent performance, lightweight optical flow models have received relatively less attention, so there is a significant gap in accuracy between lightweight models and traditional models.
[0004] This phenomenon reflects the current lack of research on the balance between optical flow model design and computational cost control. Although high-precision optical flow estimation is crucial in some application scenarios, the demand for lightweight models is equally urgent when computing resources are limited. Current research trends tend to pursue high model accuracy, while the issue of how to reduce computational costs while maintaining good accuracy has not received sufficient attention. Therefore, it is necessary to explore how to find a balance between accuracy and computational cost to meet the needs of different optical flow application scenarios.
[0005] Patent document CN118037773A discloses a target tracking method based on deep optical flow, including: processing a video to obtain an image sequence; the image sequence includes multiple frame images; determining an initial target frame of the tracking target, and determining multiple tracking points and their initial positions based on the initial target frame; inputting the image sequence and the initial position into a deep optical flow model, and the deep optical flow model outputs the tracking state and tracking position of the tracking point in the frame image; and tracking the tracking target in the video according to the tracking position.
[0006] Patent document CN117058219A discloses a video flow measurement method based on an improved recursive full-field transform optical flow model, which obtains a river video and performs frame cutting processing to obtain a video frame; calculates a transformation matrix based on the river video and pre-acquired survey results, transforms the on-map coordinates of each speed measurement point in the river video in each video frame into a world coordinate through the transformation matrix, and obtains the cross-sectional area between each speed measurement point; inputs the video frame into a trained improved recursive full-field transform optical flow model, and outputs the pixel displacement between two adjacent frames of each speed measurement point; and calculates the surface flow velocity of the river based on the pixel displacement, the world coordinate and the cross-sectional area. Summary of the invention
[0007] The purpose of the present invention is to provide an optical flow estimation method and system based on uncertainty-guided decoupled propagation and adaptive sampling, which can reduce the computational requirements of the optical flow estimation task, thereby achieving an effective balance between optical flow accuracy and task cost.
[0008] In order to achieve the first object of the present invention, the following technical solution is provided: an optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling, comprising the following steps:
[0009] Obtain original video data and perform feature extraction based on every two frames of images to obtain a corresponding image enhancement feature data set;
[0010] Based on the self-attention mechanism operation, dense correlation features between image enhancement feature data are obtained, and a corresponding matching distribution matrix is constructed through the dense correlation features, and the original optical flow between every two frames of images is obtained using the matching distribution matrix;
[0011] According to the dense correlation features between the image enhancement feature data, the corresponding local correlation features are obtained through multi-layer pooling processing;
[0012] Generate uncertainty based on the original optical flow, the local correlation feature, the context feature, and the distortion error, and divide the original optical flow into a valid optical flow area and an invalid optical flow area based on the uncertainty;
[0013] Decoupled propagation is performed according to the divided valid optical flow area and invalid optical flow area to update the corresponding local correlation features and context features to update the corresponding optical flow;
[0014] The uncertainty of the updated optical flow is used to dynamically and adaptively sample the local correlation features to further update the optical flow until the iteration termination condition is met and the best refined optical flow result is output.
[0015] The present invention uses uncertainty to perform reliable initialization division on the global scale, reduces the interference of unreliable estimation by decoupling the propagation module, and performs adaptive sampling iterative optimization based on uncertainty, thereby achieving an effective balance between optical flow accuracy and computational cost.
[0016] Specifically, bilinear interpolation is used to sample RGB data in two frames of images to obtain image feature data, and the image feature data is input into a feature enhancement network for data enhancement to obtain image enhanced feature data.
[0017] Specifically, the expression of the image enhancement feature data is as follows:
[0018]
[0019] Among them, Γ represents the feature enhancement network, P represents the position encoding, and Represents image feature data.
[0020] Specifically, the dense correlation feature is obtained through the self-attention mechanism operation, and its expression is as follows:
[0021]
[0022] in, Represents image enhancement feature data, H represents image height, W represents image width, and D represents the number of feature channels of F1 and F2.
[0023] Specifically, the matching distribution matrix is obtained by calculating the normalized exponential function of the dense correlation features in the latter two dimensions.
[0024] Specifically, the distortion error is obtained by calculating the difference between the target frame image projected to the reference frame view angle and the reference frame image, and its expression is as follows:
[0025]
[0026] Among them, I1(x) refers to the bilinear interpolation downsampling of the reference frame image The RGB result at coordinate x, The target frame Image Coordinates The RGB result projected to the reference frame view coordinate x, Represents the optical flow of the current coordinate x.
[0027] Specifically, the decoupled propagation includes using image enhancement feature data to perform cross-attention mechanism and self-attention mechanism calculations, and the specific process is as follows:
[0028] Use the cross-attention mechanism to propagate the valid optical flow to the invalid area for update;
[0029] The self-attention mechanism is used to update the optical flow of the invalid area and the optical flow of the valid area respectively.
[0030] Specifically, the iterative update sets an adaptive sampling step size with a given search radius, and sets the center coordinate as uncertainty for local sampling, which is expressed as follows:
[0031]
[0032] Where r represents the search radius, x represents the uncertainty of the input, represents the optical flow of the current coordinate x, and μ represents the scale parameter.
[0033] Specifically, the expression of the scale parameter is as follows:
[0034]
[0035] in, Refers to the uncertainty of the current coordinate x, which can be calculated by the following formula:
[0036]
[0037] Here CNN represents the convolution operation.
[0038] Specifically, the context feature is obtained by performing a convolution operation on a reference frame image in two frames of images.
[0039] In order to achieve the second objective of the present invention, the following technical solutions are provided: an optical flow estimation system, implemented by the above-mentioned optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling, comprising a data enhancement module, a global matching module, a decoupled propagation module and an adaptive sampling iterative optimization module;
[0040] The data enhancement module is used to extract image enhancement feature data from the input video data;
[0041] The global matching module is used to generate corresponding dense related features according to the extracted image enhancement feature data, and generate the original optical flow of the input video data based on the dense related features;
[0042] The decoupled propagation module is used to generate uncertainty according to the original optical flow, the local similarity feature, the context feature and the distortion error;
[0043] The adaptive sampling iterative optimization module is used to adaptively sample local similarity features from dense related features, and generate new uncertainties based on the updated local similarity features through a decoupled propagation module until the iteration termination condition is met to output the final uncertainty, and generate the best refined optical flow result based on the final uncertainty.
[0044] Specifically, the data enhancement module includes a lightweight backbone network and a feature enhancement network built based on EfficientVit.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] Based on the uncertainty obtained from the original optical flow data, the optical flow area is divided, and the original optical flow is decoupled and refined and propagated between the valid and invalid areas, within the valid area, and within the invalid area, respectively, to provide an optical flow optimization value that reduces outliers for the subsequent iterative optimization module, giving a reliable optimization direction, thereby reducing the number of iterative optimizations and effectively reducing the amount of calculation of the model;
[0047] The number of sampling points is reduced based on uncertainty, and the search area of the sampled dense correlation features is dynamically adjusted. While reducing the amount of model calculation, more effective adaptive local similarity features are provided for iterative optimization, and more accurate optical flow prediction results are obtained within a limited number of iterations. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flowchart of an optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling provided in this embodiment;
[0049] Figure 2 A schematic diagram of the structure of the data enhancement module provided in this embodiment;
[0050] Figure 3 A schematic diagram of the structure of the global matching module provided in this embodiment;
[0051] Figure 4 A schematic diagram of the structure of the decoupled propagation module provided in this embodiment;
[0052] Figure 5 A schematic diagram of the structure of the adaptive sampling iterative optimization module provided in this embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0054] like Figure 1 As shown in FIG. 1 , the optical flow estimation method provided in this embodiment has the following specific process:
[0055] First, receive two frames and obtain them through bilinear interpolation The RGB data of the original image resolution is extracted from the two frames of RGB data through the weight-sharing lightweight backbone network EfficientVit to obtain image feature data Here {H, W} represents the height and width of the original resolution of the image. After adding the position code P to the image feature data, it is passed into the feature enhancement network to obtain Image enhancement feature data at original resolution The calculation is as follows:
[0056]
[0057] Here, Γ represents the feature enhancement network and P represents the positional encoding.
[0058] Enhance image features Perform matrix multiplication to obtain the dense correlation feature C of the feature graph. The calculation process is as follows:
[0059]
[0060] Here, D represents the number of feature channels. Next, the matching distribution matrix is obtained by calculating the normalized exponential function of the dense correlation feature C of the feature graph in the last two dimensions: And calculate the corresponding coordinate system of the target frame image based on the matching distribution matrix S Right now Here G refers to the coordinate system corresponding to the reference frame image, from which the original optical flow can be obtained
[0061]
[0062] Although global propagation is initialized very quickly, interference introduced by objects moving quickly, occlusion, blur, and unclear textures will mislead the further refinement of subsequent optical flows and require more iterative optimization times to correct, wasting a lot of computing resources. In order to alleviate this interference and effectively control the amount of model calculation, the initialized optical flow is divided into valid and invalid areas according to the uncertainty of the prediction.
[0063] Referring to RAFT, a 4D pyramid correlation feature {C1, C2, C3, C4} is constructed for the feature map correlation feature C through multi-layer pooling, and the local correlation feature is obtained by searching the pyramid correlation feature according to the estimated optical flow.
[0064] Contextual feature F context (x) is obtained by performing a convolution operation on the reference frame image, namely:
[0065] F context (x) = CNN(I1(x))
[0066] The CNN here represents the convolution operation.
[0067] Distortion error E RGB (x) is obtained by calculating the difference between the target frame image projected to the reference frame view and the reference frame image. The specific calculation process is as follows:
[0068]
[0069] Here I1(x) refers to the bilinear interpolation downsampling of the reference frame image The RGB result at coordinate x, The target frame Image Coordinates The RGB result projected to the reference frame view coordinate x.
[0070] The original optical flow, local correlation features, context features and distortion error are taken as input, and the original optical flow is transformed according to the preset effective threshold α. Divide into effective optical flow and invalid optical flow Here, the image enhancement feature F1 is used to perform cross-attention and self-attention calculations to further decouple the optical flow. Since the optical flow in the invalid area is considered inaccurate, the cross-attention mechanism is needed to propagate the valid optical flow to the invalid area for update. The specific update process is as follows:
[0071]
[0072] here, Refers to the enhanced features of the invalid area, Refers to the enhanced characteristics of the effective area.
[0073] Then, the self-attention mechanism is used to update the optical flow of the invalid area and the optical flow of the valid area respectively, and the expressions are as follows:
[0074]
[0075] After decoupling the propagation of the original optical flow, a reliable motion trend can be obtained, which provides a clear optimization direction for subsequent operations, effectively reduces the number of iterations, and reduces the computational complexity of the model.
[0076] Since we want to reduce the amount of model calculation while ensuring the accuracy of optical flow, we reduce the amount of calculation by reducing the number of sampling points of the global correlation feature of the search pyramid and the number of update iterations. Given a search radius r, a constant sampling step can be obtained, and the local sampling grid centered at coordinate x is defined as:
[0077]
[0078] Due to the reduction in the number of sampling points, the model receptive field will be constrained, limiting the performance of the model in situations such as large displacement, occlusion, and low texture. The refined optical flow generated in the previous step is used to estimate the new uncertainty To dynamically adjust the sampling area. The uncertainty centered on coordinate x guides the local sampling area to be modified as follows:
[0079]
[0080] Here μ is Refers to the uncertainty of the current coordinate x, which can be calculated by the following formula:
[0081]
[0082] Here CNN represents the convolution operation.
[0083] Since the number of sampling points is defined as (2×r+1) 2 The sampling interval increases as the uncertainty decreases. The uncertainty-guided sampling strategy helps to expand the receptive field of low-uncertainty areas, thereby obtaining rich context and motion features. Since the use of this dynamic sampling strategy on the first two scales C1 and C2 may affect fine-grained features, dynamic sampling is only performed on the last two scales C3 and C4. Finally, the adaptive local correlation features, context features, and optical flow obtained by dynamic sampling are coupled to the optimization module for iterative refinement to obtain the final optical flow result.
[0084] This embodiment also provides an optical flow estimation system, which is implemented by the optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling provided in the above embodiment, including a data enhancement module, a global matching module, a decoupled propagation module and an adaptive sampling iterative optimization module.
[0085] More geomorphic, such as Figure 2 As shown, image enhancement feature data is obtained through the data enhancement module.
[0086] like Figure 3 As shown in Figure 1, the correlation characteristics between the original optical flow prediction results and the feature map are obtained through the global matching module.
[0087] like Figure 4 As shown in the figure, the refined optical flow is obtained through the decoupled propagation module, and the decoupled propagation module also includes an uncertainty prediction module, which is composed of a shallow convolutional network plus a sigmoid function, and its input is the current original optical flow, local correlation features, context features and distortion error input.
[0088] like Figure 5 As shown in the figure, the final optical flow result is obtained through the adaptive sampling iterative optimization module. Since the iterative optimization module needs to accept local correlation features, and the local correlation features are obtained by sampling the global correlation features of the pyramid, in order to reduce the amount of model calculation while ensuring the accuracy of the optical flow, the amount of calculation is reduced by reducing the number of sampling points of the global correlation features of the search pyramid and the number of update iterations.
[0089] In addition, the terms "upper", "lower", "inner", "outer", "front", "rear" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps described in these embodiments do not limit the scope of the present invention.
[0090] Of course, the above description is only a specific embodiment of the present invention and is not intended to limit the scope of implementation of the present invention. All equivalent changes or modifications made according to the structure, characteristics and principles described in the patent application scope of the present invention should be included in the patent application scope of the present invention.
[0091] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling, It is characterized in that The following steps are involved: Obtain original video data and perform feature extraction based on every two frames of images to obtain a corresponding image enhancement feature data set; Based on the self-attention mechanism operation, dense correlation features between image enhancement feature data are obtained, and a corresponding matching distribution matrix is constructed through the dense correlation features, and the original optical flow between every two frames of images is obtained using the matching distribution matrix; According to the dense correlation features between the image enhancement feature data, the corresponding local correlation features are obtained through multi-layer pooling processing; Generate uncertainty based on the original optical flow, the local correlation feature, the context feature, and the distortion error, and divide the original optical flow into a valid optical flow area and an invalid optical flow area based on the uncertainty; Decoupled propagation is performed according to the divided valid optical flow area and invalid optical flow area, and the corresponding local correlation features and context features are updated to update the corresponding optical flow; The uncertainty of the updated optical flow is used to dynamically and adaptively sample the local correlation features to further update the optical flow until the iteration termination condition is met and the best refined optical flow result is output.
2. According to the optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling in claim 1, It is characterized in that Bilinear interpolation is used to sample the RGB data in two frames of images to obtain image feature data, and the image feature data is input into a feature enhancement network for data enhancement to obtain image enhanced feature data.
3. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 2, It is characterized in that The expression of the image enhancement feature data is as follows Among them, Γ represents the feature enhancement network, P represents the position encoding, and Represents image feature data.
4. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The dense correlation features are obtained through the self-attention mechanism operation, and the expression is as follows: in, Represents image enhancement feature data, H represents image height, W represents image width, and D represents F 1 With F 2 The number of feature channels.
5. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The matching distribution matrix is obtained by calculating the normalized exponential function of the dense correlation features in the latter two dimensions.
6. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The distortion error is obtained by calculating the difference between the target frame image projected to the reference frame perspective and the reference frame image, and its expression is as follows: Among them, I 1 (x) refers to the bilinear interpolation downsampling of the reference frame image The RGB result at coordinate x, The target frame Image Coordinates The RGB result projected to the reference frame view coordinate x, Represents the optical flow of the current coordinate x.
7. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The decoupled propagation includes using image enhancement feature data to perform cross-attention mechanism and self-attention mechanism calculations. The specific process is as follows: Use the cross-attention mechanism to propagate the valid optical flow to the invalid area for update; The self-attention mechanism is used to update the optical flow of the invalid area and the optical flow of the valid area respectively.
8. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The iterative update sets an adaptive sampling step size with a given search radius and sets the center coordinate as uncertainty for local sampling, which is expressed as follows: Where r represents the search radius, x represents the uncertainty of the input, represents the optical flow of the current coordinate x, and μ represents the scale parameter.
9. The optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling according to claim 1, It is characterized in that The context feature is obtained by performing a convolution operation on a reference frame image in two frames of images.
10. An optical flow estimation system, It is characterized in that The method is implemented by the optical flow estimation method based on uncertainty-guided decoupled propagation and adaptive sampling as described in any one of claims 1 to 8, comprising a data enhancement module, a global matching module, a decoupled propagation module and an adaptive sampling iterative optimization module; The data enhancement module is used to extract image enhancement feature data from the input video data; The global matching module is used to generate corresponding dense related features according to the extracted image enhancement feature data, and generate the original optical flow of the input video data based on the dense related features; The decoupled propagation module is used to generate uncertainty according to the original optical flow, local similarity features, context features and distortion errors, and use the uncertainty to divide the optical flow into a valid area and an invalid area, so as to optimize the optical flow in a decoupled manner; The adaptive sampling iterative optimization module is used to adaptively sample local similarity features from densely correlated features, generate new uncertainties based on the updated local similarity features through a decoupled propagation module, and use the uncertainties to dynamically sample similarity features, update the current optical flow value, and output the best refined optical flow result until the iteration termination condition is met.
Citation Information
Patent Citations
Real-time optical flow estimation method based on lightweight convolutional neural network
CN111626308A
Optical flow calculation method based on global and local coupling
CN115761594A
Decoupling propagation and cascade optimization optical flow estimation method based on confidence guidance
CN117237656A
Dense optical flow calculation method employing attention mechanism
WO2023123873A1
