UniMatch

class grid.model.perception.optical_flow.gmflow.UniMatch(*args, **kwargs)

UniMatch: Optical Flow Estimation Model

This class implements a wrapper for the UniMatch model, which estimates optical flow in videos using a multi-scale transformer-based approach.

Credits:

https://github.com/UniMatch/UniMatch

License:

This code is licensed under the Apache 2.0 License.

__init__()
Return type:

None

run(dir, mode='video')

Runs the UniMatch optical flow model on the given video or directory of images.

Parameters:
  • dir (str) -- The path to the video file or directory of images.

  • mode (str, optional) -- The mode of input, either 'video' or 'image'. Defaults to 'video'.

Returns:

The optical flow maps for the input video or images.

Return type:

list

Example

>>> optical_flow = UniMatch()
>>> flow_maps = optical_flow.run(video_path)
>>> print(len(flow_maps))