An optical flow prediction method and device for an image, a terminal device, and a storage medium

The optical flow prediction model using a convolutional gated recurrent model solves the problem of inaccurate optical flow field prediction in existing technologies. By using feature extraction and hidden state prediction, and considering the motion dependence of continuous frame images, the accuracy and efficiency of optical flow field prediction are improved.

CN123181502APending Publication Date: 2026-11-27GEER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510696577.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, predicting the optical flow field of the next frame image based solely on the state of objects in the current frame image is not accurate enough and fails to effectively capture the motion dependency between consecutive frames.

Method used

An optical flow prediction model based on a convolutional gated recurrent model is adopted. By acquiring the optical flow field of the current frame image, feature extraction and hidden state prediction are performed. Combined with motion feature extraction, the optical flow field of the next frame image is predicted, taking into account the motion dependency between consecutive frames.

Benefits of technology

It improves the prediction accuracy and efficiency of the optical flow field in the next frame image, and enhances the prediction accuracy and temporal consistency by considering the motion dependency of historical frame images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181502A_ABST
    Figure CN123181502A_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of image processing, and provides an optical flow prediction method and device of an image, a terminal device and a storage medium. The method comprises the following steps: first, obtaining an optical flow field of a current frame image; then, performing feature extraction on the optical flow field of the current frame image to obtain an optical flow feature map of the current frame image; then, according to the optical flow feature map of the current frame image and a hidden state of the current frame image, predicting a predicted hidden state of a next frame image; finally, obtaining an optical flow field of the next frame image according to the predicted hidden state of the next frame image. Since the hidden state of the current frame image is used to determine the optical flow field of the next frame image, the motion dependence between the continuous frame images is considered, and compared with the prior art which only considers the state of the object in the current frame image and does not consider the motion dependence of the object in the continuous frame images, the optical flow field of the next frame image predicted by the application is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to an optical flow prediction method, apparatus, terminal device and storage medium for images. Background Technology

[0002] Optical flow refers to a complete motion vector field composed of the set of optical flow vectors of all pixels in an image. Optical flow vectors are vectors used in computer vision to describe the motion information of objects in an image, representing the motion of each pixel in the image along the time dimension.

[0003] Currently, the optical flow field of the next frame image is often predicted by predicting the optical flow field of the next frame image. When predicting the optical flow field of the next frame image, only the state of each object in the current frame image is often considered. For moving objects, since the objects are constantly changing, the optical flow field of the next frame image predicted based solely on the state of the objects in the current frame image is not accurate enough. Summary of the Invention

[0004] This application provides an optical flow prediction method, apparatus, terminal device, and storage medium for images, which can solve the problem that the optical flow field of the next frame image predicted based solely on the state of objects in the current frame image is not accurate enough.

[0005] In a first aspect, embodiments of this application provide an optical flow prediction method for an image, including:

[0006] Obtain the optical flow field of the current frame image;

[0007] Feature extraction is performed on the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image;

[0008] Based on the optical flow feature map of the current frame image and the hidden state of the current frame image, the predicted hidden state of the next frame image is predicted. The hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and historical frame images.

[0009] Based on the predicted hidden state of the next frame image and the optical flow field of the current frame image, predict the optical flow field of the next frame image.

[0010] In one possible implementation of the first aspect, predicting the predicted hidden state of the next frame image based on the optical flow feature map of the current frame image and the hidden state of the current frame image includes:

[0011] Gating calculations are performed based on the optical flow feature map and the hidden state of the current frame image to predict the candidate hidden state of the next frame image;

[0012] Based on the candidate hidden state, motion features are extracted from the optical flow feature map of the current frame image to obtain the motion region features of the current frame image;

[0013] The optical flow feature map of the current frame image and the motion region feature are added together to obtain the predicted hidden state of the next frame image.

[0014] In one possible implementation of the first aspect, the step of performing gating calculations based on the optical flow feature map of the current frame image and the hidden state of the current frame image to predict the candidate hidden state of the next frame image includes:

