{"id":15601065,"url":"https://github.com/lucidrains/stam-pytorch","last_synced_at":"2025-12-22T21:04:58.697Z","repository":{"id":53148023,"uuid":"352445550","full_name":"lucidrains/STAM-pytorch","owner":"lucidrains","description":"Implementation of STAM (Space Time Attention Model), a pure and simple attention model that reaches SOTA for video classification","archived":false,"fork":false,"pushed_at":"2021-04-01T12:02:19.000Z","size":66,"stargazers_count":130,"open_issues_count":3,"forks_count":15,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-10T02:20:36.644Z","etag":null,"topics":["artificial-intelligence","attention-mechanism","deep-learning","transformers","video-classification"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucidrains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-28T21:46:28.000Z","updated_at":"2024-11-15T13:54:14.000Z","dependencies_parsed_at":"2022-09-26T20:53:07.902Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/STAM-pytorch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FSTAM-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FSTAM-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FSTAM-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FSTAM-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/STAM-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230431104,"owners_count":18224655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","attention-mechanism","deep-learning","transformers","video-classification"],"created_at":"2024-10-03T02:13:36.877Z","updated_at":"2025-12-22T21:04:53.658Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./stam.png\"\u003e\u003c/img\u003e\n\n## STAM - Pytorch\n\nImplementation of \u003ca href=\"https://arxiv.org/abs/2103.13915\"\u003eSTAM (Space Time Attention Model)\u003c/a\u003e, yet another pure and simple SOTA attention model that bests all previous models in video classification. This corroborates the finding of \u003ca href=\"https://github.com/lucidrains/TimeSformer-pytorch\"\u003eTimeSformer\u003c/a\u003e. Attention is all we need.\n\n## Install\n\n```bash\n$ pip install stam-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom stam_pytorch import STAM\n\nmodel = STAM(\n    dim = 512,\n    image_size = 256,     # size of image\n    patch_size = 32,      # patch size\n    num_frames = 5,       # number of image frames, selected out of video\n    space_depth = 12,     # depth of vision transformer\n    space_heads = 8,      # heads of vision transformer\n    space_mlp_dim = 2048, # feedforward hidden dimension of vision transformer\n    time_depth = 6,       # depth of time transformer (in paper, it was shallower, 6)\n    time_heads = 8,       # heads of time transformer\n    time_mlp_dim = 2048,  # feedforward hidden dimension of time transformer\n    num_classes = 100,    # number of output classes\n    space_dim_head = 64,  # space transformer head dimension\n    time_dim_head = 64,   # time transformer head dimension\n    dropout = 0.,         # dropout\n    emb_dropout = 0.      # embedding dropout\n)\n\nframes = torch.randn(2, 5, 3, 256, 256) # (batch x frames x channels x height x width)\npred = model(frames) # (2, 100)\n```\n\n## Citations\n\n```bibtex\n@misc{sharir2021image,\n    title   = {An Image is Worth 16x16 Words, What is a Video Worth?}, \n    author  = {Gilad Sharir and Asaf Noy and Lihi Zelnik-Manor},\n    year    = {2021},\n    eprint  = {2103.13915},\n    archivePrefix = {arXiv},\n    primaryClass = {cs.CV}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fstam-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fstam-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fstam-pytorch/lists"}