{"id":23102677,"url":"https://github.com/dataxujing/scaledyolov4","last_synced_at":"2025-08-16T14:33:03.357Z","repository":{"id":112306078,"uuid":"314972205","full_name":"DataXujing/ScaledYOLOv4","owner":"DataXujing","description":":fire::fire::fire: Scaled-YOLOv4训练自己的数据集详细教程PDF，关于paper解读请联系小编获取PDF文档","archived":false,"fork":false,"pushed_at":"2021-03-01T13:03:30.000Z","size":6032,"stargazers_count":73,"open_issues_count":10,"forks_count":23,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-29T11:15:23.659Z","etag":null,"topics":["object-detection","pytorch","scaledyolov4","yolov4-large"],"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/DataXujing.png","metadata":{"files":{"readme":"README-model.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-22T06:11:59.000Z","updated_at":"2024-08-13T07:25:27.000Z","dependencies_parsed_at":"2023-05-12T18:30:34.342Z","dependency_job_id":null,"html_url":"https://github.com/DataXujing/ScaledYOLOv4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DataXujing/ScaledYOLOv4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FScaledYOLOv4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FScaledYOLOv4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FScaledYOLOv4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FScaledYOLOv4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataXujing","download_url":"https://codeload.github.com/DataXujing/ScaledYOLOv4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataXujing%2FScaledYOLOv4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270723411,"owners_count":24634375,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["object-detection","pytorch","scaledyolov4","yolov4-large"],"created_at":"2024-12-17T00:00:19.008Z","updated_at":"2025-08-16T14:33:03.343Z","avatar_url":"https://github.com/DataXujing.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"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## 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/JunnYu/mish-cuda\ncd /\ngit clone https://github.com/thomasbrandon/mish-cuda\ncd mish-cuda\npython setup.py build install\n\n# go to code folder\ncd /yolo\n```\n\nFor using pre-trained models:\n```\ncd /yolo\ngit clone https://github.com/thomasbrandon/mish-cuda mc\ncd mc\n\n# change all of name which is mish_cuda to mish_mish and build.\n# 1. mc/src/mish_cuda -\u003e mc/src/mish_mish\n# 2. mc/csrc/mish_cuda.cpp -\u003e mc/csrc/mish_mish.cpp\n# 3. in mc/setup.py\n#   3.1 line 5 -\u003e 'csrc/mish_mish.cpp'\n#   3.2 line 11 -\u003e name='mish_mish'\n#   3.3 line 20 -\u003e 'mish_mish._C'\n\npython setup.py build\n# rename mc/build/lib.xxx folder to mc/build/lib\n\n# modify import in models/common.py\n# line 7 -\u003e \nfrom mc.build.lib.mish_mish import MishCuda as Mish\n```\n\n## Testing\n\n[`yolov4-p5.pt`](https://drive.google.com/file/d/1aXZZE999sHMP1gev60XhNChtHPRMH3Fz/view?usp=sharing) [`yolov4-p6.pt`](https://drive.google.com/file/d/1aB7May8oPYzBqbgwYSZHuATPXyxh9xnf/view?usp=sharing) [`yolov4-p7.pt`](https://drive.google.com/file/d/18fGlzgEJTkUEiBG4hW00pyedJKNnYLP3/view?usp=sharing) \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@article{wang2020scaled,\n  title={{Scaled-YOLOv4}: Scaling Cross Stage Partial Network},\n  author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},\n  journal={arXiv preprint arXiv:2011.08036},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataxujing%2Fscaledyolov4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdataxujing%2Fscaledyolov4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataxujing%2Fscaledyolov4/lists"}