[0015] The optical flow feature map of the current frame image is input into the convolutional gated loop module. The convolutional gated loop module performs gated calculations on the optical flow feature map of the current frame image and the hidden state of the current frame image to predict the candidate hidden state of the next frame image. The convolutional gated loop module is constructed based on the convolutional gated loop model.

[0016] In one possible implementation of the first aspect, the step of extracting motion features from the optical flow feature map of the current frame image based on the candidate hidden state to obtain the motion region features of the current frame image includes:

[0017] Motion features are extracted from the optical flow feature map of the current frame image to obtain a motion region mask map in the current frame image;

[0018] The motion region mask image is weighted using the candidate hidden states to obtain the motion region features of the current frame image.

[0019] In one possible implementation of the first aspect, predicting the optical flow field of the next frame image based on the predicted hidden state of the next frame image and the optical flow field of the current frame image includes:

[0020] The predicted hidden state of the next frame image is decoded to obtain the optical flow change of the next frame image relative to the current frame image;

[0021] The optical flow field of the next frame image is determined based on the optical flow change and the optical flow field of the current frame image.

[0022] In one possible implementation of the first aspect, determining the optical flow field of the next frame image based on the optical flow change and the optical flow field of the current frame image includes:

[0023] The optical flow change is added to the optical flow field of the current frame image to obtain the optical flow field of the next frame image.

[0024] In one possible implementation of the first aspect, the step of extracting features from the optical flow field of the current frame image to obtain an optical flow feature map of the current frame image includes:

[0025] The optical flow field of the current frame image is downsampled to obtain a candidate feature map of the current frame image;

[0026] The candidate feature map is upsampled to obtain the optical flow feature map of the current frame image.

[0027] Secondly, embodiments of this application provide an optical flow prediction device for an image, comprising:

[0028] The optical flow acquisition module is used to acquire the optical flow field of the current frame image;

[0029] The feature extraction module is used to extract features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image;

[0030] The convolutional gated loop module is used to predict the predicted hidden state of the next frame image based on the optical flow feature map of the current frame image and the hidden state of the current frame image. The hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and the historical frame images.

[0031] The optical flow prediction module is used to predict the optical flow field of the next frame image based on the predicted hidden state of the next frame image and the optical flow field of the current frame image.

[0032] Thirdly, embodiments of this application provide a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the optical flow prediction method for an image as described in any of the first aspects above.

[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the optical flow prediction method for an image as described in any one of the first aspects.

[0034] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the optical flow prediction method for an image as described in any of the first aspects.

[0035] The beneficial effects of the first aspect of this application compared to the prior art are as follows: This application first obtains the optical flow field of the current frame image, extracts features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image, which can characterize the motion features of the corresponding pixels of the object. Then, based on the optical flow feature map and the hidden state of the current frame image, the predicted hidden state of the next frame image is predicted. Since the hidden state of the current frame image includes the relationship between the current frame image and historical frame images, the predicted hidden state of the next frame image takes into account historical features, that is, it considers the motion dependency relationship between consecutive frame images; finally, the optical flow field of the next frame image is obtained based on the predicted hidden state of the next frame image. Because this application uses the hidden state of the current frame image to determine the optical flow field of the next frame image, it considers the motion dependency between consecutive frame images. Compared with the prior art, which only considers the state of the object in the current frame image and does not consider the motion dependency of the object in consecutive frame images, the optical flow field predicted by this application is more accurate.

[0036] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a schematic diagram of the structure of an optical flow prediction model provided in an embodiment of this application;

[0039] Figure 2 This is a schematic flowchart of an image optical flow prediction method provided in an embodiment of this application;

[0040] Figure 3 This is a flowchart illustrating a method for determining the hidden state of the next frame image according to an embodiment of this application.

[0041] Figure 4 This is a flowchart illustrating a method for determining the optical flow field of the next frame image according to an embodiment of this application;

[0042] Figure 5 This is a schematic diagram of the state representation of the loss function provided in an embodiment of this application;

[0043] Figure 6 This is a schematic diagram of the structure of an optical flow prediction device for images provided in an embodiment of this application;

[0044] Figure 7 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0045] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0046] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0047] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0048] The optical flow field is a collection of motion vectors from all pixels in an image, providing a more comprehensive description of the motion patterns of objects in a scene. In object tracking, the optical flow field of the current frame is often used to predict the optical flow field of the next frame, thereby predicting the state of the object at the next moment.

