{"id":28100716,"url":"https://github.com/mit-han-lab/amc","last_synced_at":"2025-05-13T18:38:27.706Z","repository":{"id":56103121,"uuid":"192090252","full_name":"mit-han-lab/amc","owner":"mit-han-lab","description":"[ECCV 2018] AMC: AutoML for Model Compression and Acceleration on Mobile Devices","archived":false,"fork":false,"pushed_at":"2023-11-22T23:33:25.000Z","size":18,"stargazers_count":416,"open_issues_count":18,"forks_count":108,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-03-26T08:34:16.287Z","etag":null,"topics":["automl","automl-for-compression","channel-pruning","efficient-model","model-compression","on-device-ai"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1802.03494","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/mit-han-lab.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":"2019-06-15T14:50:43.000Z","updated_at":"2024-03-24T08:26:27.000Z","dependencies_parsed_at":"2022-08-15T13:10:46.234Z","dependency_job_id":null,"html_url":"https://github.com/mit-han-lab/amc","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/mit-han-lab%2Famc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-han-lab%2Famc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-han-lab%2Famc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-han-lab%2Famc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mit-han-lab","download_url":"https://codeload.github.com/mit-han-lab/amc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254004835,"owners_count":21998135,"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":["automl","automl-for-compression","channel-pruning","efficient-model","model-compression","on-device-ai"],"created_at":"2025-05-13T18:38:27.051Z","updated_at":"2025-05-13T18:38:27.663Z","avatar_url":"https://github.com/mit-han-lab.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# AutoML for Model Compression (AMC)\n\nThis repo contains the PyTorch implementation for paper [**AMC: AutoML for Model Compression and Acceleration on Mobile Devices**](https://arxiv.org/abs/1802.03494). \n\n![overview](https://hanlab.mit.edu/projects/amc/images/overview.png)\n\n\n\n## Reference\n\nIf you find the repo useful, please kindly cite our paper:\n\n```\n@inproceedings{he2018amc,\n  title={AMC: AutoML for Model Compression and Acceleration on Mobile Devices},\n  author={He, Yihui and Lin, Ji and Liu, Zhijian and Wang, Hanrui and Li, Li-Jia and Han, Song},\n  booktitle={European Conference on Computer Vision (ECCV)},\n  year={2018}\n}\n```\n\nOther papers related to automated model design:\n\n- HAQ: Hardware-Aware Automated Quantization with Mixed Precision ([CVPR 2019](https://arxiv.org/abs/1811.08886))\n\n- ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware ([ICLR 2019](https://arxiv.org/abs/1812.00332))\n\n\n\n## Training AMC\n\nCurrent code base supports the automated pruning of **MobileNet** on **ImageNet**. The pruning of MobileNet consists of 3 steps: **1. strategy search; 2. export the pruned weights; 3. fine-tune from pruned weights**.\n\nTo conduct the full pruning procedure, follow the instructions below (results might vary a little from the paper due to different random seed):\n\n1. **Strategy Search**\n\n   To search the strategy on MobileNet ImageNet model, first get the pretrained MobileNet checkpoint on ImageNet by running:\n\n   ```\n   bash ./checkpoints/download.sh\n   ```\n\n   It will also download our 50% FLOPs compressed model. Then run the following script to search under 50% FLOPs constraint:\n\n   ```bash\n   bash ./scripts/search_mobilenet_0.5flops.sh\n   ```\n\n   Results may differ due to different random seed. The strategy we found and reported in the paper is:\n\n   ```\n   [3, 24, 48, 96, 80, 192, 200, 328, 352, 368, 360, 328, 400, 736, 752]\n   ```\n\n2. **Export the Pruned Weights**\n\n   After searching, we need to export the pruned weights by running:\n\n   ```\n   bash ./scripts/export_mobilenet_0.5flops.sh\n   ```\n\n   Also we need to modify MobileNet file to support the new pruned model (here it is already done in `models/mobilenet.py`)\n\n3. **Fine-tune from Pruned Weights**a\n\n   After exporting, we need to fine-tune from the pruned weights. For example, we can fine-tune using cosine learning rate for 150 epochs by running:\n\n   ```\n   bash ./scripts/finetune_mobilenet_0.5flops.sh\n   ```\n\n\n\n## AMC Compressed Model\n\nWe also provide the models and weights compressed by our AMC method. We provide compressed MobileNet-V1 and MobileNet-V2 in both PyTorch and TensorFlow format [here](https://github.com/mit-han-lab/amc-compressed-models). \n\nDetailed statistics are as follows:\n\n| Models                   | Top1 Acc (%) | Top5 Acc (%) |\n| ------------------------ | ------------ | ------------ |\n| MobileNetV1-width*0.75   | 68.4         | 88.2         |\n| **MobileNetV1-50%FLOPs** | **70.494**   | **89.306**   |\n| **MobileNetV1-50%Time**  | **70.200**   | **89.430**   |\n| MobileNetV2-width*0.75   | 69.8         | 89.6         |\n| **MobileNetV2-70%FLOPs** | **70.854**   | **89.914**   |\n\n\n\n## Dependencies\n\nCurrent code base is tested under following environment:\n\n1. Python 3.7.3\n2. PyTorch 1.1.0\n3. torchvision 0.2.1\n4. NumPy 1.14.3\n5. SciPy 1.1.0\n6. scikit-learn 0.19.1\n7. [tensorboardX](https://github.com/lanpa/tensorboardX)\n8. ImageNet dataset\n\n\n\n## Contact\n\nTo contact the authors:\n\nJi Lin, jilin@mit.edu\n\nSong Han, songhan@mit.edu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmit-han-lab%2Famc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmit-han-lab%2Famc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmit-han-lab%2Famc/lists"}