{"id":20962228,"url":"https://github.com/lartpang/methodscmp","last_synced_at":"2025-08-24T11:38:02.961Z","repository":{"id":108877131,"uuid":"400953990","full_name":"lartpang/MethodsCmp","owner":"lartpang","description":"MethodsCmp: A Simple Toolkit for Counting the FLOPs/MACs, Parameters and FPS of Pytorch-based Methods","archived":false,"fork":false,"pushed_at":"2024-05-13T09:06:43.000Z","size":109,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-28T23:32:37.611Z","etag":null,"topics":["flops","flops-counter","fps","fps-counter","macs","macs-counter","memory","memory-counter","parameter-counter","parameters","python","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lartpang.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-29T04:56:20.000Z","updated_at":"2024-11-20T11:17:29.000Z","dependencies_parsed_at":"2024-05-13T10:38:49.116Z","dependency_job_id":null,"html_url":"https://github.com/lartpang/MethodsCmp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lartpang%2FMethodsCmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lartpang%2FMethodsCmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lartpang%2FMethodsCmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lartpang%2FMethodsCmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lartpang","download_url":"https://codeload.github.com/lartpang/MethodsCmp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233546488,"owners_count":18692228,"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":["flops","flops-counter","fps","fps-counter","macs","macs-counter","memory","memory-counter","parameter-counter","parameters","python","pytorch"],"created_at":"2024-11-19T02:25:03.100Z","updated_at":"2025-01-11T22:57:19.829Z","avatar_url":"https://github.com/lartpang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple toolkit for counting the FLOPs/MACs, Parameters and FPS of the model.\n\n```shell\n$ python main.py --help\nusage: main.py [-h] [--method-names METHOD_NAMES [METHOD_NAMES ...]]\n               [--mode {ops_params,fps,gpu_mem} [{ops_params,fps,gpu_mem} ...]]\n\nA simple toolkit for counting the FLOPs/MACs, Parameters, FPS and GPU Memory of the model.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --method-names METHOD_NAMES [METHOD_NAMES ...]\n                        The names of the methods you want to evaluate.\n  --mode {ops_params,fps,gpu_mem} [{ops_params,fps,gpu_mem} ...]\n```\n\n**NOTE**:\n* [`fvcore` cannot count the FLOPs of the built-in module nn.MultiHeadAttention of PyTorch](https://github.com/lartpang/MethodsCmp/issues/1)\n\n## Usage\n\n```bash\npip install fvcore\n```\n\nIn `methods` folder, I have provided some recent methods, i.e. CoNet, DANet, HDFNet, JL-DCF, and UC-Net, as the examples.\n\nMore functional improvements and suggestions are welcome.\n\nAn example:\n\n```shell\npython main.py --method-names zoomnet ugtr c2fnet ujsc pfnet mgl_r slsr sinet\n```\n\n## Change Log\n\n* 2023-07-28: \n  * [New \u0026 Important] Update the library for count FLOPs/MACS from `pytorch-OpCounter` to `fvcore` which can count FLOPs/MACs of the complex module, like Transformer.\n  * Remove the useless `test` folder.\n  * [Experimental Feature] Add the new feature for counting the peak inference GPU memory of the model.\n* 2022-03-03: Add more methods, add the gpu warmup process in counting FPS and update the readme.\n* 2021-09-29: Refactor again.\n* 2021-08-31: Refactor.\n* 2021-08-29: Create a new repository and upload the code.\n\n```latex\n@misc{MethodsCmp,\n\tauthor       = {Youwei Pang},\n\ttitle        = {MethodsCmp: A Simple Toolkit for Counting the FLOPs/MACs, Parameters and FPS of Pytorch-based Methods},\n\thowpublished = {\\url{https://github.com/lartpang/MethodsCmp}},\n\tyear         = {2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flartpang%2Fmethodscmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flartpang%2Fmethodscmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flartpang%2Fmethodscmp/lists"}