[0049] Currently, predicting the optical flow field of the next frame image often relies on convolutional neural networks (CNNs) or ordinary recurrent neural networks (RNNs). CNNs lack temporal modeling capabilities, making it difficult to capture the motion dependencies between consecutive frames when predicting the optical flow field. Ordinary RNNs, due to their large parameter count, suffer from low prediction efficiency and are prone to errors when predicting the optical flow map of the next frame image because of the large amount of data they need to process.

[0050] To address the aforementioned issues, this application proposes an optical flow prediction model for predicting optical flow fields. This model is based on a convolutional gated recurrent model, which considers the motion dependency between consecutive frames when predicting the optical flow field of the next frame, thus making the prediction more accurate. Furthermore, this application uses fewer parameters, improving overall prediction efficiency.

[0051] Below, in conjunction with Figure 1 The structure of the optical flow prediction model is explained.

[0052] The optical flow prediction model includes a feature extraction module, a convolutional gated recurrent unit (ConvGRU) module, a flow field prediction head module, and a residual link output module.

[0053] The feature extraction module is used to extract features from the optical flow field of the input current frame image to obtain the optical flow feature map of the current frame image.

[0054] The convolutional gated loop module is used to process the optical flow feature map of the current frame image and predict the hidden state of the next frame image.

[0055] The flow prediction head module is used to obtain the change in optical flow of the next frame image relative to the current frame image based on the predicted hidden state of the next frame image.

[0056] The residual link output module is used to determine the optical flow field of the next frame image based on the change in optical flow of the next frame image relative to the current frame image.

[0057] In one implementation, the feature extraction module may include a downsampling unit and a feature fusion upsampling unit. The output of the downsampling unit is the input of the upsampling unit. Specifically, the downsampling unit downsamples the input current frame image to obtain candidate features of the current frame image. The feature fusion upsampling unit upsamples the candidate features to obtain the optical flow feature map of the current frame image.

[0058] The convolutional gating loop module may include a convolutional gating unit, a motion attention mechanism unit, and a residual adaptive linking unit.

[0059] The convolutional gating unit performs gating calculations on the optical flow feature map of the input current frame image and the hidden state of the current frame image itself to obtain the candidate hidden state of the next frame image. The convolutional gating unit can be constructed based on a depthwise separable convolutional gating recurrent model to improve data processing efficiency and accuracy.

[0060] The motion attention mechanism unit utilizes the attention mechanism of motion features to extract motion features based on the optical flow feature map of the current frame image and the candidate hidden state of the next frame image, thereby obtaining the motion region features of the current frame image.

[0061] The residual adaptive linking unit is used to process the motion region features of the current frame image to obtain the final predicted hidden state of the next frame image.

[0062] The following combination Figure 1 The optical flow prediction method for images according to embodiments of this application will be described in detail.

[0063] Figure 2 A schematic flowchart of the optical flow prediction method for images provided in this application is shown, with reference to... Figure 2 The method is described in detail below:

[0064] S101, Obtain the optical flow field of the current frame image.

[0065] In this embodiment, for consecutive frame images, the current frame image is one frame in the consecutive frame images.

[0066] The optical flow field of the current frame image is generated based on the optical flow of each pixel in the current frame image. The optical flow of each pixel in the current frame image represents the motion information of that pixel in the current frame image relative to that pixel in the previous frame image. The motion information can include motion trajectory and velocity, etc.

[0067] For example, the optical flow field of the current frame image can be a 2-channel tensor map with a size of 2×1080×1920.

[0068] S102, extract features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image.

[0069] In this embodiment, feature extraction may include object displacement extraction, rotation and / or translation extraction, etc.

[0070] In one implementation, a trained random forest classifier is used to extract features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image.

[0071] In another implementation, the optical flow field of the current frame image is input into a trained convolutional neural network for feature extraction to obtain the optical flow feature map of the current frame image.

