─░├žeri─če ge├ž

Budama/Sparsity E─čitimi

­čôÜ Bu k─▒lavuz, YOLOv5 ­čÜÇ modellerine budaman─▒n nas─▒l uygulanaca─č─▒n─▒ a├ž─▒klamaktad─▒r.

Ba┼člamadan ├ľnce

Repoyu klonlay─▒n ve requirements.txt dosyas─▒n─▒ bir Python>=3.8.0 ortam─▒ dahil olmak ├╝zere PyTorch>=1.8. Modeller ve veri setleri en son YOLOv5 s├╝r├╝m├╝nden otomatik olarak indirilir.

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Normal Test

Budamadan ├Ânce kar┼č─▒la┼čt─▒rma yapabilece─čimiz bir temel performans belirlemek istiyoruz. Bu komut YOLOv5x'i COCO val2017 ├╝zerinde 640 piksel g├Âr├╝nt├╝ boyutunda test eder. yolov5x.pt mevcut en b├╝y├╝k ve en do─čru modeldir. Di─čer se├ženekler yolov5s.pt, yolov5m.pt ve yolov5l.ptveya ├Âzel bir veri k├╝mesinin e─čitiminden elde etti─činiz kendi kontrol noktan─▒z ./weights/best.pt. Mevcut t├╝m modellerle ilgili ayr─▒nt─▒lar i├žin l├╝tfen README'ye bak─▒n masa.

python val.py --weights yolov5x.pt --data coco.yaml --img 640 --half

Çıktı:

val: data=/content/yolov5/data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True, dnn=False
YOLOv5 ­čÜÇ v6.0-224-g4c40933 torch 1.10.0+cu111 CUDA:0 (Tesla V100-SXM2-16GB, 16160MiB)

Fusing layers...
Model Summary: 444 layers, 86705005 parameters, 0 gradients
val: Scanning '/content/datasets/coco/val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupt: 100% 5000/5000 [00:00<?, ?it/s]
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95: 100% 157/157 [01:12<00:00,  2.16it/s]
                 all       5000      36335      0.732      0.628      0.683      0.496
Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640)  # <--- base speed

Evaluating pycocotools mAP... saving runs/val/exp2/yolov5x_predictions.json...
...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.507  # <--- base mAP
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.689
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.552
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.345
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.559
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.652
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.381
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.630
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.682
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.526
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.731
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.829
Results saved to runs/val/exp

YOLOv5x'i COCO ├╝zerinde test edin (0,30 seyreklik)

Yukar─▒daki testi budanm─▒┼č bir modelle tekrarlamak i├žin torch_utils.prune() Komut. G├╝ncelliyoruz val.py YOLOv5x'i 0,3 seyrekli─če kadar budamak i├žin:

Ekran g├Âr├╝nt├╝s├╝ 2022-02-02 saat 22 54 18

30 budanm─▒┼č ├ž─▒kt─▒:

val: data=/content/yolov5/data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True, dnn=False
YOLOv5 ­čÜÇ v6.0-224-g4c40933 torch 1.10.0+cu111 CUDA:0 (Tesla V100-SXM2-16GB, 16160MiB)

Fusing layers...
Model Summary: 444 layers, 86705005 parameters, 0 gradients
Pruning model...  0.3 global sparsity
val: Scanning '/content/datasets/coco/val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupt: 100% 5000/5000 [00:00<?, ?it/s]
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95: 100% 157/157 [01:11<00:00,  2.19it/s]
                 all       5000      36335      0.724      0.614      0.671      0.478
Speed: 0.1ms pre-process, 5.2ms inference, 1.7ms NMS per image at shape (32, 3, 640, 640)  # <--- prune mAP

Evaluating pycocotools mAP... saving runs/val/exp3/yolov5x_predictions.json...
...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.489  # <--- prune mAP
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.677
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.537
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.334
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.542
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.635
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.370
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.612
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.664
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.496
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.722
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.803
Results saved to runs/val/exp3

Sonu├žlarda, a┼ča─č─▒daki sonu├žlara ula┼čt─▒─č─▒m─▒z─▒ g├Âzlemleyebiliriz 30'un seyrekli─či Bu da modelin a─č─▒rl─▒k parametrelerinin %30'unun budama i┼čleminden sonra nn.Conv2d katmanlar─▒ 0'a e┼čittir. ├ç─▒kar─▒m s├╝resi esasen de─či┼čmezmodelin AP ve AR puanlar─▒ biraz daha d├╝┼č├╝k.

Desteklenen Ortamlar

Ultralytics her biri CUDA, CUDNN gibi temel ba─č─▒ml─▒l─▒klarla ├Ânceden y├╝klenmi┼č bir dizi kullan─▒ma haz─▒r ortam sa─člar, Pythonve PyTorchProjelerinizi ba┼člatmak i├žin.

Proje Durumu

YOLOv5 CI

Bu rozet, t├╝m YOLOv5 GitHub Actions S├╝rekli Entegrasyon (CI) testlerinin ba┼čar─▒yla ge├žti─čini g├Âsterir. Bu CI testleri, YOLOv5 'un i┼člevselli─čini ve performans─▒n─▒ ├že┼čitli temel y├Ânlerden titizlikle kontrol eder: e─čitim, do─črulama, ├ž─▒kar─▒m, d─▒┼ča aktarma ve k─▒yaslamalar. Her 24 saatte bir ve her yeni i┼člemde yap─▒lan testlerle macOS, Windows ve Ubuntu ├╝zerinde tutarl─▒ ve g├╝venilir ├žal─▒┼čma sa─člarlar.



Created 2023-11-12, Updated 2024-06-02
Authors: glenn-jocher (3)

Yorumlar