{"id":13716326,"url":"https://github.com/felixgwu/img_classification_pk_pytorch","last_synced_at":"2025-04-07T06:09:45.662Z","repository":{"id":50532603,"uuid":"86894002","full_name":"felixgwu/img_classification_pk_pytorch","owner":"felixgwu","description":"Quickly comparing your image classification models with the state-of-the-art models (such as DenseNet, ResNet, ...)","archived":false,"fork":false,"pushed_at":"2019-04-12T02:32:20.000Z","size":63,"stargazers_count":371,"open_issues_count":2,"forks_count":76,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-31T05:03:37.516Z","etag":null,"topics":["cifar","computer-vision","deep-learning","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/felixgwu.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}},"created_at":"2017-04-01T07:33:45.000Z","updated_at":"2025-02-27T03:10:20.000Z","dependencies_parsed_at":"2022-08-31T16:01:56.988Z","dependency_job_id":null,"html_url":"https://github.com/felixgwu/img_classification_pk_pytorch","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/felixgwu%2Fimg_classification_pk_pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixgwu%2Fimg_classification_pk_pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixgwu%2Fimg_classification_pk_pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixgwu%2Fimg_classification_pk_pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixgwu","download_url":"https://codeload.github.com/felixgwu/img_classification_pk_pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":["cifar","computer-vision","deep-learning","pytorch"],"created_at":"2024-08-03T00:01:09.394Z","updated_at":"2025-04-07T06:09:45.637Z","avatar_url":"https://github.com/felixgwu.png","language":"Python","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Python","Pytorch \u0026 related libraries","Model Deployment library"],"sub_categories":["CV｜计算机视觉:","CV:","PyTorch \u003ca name=\"pytorch\"/\u003e"],"readme":"\u003cp align=\"center\"\u003e\u003cimg width=\"40%\" src=\"http://i.imgur.com/EMM7Qn2.pngg\" /\u003e\u003c/p\u003e\n\n# Image Classification Project Killer in PyTorch\nThis repo is designed for those who want to start their experiments two days before the deadline and kill the project in the last 6 hours. :new_moon_with_face:\nInspired by [fb.torch.resnet](https://github.com/facebook/fb.resnet.torch),\nit provides fast experiment setup and attempts to maximize the number of projects killed within the given time.\nPlease feel free to submit issues or pull requests if you want to contribute.\n\n## News\n- Updated to PyTorch version \u003e= 0.4\n- Supporting [Cutout regularization](https://arxiv.org/abs/1708.04552) Please these [options](https://github.com/felixgwu/img_classification_pk_pytorch/blob/master/args.py#L51-L56).\n\n## Usage\nBoth Python 2.7 and 3 are supported; however, it was mainly tested on Python 3.\nUse `python main.py -h` to show all arguments.\n\n\n### Training\nTrain a ResNet-56 on CIFAR-10 with data augmentation using GPU0:\n```sh\nCUDA_VISIBLE_DEVICES=0 python main.py --data cifar10 --data_aug --arch resnet --depth 56 --save save/cifar10 -resnet-56 --epochs 164\n```\nTrain a ResNet-110 on CIFAR-100 without data augmentation using GPU0 and GPU2:\n```sh\nCUDA_VISIBLE_DEVICES=0,2 python main.py --data cifar100 --arch resnet --depth 110 --save save/cifar100-resnet-110 --epochs 164\n```\n\nSee *scripts/cifar10.sh* and *scripts/cifar100.sh* for more training examples.\n### Evaluation\n```sh\npython main.py --resume save/resnet-56/model_best.pth.tar --evaluate test --data cifar10\n```\n\n### Adding your custom model\nYou can write your own model in a *.py* file and put it into *models* folder. All you need it to provide a `createModel(arg1, arg2, **kwarg)` function that returns the model which is an instance of *nn.Module*. Then you'll be able to use your model by setting `--arch your_model_name` (assuming that your model is in a the file *models/your_model_name*).\n\n### Show Training \u0026 Validation Results\n#### Python script\n```sh\ngetbest.py save/* FOLDER_1 FOLDER_2\n```\nIn short, this script reads the *scores.tsv* in the saving folders and display the best validation errors of them.\n\n#### Using Tensorboard\n```sh\ntensorboard --logdir save --port PORT\n```\n\n## Features\n\n### Experiment Setup \u0026 Logging\n- Ask before overwriting existing experiments, and move the old one to /tmp instead of overwriting\n- Saving training/validation loss, errors, and learning rate of each epoch to a TSV file\n- Automatically copying all source code to saving directory to prevent accidental deleteion of codes. This is inspired by [SGAN code](https://github.com/xunhuang1995/SGAN/tree/master/mnist).\n- [TensorBoard](https://www.tensorflow.org/get_started/summaries_and_tensorboard) support using [tensorboard\\_logger](https://github.com/TeamHG-Memex/tensorboard_logger)\n- One script to show all experiment results\n- Display training time\n- Holding out testing set and using validation set for hyperparameter tuning experiments\n- GPU support\n- Adding *save* \u0026 *data* folders to .gitignore to prevent commiting the datasets and trained models\n- Result table\n- Python 2.7 \u0026 3.5 support\n\n\n### Models (See *models* folder for details)\n- [x] ResNet ([paper](https://arxiv.org/abs/1512.03385)) ([code](https://github.com/facebook/fb.resnet.torch))\n- [x] ResNet with Stochastic Depth ([paper](https://arxiv.org/abs/1603.09382)) ([code](https://github.com/yueatsprograms/Stochastic_Depth))\n\n### Datasets\n#### CIFAR\nLast 5000 samples in the original training set is used for validation. Each pixel is in [0, 1]. Based on experiments results, normalizing the data to zero mean and unit standard deviation seems to be redundant.\n- CIFAR-10\n- CIFAR-100\n\n## Results\n### Test Error Rate (in percentage) **with** validation set\nThe number of parameters are calculated based on CIFAR-10 model.\nResNets were training with 164 epochs (the same as the default setting in fb.resnet.torch) and DenseNets were trained 300 epochs.\nBoth are using batch\\_size=64.\n\n| Model                                   | Parameters | CIFAR-10 | CIFAR-10 (aug) | CIFAR-100 | CIFAR-100 (aug) |\n|-----------------------------------------| -----------|----------|-----------|-----------|------------|\n| ResNet-56                               | 0.86M      |          | 6.82      |           |            |\n| ResNet-110                              | 1.73M      |          |           |           |            |\n| ResNet-110 with Stochastic Depth        | 1.73M      |          | 5.25      |           | 24.2       |\n| DenseNet-BC-100 (k=12)                  | 0.8M       |          | 5.34      |           |            |\n| DenseNet-BC-190 (k=40)                  | 25.6M      |          |           |           |            |\n| Your model                              |            |          |           |           |            |\n\n### Top1 Testing Error Rate (in percentage)\nComing soon...\n\n## File Descriptions\n- *main.py*: main script to train or evaluate models\n- *train.py*: training and evaluation part of the code\n- *config*: storing configuration of datasets (and maybe other things in the future)\n- *utils.pypy*: useful functions\n- *getbest.py*: display the best validation error of each saving folder\n- *dataloader.py*: defines *getDataloaders* function which is used to load datasets\n- *models*: a folder storing all network models. Each script in it should contain a *createModel(\\*\\*kwargs)* function that takes the arguments and return a model (subclass of nn.Module) for training\n- *scripts*: a folder storing example training commands in UNIX shell scripts\n\n## Acknowledgement\nThis code is based on the ImageNet training script provided in [PyTorch examples](https://github.com/pytorch/examples/blob/master/imagenet/main.py).\n\nThe author is not familiar with licensing. Please contact me there is there are any problems with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixgwu%2Fimg_classification_pk_pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixgwu%2Fimg_classification_pk_pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixgwu%2Fimg_classification_pk_pytorch/lists"}