[0072] In another implementation, the optical flow field of the current frame image is downsampled to obtain a candidate feature map of the current frame image; the candidate feature map is then upsampled to obtain an optical flow feature map of the current frame image.

[0073] Specifically, using Figure 1 The feature extraction module (also known as a multi-scale encoder) extracts features from the optical flow field of the current frame image.

[0074] The optical flow field of the current frame image is input into the downsampling unit of the feature extraction module. The downsampling unit downsamples the optical flow field to obtain a candidate feature map of the current frame image. The candidate feature map is then input into the feature fusion upsampling unit to upsample the candidate feature map to obtain the optical flow feature map of the current frame image. The feature extraction module constructs a multi-scale representation (pyramid) of the image, calculating optical flow features at different levels, balancing local detail accuracy and global motion consistency, while optimizing computational resource consumption.

[0075] In one approach, the downsampling unit may include two convolutional layers, a first convolutional layer and a second convolutional layer. The optical flow field of the current frame image is input into the first convolutional layer for feature extraction, resulting in a first feature map. The first feature map is then input into the second convolutional layer for feature extraction, resulting in a candidate feature map of the current frame image.

[0076] For example, the first convolutional layer can be a convolutional layer with a kernel size of 3×3, 16 channels, a stride of 2, a ReLU (Rectified Linear Units) activation function, and an output size of 16×540×960. The second convolutional layer can be a convolutional layer with a kernel size of 3×3, 32 channels, a stride of 2, a ReLU (Rectified Linear Units) activation function, and an output size of 32×270×480.

[0077] The upsampling unit may include a first upsampling subunit and a second upsampling subunit. The candidate feature map obtained from downsampling is input into the first upsampling subunit for feature extraction to obtain a second feature map. The second feature map is then input into the second upsampling subunit for feature extraction to obtain the optical flow feature map of the current frame image.

[0078] The first upsampling subunit performs bilinear interpolation (e.g., by a factor of 2) on the candidate feature map to enlarge its size, for example, from (16, 540, 960) to (16, 1080, 1920), resulting in an enlarged feature map. A 1×1 convolution (with up to 24 channels) is then applied to the enlarged feature map to obtain the convolutional feature map. This convolutional feature map is then concatenated with the downsampled candidate feature map to obtain a fused image. Finally, a 3×3 convolution is applied to the fused feature map to obtain the second feature map.

[0079] The second upsampling subunit performs bilinear interpolation (e.g., by a factor of 4) on the second feature map to enlarge its size, resulting in an enlarged feature map. A 1×1 convolution (with up to 24 channels) is then applied to the enlarged feature map to obtain the optical flow feature map of the current frame, for example, an optical flow feature map of (24, 1080, 1920).

[0080] S103, based on the optical flow feature map of the current frame image and the hidden state of the current frame image, predict the predicted hidden state of the next frame image.

[0081] The hidden state is an internal state used to store and transmit information. It is updated at each time step, capturing information and contextual relationships in the input sequence. In this application, the hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and historical frame images.

[0082] In one embodiment, the optical flow feature map of the current frame image and the hidden state of the current frame image are input into the trained first prediction model to obtain the predicted hidden state of the next frame image.

[0083] If the next frame image is a predicted hidden state, it is used to characterize the relationship between the next frame image and the historical frame images.

[0084] S104, based on the predicted hidden state of the next frame image and the optical flow field of the current frame image, predict the optical flow field of the next frame image.

[0085] In one embodiment, the predicted hidden state of the next frame image and the optical flow field of the current frame image are input into the trained second prediction model to obtain the optical flow field of the next frame image.

[0086] In this application, the optical flow field of the current frame image is first obtained, and features are extracted from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image. The optical flow feature map can characterize the motion features of the corresponding pixels of the object. Then, based on the optical flow feature map of the current frame image and the hidden state of the current frame image, the predicted hidden state of the next frame image is predicted. Since the hidden state of the current frame image characterizes the relationship between the current frame image and historical frame images, the predicted hidden state of the next frame image takes into account historical features, that is, it takes into account the motion dependency between consecutive frame images. Finally, the optical flow field of the next frame image is obtained based on the predicted hidden state of the next frame image. Because this application uses the hidden state of the current frame image to determine the optical flow field of the next frame image, it considers the motion dependency between consecutive frame images. Compared with the prior art, which only considers the state of the object in the current frame image and does not consider the motion dependency of the object in consecutive frame images, the optical flow field predicted by this application is more accurate.

