{"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/keeping-your-eye-on-the-ball-trajectory","title":"Keeping Your Eye on the Ball: Trajectory Attention in Video Transformers","arxiv_id":"2106.05392","date":"2021-06-09","proceeding":"NeurIPS 2021 12","authors":["Mandela Patrick","Dylan Campbell","Yuki M. Asano","Ishan Misra","Florian Metze","Christoph Feichtenhofer","Andrea Vedaldi","João F. Henriques"],"abstract":"In video transformers, the time dimension is often treated in the same way as the two spatial dimensions. However, in a scene where objects or the camera may move, a physical point imaged at one location in frame $t$ may be entirely unrelated to what is found at that location in frame $t+k$. These temporal correspondences should be modeled to facilitate learning about dynamic scenes. To this end, we propose a new drop-in block for video transformers -- trajectory attention -- that aggregates information along implicitly determined motion paths. We additionally propose a new method to address the quadratic dependence of computation and memory on the input size, which is particularly important for high resolution or long videos. While these ideas are useful in a range of settings, we apply them to the specific task of video action recognition with a transformer model and obtain state-of-the-art results on the Kinetics, Something--Something V2, and Epic-Kitchens datasets. Code and models are available at: https://github.com/facebookresearch/Motionformer","url_abs":"https://arxiv.org/abs/2106.05392v2","url_pdf":"https://arxiv.org/pdf/2106.05392v2.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":"keeping-your-eye-on-the-ball-trajectory","repo_url":"https://github.com/facebookresearch/Motionformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"keeping-your-eye-on-the-ball-trajectory","repo_url":"https://github.com/facebookresearch/xformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"action-classification","task_name":"Action Classification"},{"task_slug":"action-recognition-in-videos","task_name":"Action Recognition"},{"task_slug":"action-recognition","task_name":"Temporal Action Localization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/action-classification-on-kinetics-400","task":"Action Classification","dataset":"Kinetics-400","model":"Motionformer-HR","rank_in_archive_order":88,"of":207,"metrics":{"Acc@1":"81.1","Acc@5":"95.2"},"uses_additional_data":false},{"leaderboard":"/sota/action-recognition-on-epic-kitchens-100","task":"Action Recognition","dataset":"EPIC-KITCHENS-100","model":"Mformer-HR","rank_in_archive_order":19,"of":32,"metrics":{"Action@1":"44.5","Noun@1":"58.5","Verb@1":"67.0"},"uses_additional_data":true},{"leaderboard":"/sota/action-recognition-on-epic-kitchens-100","task":"Action Recognition","dataset":"EPIC-KITCHENS-100","model":"Mformer-L","rank_in_archive_order":22,"of":32,"metrics":{"Action@1":"44.1","Noun@1":"57.6","Verb@1":"67.1"},"uses_additional_data":true},{"leaderboard":"/sota/action-recognition-on-epic-kitchens-100","task":"Action Recognition","dataset":"EPIC-KITCHENS-100","model":"Mformer","rank_in_archive_order":25,"of":32,"metrics":{"Action@1":"43.1","Noun@1":"56.5","Verb@1":"66.7"},"uses_additional_data":true},{"leaderboard":"/sota/action-recognition-in-videos-on-something","task":"Action Recognition","dataset":"Something-Something V2","model":"Mformer-L","rank_in_archive_order":54,"of":123,"metrics":{"GFLOPs":"1181x3","Parameters":"N/A","Top-1 Accuracy":"68.1","Top-5 Accuracy":"91.2"},"uses_additional_data":true},{"leaderboard":"/sota/action-recognition-in-videos-on-something","task":"Action Recognition","dataset":"Something-Something V2","model":"Mformer-HR","rank_in_archive_order":70,"of":123,"metrics":{"GFLOPs":"958.8x3","Parameters":"N/A","Top-1 Accuracy":"67.1","Top-5 Accuracy":"90.6"},"uses_additional_data":true},{"leaderboard":"/sota/action-recognition-in-videos-on-something","task":"Action Recognition","dataset":"Something-Something V2","model":"Mformer","rank_in_archive_order":80,"of":123,"metrics":{"Top-1 Accuracy":"66.5","Top-5 Accuracy":"90.1"},"uses_additional_data":true}],"syntology":{"syntology_url":"https://syntology.ai/paper/2106.05392","atlas_url":"https://app.syntology.ai/?focus=2106.05392","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.05392"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/facebookresearch/Motionformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/xformers","reach":null}],"summary":{"ran_draft_wrong":1,"unverified":1},"by_repo_kind":{"official":{"samples":2,"ran":1,"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":2,"samples":[{"code_sha256_prefix":"83c9daa7db244c42","entry":"qkv_attn","repo":"facebookresearch/Motionformer","repo_kind":"official","path":"slowfast/models/vit_helper.py","file_url":"https://github.com/facebookresearch/Motionformer/blob/HEAD/slowfast/models/vit_helper.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"83c9daa7db244c42"}},{"code_sha256_prefix":"667edb27243e3e17","entry":"TrajectoryAttention","repo":"facebookresearch/Motionformer","repo_kind":"official","path":"slowfast/models/vit_helper.py","file_url":"https://github.com/facebookresearch/Motionformer/blob/HEAD/slowfast/models/vit_helper.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"667edb27243e3e17"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}