{"id":13757263,"url":"https://github.com/WongKinYiu/ScaledYOLOv4","last_synced_at":"2025-05-10T05:31:52.699Z","repository":{"id":37545333,"uuid":"312734031","full_name":"WongKinYiu/ScaledYOLOv4","owner":"WongKinYiu","description":"Scaled-YOLOv4: Scaling Cross Stage Partial Network","archived":false,"fork":false,"pushed_at":"2024-11-03T00:36:25.000Z","size":489,"stargazers_count":2031,"open_issues_count":312,"forks_count":574,"subscribers_count":41,"default_branch":"yolov4-large","last_synced_at":"2025-04-11T04:09:09.385Z","etag":null,"topics":["deep-learning","machine-learning","ml","object-detection","pytorch","scaled-yolov4","yolo","yolov3","yolov4","yolov4-csp","yolov4-large","yolov4-tiny"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WongKinYiu.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-14T03:01:11.000Z","updated_at":"2025-04-05T08:22:03.000Z","dependencies_parsed_at":"2023-01-19T18:30:54.451Z","dependency_job_id":"2888ce85-5b1f-49d1-a1d5-1d108ea484fc","html_url":"https://github.com/WongKinYiu/ScaledYOLOv4","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"676800364a3446900b9e8407bc880ea2127b3415"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WongKinYiu%2FScaledYOLOv4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WongKinYiu%2FScaledYOLOv4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WongKinYiu%2FScaledYOLOv4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WongKinYiu%2FScaledYOLOv4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WongKinYiu","download_url":"https://codeload.github.com/WongKinYiu/ScaledYOLOv4/tar.gz/refs/heads/yolov4-large","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253371072,"owners_count":21897998,"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":["deep-learning","machine-learning","ml","object-detection","pytorch","scaled-yolov4","yolo","yolov3","yolov4","yolov4-csp","yolov4-large","yolov4-tiny"],"created_at":"2024-08-03T12:00:30.858Z","updated_at":"2025-05-10T05:31:52.403Z","avatar_url":"https://github.com/WongKinYiu.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python"],"sub_categories":["Uncategorized"],"readme":"# YOLOv4-large\n\nThis is the implementation of \"[Scaled-YOLOv4: Scaling Cross Stage Partial Network](https://arxiv.org/abs/2011.08036)\" using PyTorch framwork.\n\n* [YOLOv4-CSP](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp)\n* [YOLOv4-tiny](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-tiny)\n* [YOLOv4-large](https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-large)\n\n| Model | Test Size | AP\u003csup\u003etest\u003c/sup\u003e | AP\u003csub\u003e50\u003c/sub\u003e\u003csup\u003etest\u003c/sup\u003e | AP\u003csub\u003e75\u003c/sub\u003e\u003csup\u003etest\u003c/sup\u003e | AP\u003csub\u003eS\u003c/sub\u003e\u003csup\u003etest\u003c/sup\u003e | AP\u003csub\u003eM\u003c/sub\u003e\u003csup\u003etest\u003c/sup\u003e | AP\u003csub\u003eL\u003c/sub\u003e\u003csup\u003etest\u003c/sup\u003e | batch1 throughput |\n| :-- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | \n| **YOLOv4-P5** | 896 | **51.4%** | **69.9%** | **56.3%** | **33.1%** | **55.4%** | **62.4%** | 41 *fps* |\n| **YOLOv4-P5** | TTA | **52.5%** | **70.3%** | **58.0%** | **36.0%** | **52.4%** | **62.3%** | - |\n|  |  |  |  |  |  |  |\n| **YOLOv4-P6** | 1280 | **54.3%** | **72.3%** | **59.5%** | **36.6%** | **58.2%** | **65.5%** | 30 *fps* |\n| **YOLOv4-P6** | TTA | **54.9%** | **72.6%** | **60.2%** | **37.4%** | **58.8%** | **66.7%** | - |\n|  |  |  |  |  |  |  |\n| **YOLOv4-P7** | 1536 | **55.4%** | **73.3%** | **60.7%** | **38.1%** | **59.5%** | **67.4%** | 15 *fps* |\n| **YOLOv4-P7** | TTA | **55.8%** | **73.2%** | **61.2%** | **38.8%** | **60.1%** | **68.2%** | - |\n|  |  |  |  |  |  |  |\n\n| Model | Test Size | AP\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003e50\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003e75\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eS\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eM\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eL\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | weights |\n| :-- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: |\n| **YOLOv4-P5** | 896 | **51.2%** | **69.8%** | **56.2%** | **35.0%** | **56.2%** | **64.0%** | [`yolov4-p5.pt`](https://github.com/WongKinYiu/ScaledYOLOv4/releases/download/weights/yolov4-p5.pt) |\n| **YOLOv4-P5** | TTA | **52.5%** | **70.2%** | **57.8%** | **38.5%** | **57.2%** | **64.0%** | - |\n| **YOLOv4-P5** (+BoF) | 896 | **51.7%** | **70.3%** | **56.7%** | **35.9%** | **56.7%** | **64.3%** | [`yolov4-p5_.pt`](https://github.com/WongKinYiu/ScaledYOLOv4/releases/download/weights/yolov4-p5_.pt) |\n| **YOLOv4-P5** (+BoF) | TTA | **52.8%** | **70.6%** | **58.3%** | **38.8%** | **57.4%** | **64.4%** | - |\n|  |  |  |  |  |  |  |  |\n| **YOLOv4-P6** | 1280 | **53.9%** | **72.0%** | **59.0%** | **39.3%** | **58.3%** | **66.6%** | [`yolov4-p6.pt`](https://github.com/WongKinYiu/ScaledYOLOv4/releases/download/weights/yolov4-p6.pt) |\n| **YOLOv4-P6** | TTA | **54.4%** | **72.3%** | **59.6%** | **39.8%** | **58.9%** | **67.6%** | - |\n| **YOLOv4-P6** (+BoF) | 1280 | **54.4%** | **72.7%** | **59.5%** | **39.5%** | **58.9%** | **67.3%** | [`yolov4-p6_.pt`](https://github.com/WongKinYiu/ScaledYOLOv4/releases/download/weights/yolov4-p6_.pt) |\n| **YOLOv4-P6** (+BoF) | TTA | **54.8%** | **72.6%** | **60.0%** | **40.6%** | **59.1%** | **68.2%** | - |\n| **YOLOv4-P6** (+BoF*) | 1280 | **54.7%** | **72.9%** | **60.0%** | **39.4%** | **59.2%** | **68.3%** |  |\n| **YOLOv4-P6** (+BoF*) | TTA | **55.3%** | **73.2%** | **60.8%** | **40.5%** | **59.9%** | **69.4%** | - |\n|  |  |  |  |  |  |  |  |\n| **YOLOv4-P7** | 1536 | **55.0%** | **72.9%** | **60.2%** | **39.8%** | **59.9%** | **68.4%** | [`yolov4-p7.pt`](https://github.com/WongKinYiu/ScaledYOLOv4/releases/download/weights/yolov4-p7.pt)  |\n| **YOLOv4-P7** | TTA | **55.5%** | **72.9%** | **60.8%** | **41.1%** | **60.3%** | **68.9%** | - |\n|  |  |  |  |  |  |  |  |\n\n| Model | Test Size | AP\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003e50\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003e75\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eS\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eM\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e | AP\u003csub\u003eL\u003c/sub\u003e\u003csup\u003eval\u003c/sup\u003e |\n| :-- | :-: | :-: | :-: | :-: | :-: | :-: | :-: |\n| **YOLOv4-P6-attention** | 1280 | **54.3%** | **72.3%** | **59.6%** | **38.7%** | **58.9%** | **66.6%** |\n\n## Installation\n\n```\n# create the docker container, you can change the share memory size if you have more.\nnvidia-docker run --name yolov4_csp -it -v your_coco_path/:/coco/ -v your_code_path/:/yolo --shm-size=64g nvcr.io/nvidia/pytorch:20.06-py3\n\n# install mish-cuda, if you use different pytorch version, you could try https://github.com/thomasbrandon/mish-cuda\ncd /\ngit clone https://github.com/JunnYu/mish-cuda\ncd mish-cuda\npython setup.py build install\n\n# go to code folder\ncd /yolo\n```\n\n## Testing\n\n```\n# download {yolov4-p5.pt, yolov4-p6.pt, yolov4-p7.pt} and put them in /yolo/weights/ folder.\npython test.py --img 896 --conf 0.001 --batch 8 --device 0 --data coco.yaml --weights weights/yolov4-p5.pt\npython test.py --img 1280 --conf 0.001 --batch 8 --device 0 --data coco.yaml --weights weights/yolov4-p6.pt\npython test.py --img 1536 --conf 0.001 --batch 8 --device 0 --data coco.yaml --weights weights/yolov4-p7.pt\n```\n\nYou will get following results:\n```\n# yolov4-p5\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.51244\n Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.69771\n Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.56180\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.35021\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.56247\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.63983\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.38530\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.64048\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.69801\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.55487\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.74368\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.82826\n```\n```\n# yolov4-p6\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.53857\n Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.72015\n Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.59025\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.39285\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.58283\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.66580\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.39552\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.66504\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.72141\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.59193\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.75844\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.83981\n```\n```\n# yolov4-p7\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.55046\n Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.72925\n Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.60224\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.39836\n Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.59854\n Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.68405\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.40256\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.66929\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.72943\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.59943\n Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.76873\n Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.84460\n```\n\n## Training\n\nWe use multiple GPUs for training.\n{YOLOv4-P5, YOLOv4-P6, YOLOv4-P7} use input resolution {896, 1280, 1536} for training respectively.\n```\n# yolov4-p5\npython -m torch.distributed.launch --nproc_per_node 4 train.py --batch-size 64 --img 896 896 --data coco.yaml --cfg yolov4-p5.yaml --weights '' --sync-bn --device 0,1,2,3 --name yolov4-p5\npython -m torch.distributed.launch --nproc_per_node 4 train.py --batch-size 64 --img 896 896 --data coco.yaml --cfg yolov4-p5.yaml --weights 'runs/exp0_yolov4-p5/weights/last_298.pt' --sync-bn --device 0,1,2,3 --name yolov4-p5-tune --hyp 'data/hyp.finetune.yaml' --epochs 450 --resume\n```\n\nIf your training process stucks, it due to bugs of the python.\nJust `Ctrl+C` to stop training and resume training by:\n```\n# yolov4-p5\npython -m torch.distributed.launch --nproc_per_node 4 train.py --batch-size 64 --img 896 896 --data coco.yaml --cfg yolov4-p5.yaml --weights 'runs/exp0_yolov4-p5/weights/last.pt' --sync-bn --device 0,1,2,3 --name yolov4-p5 --resume\n```\n\n## Citation\n\n```\n@InProceedings{Wang_2021_CVPR,\n    author    = {Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},\n    title     = {{Scaled-YOLOv4}: Scaling Cross Stage Partial Network},\n    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    month     = {June},\n    year      = {2021},\n    pages     = {13029-13038}\n}\n```\n\n## Acknowledgements\n\n\u003cdetails\u003e\u003csummary\u003e \u003cb\u003eExpand\u003c/b\u003e \u003c/summary\u003e\n\n* [https://github.com/AlexeyAB/darknet](https://github.com/AlexeyAB/darknet)\n* [https://github.com/WongKinYiu/PyTorch_YOLOv4](https://github.com/WongKinYiu/PyTorch_YOLOv4)\n* [https://github.com/ultralytics/yolov3](https://github.com/ultralytics/yolov3)\n* [https://github.com/ultralytics/yolov5](https://github.com/ultralytics/yolov5)\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWongKinYiu%2FScaledYOLOv4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWongKinYiu%2FScaledYOLOv4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWongKinYiu%2FScaledYOLOv4/lists"}