[0087] like Figure 3 As shown, in one possible implementation, step S103 may include:

[0088] S1031, based on the optical flow feature map of the current frame image and the hidden state of the current frame image, perform gating calculation to predict the candidate hidden state of the next frame image.

[0089] In this embodiment, reference Figure 1 The optical flow feature map of the current frame image is input into the Convolutional Gated Recurrent Unit (ConvGRU) module. The Convolutional Gated Unit (GRU) in the Convolutional Gated Recurrent Unit performs gating calculation on the optical flow feature map of the current frame image and the hidden state of the current frame image, and predicts the candidate hidden state of the next frame image.

[0090] Specifically, a convolutional gating unit may include an input compression layer and a gating computation layer.

[0091] The optical flow feature map of the current frame image is input to the input compression layer to compress the optical flow feature map, resulting in a compressed optical flow feature map. For example, the optical flow feature map (24 channels) is compressed into an 8-channel optical flow feature map through a 1×1 convolution. Compressing the optical flow feature map and reducing the channel dimension can reduce computation and redundant information.

[0092] The compressed optical flow feature map is input into the gated computation layer to obtain the predicted hidden state of the next frame image. Specifically, depthwise separable convolution is used to process the compressed optical flow feature map to obtain a processed optical flow feature map. The processed optical flow feature map is then subjected to gated computation to obtain the candidate hidden state of the next frame image.

[0093] As an example, the depthwise separable convolution consists of: a 3×3 depthwise convolution (number of groups = 16) + a 1×1 pointwise convolution (number of output channels = 96). The 3×3 depthwise convolution decomposes the compressed optical flow feature map, yielding 16 groups of optical flow features (16 channels of optical flow features). The 1×1 pointwise convolution then fuses the decomposed optical flow features across channels, increasing the dimensionality to 96 channels, providing rich features for subsequent gating processing.

[0094] During gating computation, the Sigmoid function is used to constrain the outputs of the reset and update gates, ensuring that the output data falls within the (0, 1) interval. After obtaining intermediate hidden states using the output of the reset gate, the hidden state of the current frame image, and the optical flow feature map of the current frame image, convolution calculations (e.g., 3×3 convolutions) are performed on these intermediate hidden states to obtain candidate hidden states for the next frame image. The convolution calculation on the intermediate hidden states aims to fuse the intermediate hidden states, the output of the update gate, and the hidden state of the current frame image to obtain more accurate candidate hidden states.

[0095] S1032, based on the candidate hidden state, perform motion feature extraction on the optical flow feature map of the current frame image to obtain the motion region feature of the current frame image.

[0096] In one implementation, a motion attention mechanism unit is used to extract motion features from the candidate hidden states and the optical flow feature map of the current frame image to obtain the motion region features of the current frame image. The motion attention mechanism unit is constructed based on an attention mechanism for motion features.

[0097] Specifically, using an attention mechanism based on motion features, motion features are extracted from the optical flow feature map of the current frame image to obtain a motion region mask map in the current frame image. The motion region mask map is then weighted using the candidate hidden states to obtain the motion region features of the current frame image.

[0098] As an example, the attention mechanism for motion features can include three convolutional layers plus a sigmoid function, where the first convolutional layer is a 48-channel convolution, the second convolutional layer is a 64-channel convolution, and the third convolutional layer is a 1-channel convolution. Motion features are extracted from the optical flow feature map of the current frame image using these three convolutional layers to obtain a motion region mask map in the current frame image. For example, the size of the motion region mask map can be (1, 1080, 1920).

[0099] After obtaining the motion region mask, the candidate hidden states and the motion region mask are multiplied point by point to enhance the motion region features and obtain the motion region features of the current frame image.

[0100] S1033, the optical flow feature map of the current frame image and the motion region feature are added together to obtain the predicted hidden state of the next frame image.

