{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/gmflow-learning-optical-flow-via-global","title":"GMFlow: Learning Optical Flow via Global Matching","arxiv_id":"2111.13680","date":"2021-11-26","proceeding":"CVPR 2022 1","authors":["Haofei Xu","Jing Zhang","Jianfei Cai","Hamid Rezatofighi","DaCheng Tao"],"abstract":"Learning-based optical flow estimation has been dominated with the pipeline of cost volume with convolutions for flow regression, which is inherently limited to local correlations and thus is hard to address the long-standing challenge of large displacements. To alleviate this, the state-of-the-art framework RAFT gradually improves its prediction quality by using a large number of iterative refinements, achieving remarkable performance but introducing linearly increasing inference time. To enable both high accuracy and efficiency, we completely revamp the dominant flow regression pipeline by reformulating optical flow as a global matching problem, which identifies the correspondences by directly comparing feature similarities. Specifically, we propose a GMFlow framework, which consists of three main components: a customized Transformer for feature enhancement, a correlation and softmax layer for global feature matching, and a self-attention layer for flow propagation. We further introduce a refinement step that reuses GMFlow at higher feature resolution for residual flow prediction. Our new framework outperforms 31-refinements RAFT on the challenging Sintel benchmark, while using only one refinement and running faster, suggesting a new paradigm for accurate and efficient optical flow estimation. Code is available at https://github.com/haofeixu/gmflow.","url_abs":"https://arxiv.org/abs/2111.13680v4","url_pdf":"https://arxiv.org/pdf/2111.13680v4.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"gmflow-learning-optical-flow-via-global","repo_url":"https://github.com/haofeixu/gmflow","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"gmflow-learning-optical-flow-via-global","repo_url":"https://github.com/autonomousvision/unimatch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"gmflow-learning-optical-flow-via-global","repo_url":"https://github.com/hpcforge/gmflow","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"paper_slug":"gmflow-learning-optical-flow-via-global","repo_url":"https://github.com/raymondwang987/nvds","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"optical-flow-estimation","task_name":"Optical Flow Estimation"},{"task_slug":"regression-1","task_name":"regression"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/optical-flow-estimation-on-spring","task":"Optical Flow Estimation","dataset":"Spring","model":"GMFlow","rank_in_archive_order":9,"of":11,"metrics":{"1px total":"10.355"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2111.13680","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.13680"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/haofeixu/gmflow","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hpcforge/gmflow","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/autonomousvision/unimatch","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/raymondwang987/nvds","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"ran_draft_wrong":1,"unverified":16},"by_repo_kind":{"official":{"samples":15,"ran":3,"repositories":1},"listed":{"samples":4,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"abcbf43ad9fe6129","entry":"compute_color","repo":"haofeixu/gmflow","repo_kind":"official","path":"utils/flow_viz.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/utils/flow_viz.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"abcbf43ad9fe6129"}},{"code_sha256_prefix":"0823d84f9697f2a7","entry":"generate_window_grid","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/geometry.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/geometry.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0823d84f9697f2a7"}},{"code_sha256_prefix":"52b500940a8025a3","entry":"single_head_full_attention","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/transformer.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/transformer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"52b500940a8025a3"}},{"code_sha256_prefix":"b6528bfa48fa18a0","entry":"compute_errors","repo":"raymondwang987/nvds","repo_kind":"listed","path":"infer_NVDS_dpt_bi.py","file_url":"https://github.com/raymondwang987/nvds/blob/HEAD/infer_NVDS_dpt_bi.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b6528bfa48fa18a0"}},{"code_sha256_prefix":"d3e701ed2a0c860a","entry":"compute_scale_and_shift","repo":"raymondwang987/nvds","repo_kind":"listed","path":"infer_NVDS_dpt_bi.py","file_url":"https://github.com/raymondwang987/nvds/blob/HEAD/infer_NVDS_dpt_bi.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d3e701ed2a0c860a"}},{"code_sha256_prefix":"134980aa63271fbb","entry":"coords_grid","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/geometry.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/geometry.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"134980aa63271fbb"}},{"code_sha256_prefix":"215f62561b03c262","entry":"flow_compute_color","repo":"haofeixu/gmflow","repo_kind":"official","path":"utils/flow_viz.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/utils/flow_viz.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"215f62561b03c262"}},{"code_sha256_prefix":"715a9e324491547b","entry":"flow_loss_func","repo":"haofeixu/gmflow","repo_kind":"official","path":"loss.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"715a9e324491547b"}},{"code_sha256_prefix":"d59fe7ab39463182","entry":"flow_to_color","repo":"haofeixu/gmflow","repo_kind":"official","path":"utils/flow_viz.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/utils/flow_viz.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d59fe7ab39463182"}},{"code_sha256_prefix":"a69f1d64c1b71d23","entry":"generate_shift_window_attn_mask","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/transformer.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/transformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a69f1d64c1b71d23"}},{"code_sha256_prefix":"d5a86279192fe3ae","entry":"global_correlation_softmax","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/matching.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/matching.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d5a86279192fe3ae"}},{"code_sha256_prefix":"d9223ffb6230f989","entry":"local_correlation_softmax","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/matching.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/matching.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d9223ffb6230f989"}},{"code_sha256_prefix":"6dc05be22af3598b","entry":"merge_splits","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/utils.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6dc05be22af3598b"}},{"code_sha256_prefix":"8d0dd2c61c5c3d89","entry":"normalize_coords","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/geometry.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/geometry.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8d0dd2c61c5c3d89"}},{"code_sha256_prefix":"b1ba789ed7470207","entry":"normalize_img","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/utils.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b1ba789ed7470207"}},{"code_sha256_prefix":"959c2141efd7f746","entry":"normalize_prediction_robust","repo":"raymondwang987/nvds","repo_kind":"listed","path":"infer_NVDS_dpt_bi.py","file_url":"https://github.com/raymondwang987/nvds/blob/HEAD/infer_NVDS_dpt_bi.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"959c2141efd7f746"}},{"code_sha256_prefix":"7e90a3df0831de3d","entry":"normalize_prediction_test","repo":"raymondwang987/nvds","repo_kind":"listed","path":"smooth_loss.py","file_url":"https://github.com/raymondwang987/nvds/blob/HEAD/smooth_loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7e90a3df0831de3d"}},{"code_sha256_prefix":"9a948b3b755e6516","entry":"single_head_split_window_attention","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/transformer.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/transformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9a948b3b755e6516"}},{"code_sha256_prefix":"4df5b1dd5d60d6cb","entry":"split_feature","repo":"haofeixu/gmflow","repo_kind":"official","path":"gmflow/utils.py","file_url":"https://github.com/haofeixu/gmflow/blob/HEAD/gmflow/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4df5b1dd5d60d6cb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}