{"id":13737167,"url":"https://github.com/ahirner/pytorch-retraining","last_synced_at":"2026-01-17T16:51:24.967Z","repository":{"id":79296345,"uuid":"92759766","full_name":"ahirner/pytorch-retraining","owner":"ahirner","description":"Transfer Learning Shootout for PyTorch's model zoo (torchvision)","archived":false,"fork":false,"pushed_at":"2020-09-20T11:06:49.000Z","size":592,"stargazers_count":170,"open_issues_count":1,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-04T03:08:09.827Z","etag":null,"topics":["benchmark","pytorch","transfer-learning"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahirner.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}},"created_at":"2017-05-29T17:09:42.000Z","updated_at":"2024-01-04T16:14:28.000Z","dependencies_parsed_at":"2023-05-25T10:00:28.006Z","dependency_job_id":null,"html_url":"https://github.com/ahirner/pytorch-retraining","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahirner%2Fpytorch-retraining","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahirner%2Fpytorch-retraining/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahirner%2Fpytorch-retraining/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahirner%2Fpytorch-retraining/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahirner","download_url":"https://codeload.github.com/ahirner/pytorch-retraining/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224737431,"owners_count":17361345,"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":["benchmark","pytorch","transfer-learning"],"created_at":"2024-08-03T03:01:36.627Z","updated_at":"2026-01-17T16:51:19.931Z","avatar_url":"https://github.com/ahirner.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook","Paper implementations｜论文实现","Paper implementations"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"# pytorch-retraining\nTransfer Learning shootout for PyTorch's model zoo (torchvision).\n\n* **Load** any pretrained model with custom final layer (num_classes) from PyTorch's model zoo in one line\n```python\nmodel_pretrained, diff = load_model_merged('inception_v3', num_classes)\n```\n\n* **Retrain** minimal (as inferred on load) or a custom amount of layers on multiple GPUs. Optionally with _Cyclical Learning Rate_ [(Smith 2017)](http://arxiv.org/abs/1506.01186).\n```python\nfinal_param_names = [d[0] for d in diff]\nstats = train_eval(model_pretrained, trainloader, testloader, final_params_names)\n```\n\n* **Chart** `training_time`, `evaluation_time` (fps), top-1 `accuracy` for varying levels of retraining depth (shallow, deep and from scratch)\n\n|  ![chart](https://raw.githubusercontent.com/ahirner/pytorch-retraining/master/results/diagram_bees.png) | \n|:---:|\n| *Transfer learning on example dataset [Bee vs Ants](http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html)* with 2xV100 GPUs|\n\n## Results on more elaborate Dataset\n*num_classes = 23, slightly unbalanced, high variance in rotation and motion blur artifacts* with 1xGTX1080Ti\n\n|  ![chart_17](https://raw.githubusercontent.com/ahirner/pytorch-retraining/master/results/diagram_17.png) | \n|:---:|\n| *Constant LR with momentum* |\n\n|  ![chart_17_clr](https://raw.githubusercontent.com/ahirner/pytorch-retraining/master/results/diagram_17_clr.png) | \n|:---:|\n| *Cyclical Learning Rate* |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahirner%2Fpytorch-retraining","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahirner%2Fpytorch-retraining","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahirner%2Fpytorch-retraining/lists"}