[0101] In this embodiment, in order to convert the optical flow feature map of the current frame image into an image with the same dimension as the motion region feature, it is necessary to perform convolution processing on the optical flow feature map of the current frame image. For example, the optical flow feature map is subjected to 1×1 convolution processing to obtain the optical flow feature map after dimension conversion.

[0102] The optical flow feature map after dimensional transformation is added to the motion region feature to obtain the predicted hidden state of the next frame image, making the obtained predicted hidden state information richer and more accurate.

[0103] In this embodiment, candidate hidden states for the next frame are obtained by gating the optical flow feature map, solving the problem of difficulty in capturing motion dependencies between consecutive frames. The obtained candidate hidden states for the next frame reflect the motion dependencies between consecutive frames. Furthermore, motion features are extracted from the optical flow feature map using the candidate hidden states to obtain the predicted hidden states for the next frame, enhancing the temporal consistency of the predicted hidden states and preserving more motion details.

[0104] like Figure 4 As shown, in one possible implementation, step S104 may include:

[0105] S1041, decode the predicted hidden state of the next frame image to obtain the optical flow change of the next frame image relative to the current frame image.

[0106] In one implementation, since the predicted hidden state is in tensor form, it needs to be decoded into an image representing optical flow changes. Therefore, the predicted hidden state of the next frame image is input... Figure 1 The flow field prediction head module in the middle performs decoding processing to obtain the optical flow change.

[0107] Specifically, the flow field prediction head module includes two convolutional layers: a third convolutional layer and a fourth convolutional layer. The predicted hidden state of the next frame image is input into the third convolutional layer, which extracts features from the predicted hidden state of the next frame image to obtain the first optical flow change feature. The first optical flow change feature is then input into the fourth convolutional layer, which extracts and compresses the first optical flow change feature (from 48 channels to 2 channels) to obtain the optical flow change amount.

[0108] As an example, the third convolutional layer includes: 3×3 convolution (48 channels → 48 channels) + ReLU function (non-linear function), which enables the flow field prediction head module to learn complex, non-linear feature relationships.

[0109] The fourth convolutional layer can include a 3×3 convolution (48 channels → 2 channels), and the size of the optical flow variation can be (2, 1080, 1920).

[0110] S1042, Based on the change in optical flow of the next frame image relative to the current frame image and the optical flow field of the current frame image, determine the optical flow field of the next frame image.

[0111] In one implementation, the optical flow change of the next frame image and the optical flow field of the current frame image are input. Figure 1 The residual link output module in the image obtains the optical flow field of the next frame. A residual learning strategy can stabilize the prediction results and reduce accumulated errors.

[0112] Specifically, the optical flow change of the next frame image is added to the optical flow field of the current frame image to obtain the optical flow field of the next frame image.

[0113] In this application, the changes in the current frame image are obtained by decoding the predicted hidden state of the next frame image into the change in optical flow of the next frame image relative to the current frame image; the optical flow field of the next frame image is determined based on the changes in the current frame image. Since the predicted hidden state retains key motion information from historical frame images, the optical flow field of the next frame image determined based on the predicted hidden state is more accurate.

[0114] To verify the accuracy of the method described in this application, after predicting the optical flow field using the method, the predicted optical flow field is compared with the optical flow field of the acquired real image. Please refer to the appendix for details. Figure 5 The diagram shows the loss function of the predicted optical flow field. If the predicted optical flow field is inserted between the optical flow fields of the first and second frames of the acquired image, the light-colored scattered point 1 in the diagram represents the difference between the optical flow fields of the first and second frames; the dark-colored scattered point 2 represents the difference between the predicted optical flow field and the optical flow field of the second frame. As can be seen from the diagram, the dark-colored scattered point 2 is below the light-colored scattered point 1, indicating that the dark-colored scattered point 2 is smaller than the light-colored scattered point 1. This confirms that this application has achieved the prediction of the optical flow field of the image.

[0115] It should be understood that the sequence number of each step in the above embodiments does not imply 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 this application.

