{"id":22945273,"url":"https://github.com/akhdanfadh/efficient-capsnet-pytorch","last_synced_at":"2025-07-06T14:39:14.124Z","repository":{"id":206713185,"uuid":"592114590","full_name":"akhdanfadh/efficient-capsnet-pytorch","owner":"akhdanfadh","description":"PyTorch implementation of \"Efficient-CapsNet: Capsule Network with Self-Attention Routing\" (Mazzia et al., 2021).","archived":false,"fork":false,"pushed_at":"2024-02-27T23:24:18.000Z","size":38,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-02-28T00:30:20.692Z","etag":null,"topics":["capsule-network","computer-vision","deep-learning","pytorch"],"latest_commit_sha":null,"homepage":"https://www.nature.com/articles/s41598-021-93977-0","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/akhdanfadh.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-01-23T00:00:20.000Z","updated_at":"2024-02-21T07:20:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"1be8fe32-99c9-43c7-9086-e949fdcb06c0","html_url":"https://github.com/akhdanfadh/efficient-capsnet-pytorch","commit_stats":null,"previous_names":["akhdanfadh/efficient-capsnet-pytorch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhdanfadh%2Fefficient-capsnet-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhdanfadh%2Fefficient-capsnet-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhdanfadh%2Fefficient-capsnet-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhdanfadh%2Fefficient-capsnet-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akhdanfadh","download_url":"https://codeload.github.com/akhdanfadh/efficient-capsnet-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229716235,"owners_count":18113077,"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":["capsule-network","computer-vision","deep-learning","pytorch"],"created_at":"2024-12-14T14:30:21.259Z","updated_at":"2024-12-14T14:30:33.521Z","avatar_url":"https://github.com/akhdanfadh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Efficient-CapsNet on Pytorch\n\n[Efficient-CapsNet](https://www.nature.com/articles/s41598-021-93977-0) (Mazzia et al., 2021) is a novel architecture for Capsule Networks that improves the routing algorithm and reduces the number of parameters.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41598-021-93977-0/MediaObjects/41598_2021_93977_Fig2_HTML.png?as=webp\" width=75%\u003e \u003cbr\u003e\n  Schematic representation of the overall architecture of Efficient-CapsNet.\n\u003c/p\u003e\n\nThis project is a faithful PyTorch implementation of the paper with additional features such as logging and monitoring with tensorboard, and a configuration file for easy hyperparameter tuning.\nThe code is based on authors' original implementation in Tensorflow [here](https://github.com/EscVM/Efficient-CapsNet), and has been tested to match it numerically.\n\n## Installation\n\n\u003cdetails\u003e\u003csummary\u003ePython 3 dependencies\u003c/summary\u003e\n\n- pyyaml\n- torch\n- torchvision\n- opencv-python\n- pandas\n- tensorboard\n\u003c/details\u003e\n\nWe recommend using a virtual environment to install the required packages, such as `conda`.\n```bash\ngit clone git@github.com:akhdanfadh/efficient-capsnet-pytorch.git\ncd efficient-capsnet-pytorch\n\nconda create -n efficient-capsnet python=3.10\nconda activate efficient-capsnet\nconda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia\nconda install tensorboard pyyaml pandas opencv\n```\n\n\nThis project has been tested on WSL Ubuntu 22.04 with PyTorch 2.2 \u0026 CUDA 12.2 on a 3090.\n\n\n## Usage\n\nModify the `config.yaml` file to your needs and run the training script as follows. Please check the config file for the available options.\n```bash\npython train.py -c config.yaml -i run_id\n```\n\nFor monitoring the training process, we use tensorboard. To start tensorboard, run the following command after training or in a separate terminal for live-monitoring.\n```bash\ntensorboard --logdir=saved\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Acknowledgements\n\nCode structure and training loop are based on the [pytorch-template](https://github.com/victoresque/pytorch-template) repository with lots of adjustments.\nThe repo help us to understand organizing a deep learning project thoroughly.\n\nShoutout also to mCoding video on \"[Modern Python logging](https://youtu.be/9L77QExPmI0?si=JMR9pKl65j4Xeg-E)\" that explains thoroughly how it works and best practices. \n\n## Citation\n\nKudos to the authors of the paper for their amazing work. If you find this code useful, please consider citing the original work:\n```\n@article{mazzia2021efficient,\n    title={Efficient-CapsNet: capsule network with self-attention routing},\n    author={Mazzia, Vittorio and Salvetti, Francesco and Chiaberge, Marcello},\n    year={2021},\n    journal={Scientific reports},\n    publisher={Nature Publishing Group},\n    volume={11}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhdanfadh%2Fefficient-capsnet-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakhdanfadh%2Fefficient-capsnet-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhdanfadh%2Fefficient-capsnet-pytorch/lists"}