{"id":13499117,"url":"https://github.com/moskomule/senet.pytorch","last_synced_at":"2025-04-15T03:50:16.989Z","repository":{"id":37768298,"uuid":"103267552","full_name":"moskomule/senet.pytorch","owner":"moskomule","description":"PyTorch implementation of SENet","archived":false,"fork":false,"pushed_at":"2021-03-02T04:09:12.000Z","size":61,"stargazers_count":2317,"open_issues_count":0,"forks_count":446,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-15T03:49:57.379Z","etag":null,"topics":["pytorch","senet"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"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/moskomule.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":"2017-09-12T12:26:27.000Z","updated_at":"2025-04-10T17:23:57.000Z","dependencies_parsed_at":"2022-07-15T21:48:16.583Z","dependency_job_id":null,"html_url":"https://github.com/moskomule/senet.pytorch","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/moskomule%2Fsenet.pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moskomule%2Fsenet.pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moskomule%2Fsenet.pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moskomule%2Fsenet.pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moskomule","download_url":"https://codeload.github.com/moskomule/senet.pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003944,"owners_count":21196794,"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":["pytorch","senet"],"created_at":"2024-07-31T22:00:29.219Z","updated_at":"2025-04-15T03:50:16.973Z","avatar_url":"https://github.com/moskomule.png","language":"Python","funding_links":[],"categories":["Papers\u0026Codes","Python","DLA"],"sub_categories":["SENet"],"readme":"# SENet.pytorch\n\nAn implementation of SENet, proposed in **Squeeze-and-Excitation Networks** by Jie Hu, Li Shen and Gang Sun, who are the winners of ILSVRC 2017 classification competition.\n\nNow SE-ResNet (18, 34, 50, 101, 152/20, 32) and SE-Inception-v3 are implemented.\n\n* `python cifar.py` runs SE-ResNet20 with Cifar10 dataset.\n\n* `python imagenet.py` and `python -m torch.distributed.launch --nproc_per_node=${NUM_GPUS} imagenet.py` run SE-ResNet50 with ImageNet(2012) dataset,\n    + You need to prepare dataset by yourself in `~/.torch/data` or set an enviroment variable `IMAGENET_ROOT=${PATH_TO_YOUR_IMAGENET}`\n    + First download files and then follow the [instruction](https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md#download-the-imagenet-dataset).\n    + The number of workers and some hyper parameters are fixed so check and change them if you need.\n    + This script uses all GPUs available. To specify GPUs, use `CUDA_VISIBLE_DEVICES` variable. (e.g. `CUDA_VISIBLE_DEVICES=1,2` to use GPU 1 and 2)\n\nFor SE-Inception-v3, the input size is required to be 299x299 [as the original Inception](https://github.com/tensorflow/models/tree/master/inception).\n\n## Pre-requirements\n\nThe codebase is tested on the following setting.\n\n* Python\u003e=3.8\n* PyTorch\u003e=1.6.0\n* torchvision\u003e=0.7\n\n### For training\n\nTo run `cifar.py` or `imagenet.py`, you need\n\n* `pip install git+https://github.com/moskomule/homura@v2020.07`\n\n## hub\n\nYou can use some SE-ResNet (`se_resnet{20, 56, 50, 101}`) via `torch.hub`.\n\n```python\nimport torch.hub\nhub_model = torch.hub.load(\n    'moskomule/senet.pytorch',\n    'se_resnet20',\n    num_classes=10)\n```\n\nAlso, a pretrained SE-ResNet50 model is available.\n\n```python\nimport torch.hub\nhub_model = torch.hub.load(\n    'moskomule/senet.pytorch',\n    'se_resnet50',\n    pretrained=True,)\n ```\n\n## Results\n\n### SE-ResNet20/Cifar10\n\n```\npython cifar.py [--baseline]\n```\n\nNote that the CIFAR-10 dataset expected to be under `~/.torch/data`.\n\n|                  | ResNet20       | SE-ResNet20 (reduction 4 or 8)    |\n|:-------------    | :------------- | :------------- |\n|max. test accuracy|  92%           | 93%            |\n\n### SE-ResNet50/ImageNet\n\n```\npython [-m torch.distributed.launch --nproc_per_node=${NUM_GPUS}] imagenet.py\n```\n\nThe option [-m ...] is for distributed training. Note that the Imagenet dataset is expected to be under `~/.torch/data` or specified as `IMAGENET_ROOT=${PATH_TO_IMAGENET}`.\n\n*The initial learning rate and mini-batch size are different from the original version because of my computational resource* .\n\n|                  | ResNet         | SE-ResNet      |\n|:-------------    | :------------- | :------------- |\n|max. test accuracy(top1)|  76.15 %(*)             | 77.06% (**)          |\n\n\n+ (*): [ResNet-50 in torchvision](https://pytorch.org/docs/stable/torchvision/models.html)\n\n+ (**): When using `imagenet.py` with the `--distributed` setting on 8 GPUs. The weight is [available](https://github.com/moskomule/senet.pytorch/releases/download/archive/seresnet50-60a8950a85b2b.pkl).\n\n```python\n# !wget https://github.com/moskomule/senet.pytorch/releases/download/archive/seresnet50-60a8950a85b2b.pkl\n\nsenet = se_resnet50(num_classes=1000)\nsenet.load_state_dict(torch.load(\"seresnet50-60a8950a85b2b.pkl\"))\n```\n\n## Contribution\n\nI cannot maintain this repository actively, but any contributions are welcome. Feel free to send PRs and issues.\n\n## References\n\n[paper](https://arxiv.org/pdf/1709.01507.pdf)\n\n[authors' Caffe implementation](https://github.com/hujie-frank/SENet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoskomule%2Fsenet.pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoskomule%2Fsenet.pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoskomule%2Fsenet.pytorch/lists"}