[0116] Corresponding to the optical flow prediction method for images described in the above embodiments, Figure 6 A structural block diagram of an optical flow prediction device for images provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0117] Reference Figure 6 The device 200 may include: an optical flow acquisition module 210, a feature extraction module 220, a convolutional gated loop module 230, and an optical flow prediction module 240.

[0118] Among them, the optical flow acquisition module 210 is used to acquire the optical flow field of the current frame image;

[0119] Feature extraction module 220 is used to extract features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image;

[0120] The convolutional gated loop module 230 is used to predict the predicted hidden state of the next frame image based on the optical flow feature map of the current frame image and the hidden state of the current frame image. The hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and the historical frame images.

[0121] The optical flow prediction module 240 is used to predict the optical flow field of the next frame image based on the predicted hidden state of the next frame image and the optical flow field of the current frame image.

[0122] In one possible implementation, the convolution gate loop module 230 can specifically be used for:

[0123] Gating calculations are performed based on the optical flow feature map and the hidden state of the current frame image to predict the candidate hidden state of the next frame image;

[0124] Based on the candidate hidden state, motion features are extracted from the optical flow feature map of the current frame image to obtain the motion region features of the current frame image;

[0125] The optical flow feature map of the current frame image and the motion region feature are added together to obtain the predicted hidden state of the next frame image.

[0126] In one possible implementation, the convolution gate loop module 230 can specifically be used for:

[0127] The optical flow feature map of the current frame image is input into the convolutional gated loop module. The convolutional gated loop module performs gated calculations on the optical flow feature map of the current frame image and the hidden state of the current frame image to predict the candidate hidden state of the next frame image. The convolutional gated loop module is constructed based on the convolutional gated loop model.

[0128] In one possible implementation, the convolution gate loop module 230 can specifically be used for:

[0129] Motion features are extracted from the optical flow feature map of the current frame image to obtain a motion region mask map in the current frame image;

[0130] The motion region mask image is weighted using the candidate hidden states to obtain the motion region features of the current frame image.

[0131] In one possible implementation, the optical flow prediction module 240 can specifically be used for:

[0132] The predicted hidden state of the next frame image is decoded to obtain the optical flow change of the next frame image relative to the current frame image;

[0133] The optical flow field of the next frame image is determined based on the optical flow change and the optical flow field of the current frame image.

[0134] In one possible implementation, the optical flow prediction module 240 can specifically be used for:

[0135] The optical flow change is added to the optical flow field of the current frame image to obtain the optical flow field of the next frame image.

[0136] In one possible implementation, the feature extraction module 220 can specifically be used for:

[0137] The optical flow field of the current frame image is downsampled to obtain a candidate feature map of the current frame image;

[0138] The candidate feature map is upsampled to obtain the optical flow feature map of the current frame image.

[0139] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0140] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0141] This application also provides a terminal device, see [link to relevant documentation] Figure 7 The terminal device 400 may include: at least one processor 410, a memory 420, and a computer program stored in the memory 420 and executable on the at least one processor 410. When the processor 410 executes the computer program, it implements the steps in any of the above method embodiments, for example... Figure 2 Steps S101 to S104 in the illustrated embodiment. Alternatively, when the processor 410 executes the computer program, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 6 The functions of the optical flow acquisition module 210 to the optical flow prediction module 240 are shown.

[0142] For example, a computer program may be divided into one or more modules / units, one or more of which are stored in memory 420 and executed by processor 410 to complete this application. The one or more modules / units may be a series of computer program segments capable of performing a specific function, which are used to describe the execution process of the computer program in terminal device 400.

[0143] Those skilled in the art will understand that Figure 7 This is merely an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, buses, etc.

[0144] The processor 410 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0145] The memory 420 can be an internal storage unit of the terminal device or an external storage device, such as a plug-in hard drive, a smart media card (SMC), a secure digital card (SD), or a flash card. The memory 420 is used to store the computer program and other programs and data required by the terminal device. The memory 420 can also be used to temporarily store data that has been output or will be output.

[0146] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0147] The optical flow prediction method for images provided in this application embodiment can be applied to terminal devices such as computers, tablets, laptops, netbooks, and personal digital assistants (PDAs). This application embodiment does not impose any restrictions on the specific type of terminal device.

