{"id":13640798,"url":"https://github.com/VDIGPKU/DynamicDet","last_synced_at":"2025-04-20T07:30:58.493Z","repository":{"id":152798374,"uuid":"626268420","full_name":"VDIGPKU/DynamicDet","owner":"VDIGPKU","description":"[CVPR 2023] DynamicDet: A Unified Dynamic Architecture for Object Detection","archived":false,"fork":false,"pushed_at":"2024-04-01T04:03:33.000Z","size":685,"stargazers_count":109,"open_issues_count":5,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-08-03T01:17:52.594Z","etag":null,"topics":["coco","dynamic-neural-network","object-detection","yolo"],"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/VDIGPKU.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-04-11T06:08:46.000Z","updated_at":"2024-07-21T02:54:01.000Z","dependencies_parsed_at":"2023-11-29T07:46:25.945Z","dependency_job_id":null,"html_url":"https://github.com/VDIGPKU/DynamicDet","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/VDIGPKU%2FDynamicDet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VDIGPKU%2FDynamicDet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VDIGPKU%2FDynamicDet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VDIGPKU%2FDynamicDet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VDIGPKU","download_url":"https://codeload.github.com/VDIGPKU/DynamicDet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223821915,"owners_count":17208759,"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":["coco","dynamic-neural-network","object-detection","yolo"],"created_at":"2024-08-02T01:01:14.516Z","updated_at":"2024-11-09T11:30:24.106Z","avatar_url":"https://github.com/VDIGPKU.png","language":"Python","funding_links":[],"categories":["Summary"],"sub_categories":[],"readme":"# DynamicDet [[arXiv]](https://arxiv.org/abs/2304.05552)\n\nThis repo contains the official implementation of [**\"DynamicDet: A Unified Dynamic Architecture for Object Detection\"**](https://arxiv.org/abs/2304.05552).\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"./\"\u003e\n        \u003cimg src=\"./figure/performance.png\" width=\"50%\"/\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n## Performance\n\nMS COCO\n\n| Model                                                | Easy / Hard | Size | FLOPs  | FPS  | AP\u003csup\u003eval\u003c/sup\u003e | AP\u003csup\u003etest\u003c/sup\u003e |\n| :----------------------------------------------------------- | :---------: | :--: | :----: | :--: | :--------------: | :---------------: |\n| [**Dy-YOLOv7**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7.pt) |  90% / 10%  | 640  | 112.4G | 110  |      51.4%       |       52.1%       |\n|                                                              |  50% / 50%  | 640  | 143.2G |  96  |      52.7%       |       53.3%       |\n|                                                              |  10% / 90%  | 640  | 174.0G |  85  |      53.3%       |       53.8%       |\n|                                                              |  0% / 100%  | 640  | 181.7G |  83  |      53.5%       |       53.9%       |\n|                                                              |             |      |        |      |                  |                   |\n| [**Dy-YOLOv7-X**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7x.pt) |  90% / 10%  | 640  | 201.7G |  98  |      53.0%       |       53.3%       |\n|                                                              |  50% / 50%  | 640  | 248.9G |  78  |      54.2%       |       54.4%       |\n|                                                              |  10% / 90%  | 640  | 296.1G |  65  |      54.7%       |       55.0%       |\n|                                                              |  0% / 100%  | 640  | 307.9G |  64  |      54.8%       |       55.0%       |\n|                                                              |             |      |        |      |                  |                   |\n| [**Dy-YOLOv7-W6**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7-w6.pt) |  90% / 10%  | 1280 | 384.2G |  74  |      54.9%       |       55.2%       |\n|                                                              |  50% / 50%  | 1280 | 480.8G |  58  |      55.9%       |       56.1%       |\n|                                                              |  10% / 90%  | 1280 | 577.4G |  48  |      56.4%       |       56.7%       |\n|                                                              |  0% / 100%  | 1280 | 601.6G |  46  |      56.5%       |       56.8%       |\n\n\n\u003cdetails\u003e\n\u003csummary\u003e Table Notes \u003c/summary\u003e\n\n- FPS is measured on the same machine with 1 NVIDIA V100 GPU, with `batch_size = 1`, `no_trace` and `fp16`.\n\n- More results can be found on the paper.\n\n\u003c/details\u003e\n\n\n## Quick Start\n\n### Installation\n\n```bash\ncd DynamicDet\nconda install pytorch=1.11 cudatoolkit=11.3 torchvision -c pytorch\npip install -r requirements.txt\n```\n\n\n### Data preparation\n\nDownload MS COCO dataset images ([train](http://images.cocodataset.org/zips/train2017.zip), [val](http://images.cocodataset.org/zips/val2017.zip), [test](http://images.cocodataset.org/zips/test2017.zip)) and [labels](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/coco2017labels-segments.zip).\n\n```\n├── coco\n│   ├── train2017.txt\n│   ├── val2017.txt\n│   ├── test-dev2017.txt\n│   ├── images\n│   │   ├── train2017\n│   │   ├── val2017\n│   │   ├── test2017\n│   ├── labels\n│   │   ├── train2017\n│   │   ├── val2017\n│   ├── annotations\n│   │   ├── instances_val2017.json\n```\n\n### Training\n\nStep1: Training cascaded detector\n\n- Single GPU training\n\n  ```bash\n  python train_step1.py --workers 8 --device 0 --batch-size 16 --epochs 300 --img 640 --cfg cfg/dy-yolov7-step1.yaml --weight '' --data data/coco.yaml --hyp hyp/hyp.scratch.p5.yaml --name dy-yolov7-step1\n  ```\n\n- Multiple GPU training (OURS, RECOMMENDED 🚀)\n\n  ```bash\n  python -m torch.distributed.launch --nproc_per_node 8 --master_port 9527 train_step1.py --workers 8 --device 0,1,2,3,4,5,6,7 --sync-bn --batch-size 128 --epochs 300 --img 640 --cfg cfg/dy-yolov7-step1.yaml --weight '' --data data/coco.yaml --hyp hyp/hyp.scratch.p5.yaml --name dy-yolov7-step1\n  ```\n\nStep2: Training adaptive router\n\n```bash\npython train_step2.py --workers 4 --device 0 --batch-size 1 --epochs 2 --img 640 --adam --cfg cfg/dy-yolov7-step2.yaml --weight runs/train/dy-yolov7-step1/weights/last.pt --data data/coco.yaml --hyp hyp/hyp.finetune.dynamic.adam.yaml --name dy-yolov7-step2\n```\n\n### Getting the dynamic thresholds for variable-speed inference\n\n  ```bash\npython get_dynamic_thres.py --device 0 --batch-size 1 --img-size 640 --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --data data/coco.yaml --task val\n  ```\n\n### Testing\n\n  ```bash\npython test.py --img-size 640 --batch-size 1 --conf 0.001 --iou 0.65 --device 0 --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --data data/coco.yaml --dy-thres \u003cDY_THRESHOLD\u003e\n  ```\n\n### Inference\n\n  ```bash\npython detect.py --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --num-classes 80 --source \u003cIMAGE/VIDEO\u003e --device 0 --dy-thres \u003cDY_THRESHOLD\u003e\n  ```\n\n## Citation\n\nIf you find this repo useful in your research, please consider citing the following paper:\n\n```BibTex\n@inproceedings{lin2023dynamicdet,\n  title={DynamicDet: A Unified Dynamic Architecture for Object Detection},\n  author={Lin, Zhihao and Wang, Yongtao and Zhang, Jinhe and Chu, Xiaojie},\n  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n  year={2023}\n}\n```\n\n## License\n\nThe project is only free for academic research purposes, but needs authorization for commerce. For commerce permission, please contact wyt@pku.edu.cn.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVDIGPKU%2FDynamicDet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVDIGPKU%2FDynamicDet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVDIGPKU%2FDynamicDet/lists"}