[0148] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0149] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0150] In the embodiments provided in this application, it should be understood that the disclosed terminal devices, apparatuses, and methods can be implemented in other ways. For example, the terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.

[0151] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0152] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0153] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by one or more processors, it can implement the steps of the various method embodiments described above.

[0154] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by one or more processors, it can implement the steps of the various method embodiments described above.

[0155] Similarly, as a computer program product, when the computer program product is run on a terminal device, it enables the terminal device to implement the steps in the above-described method embodiments.

[0156] The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0157] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for predicting optical flow in an image, characterized in that, include: Obtain the optical flow field of the current frame image; Feature extraction is performed on the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image; Based on the optical flow feature map of the current frame image and the hidden state of the current frame image, the predicted hidden state of the next frame image is predicted. The hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and historical frame images. Based on the predicted hidden state of the next frame image and the optical flow field of the current frame image, predict the optical flow field of the next frame image.

2. The optical flow prediction method for images as described in claim 1, characterized in that, The step of predicting the predicted hidden state of the next frame image based on the optical flow feature map and the hidden state of the current frame image includes: Gating calculations are performed based on the optical flow feature map and the hidden state of the current frame image to predict the candidate hidden state of the next frame image; Based on the candidate hidden state, motion features are extracted from the optical flow feature map of the current frame image to obtain the motion region features of the current frame image; The optical flow feature map of the current frame image and the motion region feature are added together to obtain the predicted hidden state of the next frame image.

3. The optical flow prediction method for images as described in claim 2, characterized in that, The step of extracting motion features from the optical flow feature map of the current frame image based on the candidate hidden state to obtain the motion region features of the current frame image includes: Motion features are extracted from the optical flow feature map of the current frame image to obtain a motion region mask map in the current frame image; The motion region mask image is weighted using the candidate hidden states to obtain the motion region features of the current frame image.

4. The optical flow prediction method for images as described in any one of claims 1 to 3, characterized in that, The step of predicting the optical flow field of the next frame image based on the predicted hidden state of the next frame image and the optical flow field of the current frame image includes: The predicted hidden state of the next frame image is decoded to obtain the optical flow change of the next frame image relative to the current frame image; The optical flow field of the next frame image is determined based on the optical flow change and the optical flow field of the current frame image.

5. The optical flow prediction method for images as described in claim 4, characterized in that, Determining the optical flow field of the next frame image based on the optical flow change and the optical flow field of the current frame image includes: The optical flow change is added to the optical flow field of the current frame image to obtain the optical flow field of the next frame image.

6. The optical flow prediction method for images as described in claim 1, characterized in that, The step of extracting features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image includes: The optical flow field of the current frame image is downsampled to obtain a candidate feature map of the current frame image; The candidate feature map is upsampled to obtain the optical flow feature map of the current frame image.

7. The optical flow prediction method for images as described in claim 2, characterized in that, The gating calculation based on the optical flow feature map and the hidden state of the current frame image to predict the candidate hidden state of the next frame image includes: The optical flow feature map of the current frame image is input into the convolutional gated loop module. The convolutional gated loop module performs gated calculations on the optical flow feature map of the current frame image and the hidden state of the current frame image to predict the candidate hidden state of the next frame image. The convolutional gated loop module is constructed based on the convolutional gated loop model.

8. An optical flow prediction device for an image, characterized in that, include: The optical flow acquisition module is used to acquire the optical flow field of the current frame image; The feature extraction module is used to extract features from the optical flow field of the current frame image to obtain the optical flow feature map of the current frame image; The convolutional gated loop module is used to predict the predicted hidden state of the next frame image based on the optical flow feature map of the current frame image and the hidden state of the current frame image. The hidden state of the current frame image is determined based on the hidden states of the current frame image and the previous frame image, and is used to characterize the relationship between the current frame image and the historical frame images. The optical flow prediction module is used to predict the optical flow field of the next frame image based on the predicted hidden state of the next frame image and the optical flow field of the current frame image.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the optical flow prediction method for images as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the optical flow prediction method for images as described in any one of claims 1 to 7.