─░├žeri─če ge├ž

Model Birle┼čtirme

­čôÜ Bu k─▒lavuz, geli┼čmi┼č mAP ve Geri ├ça─č─▒rma i├žin test ve ├ž─▒kar─▒m s─▒ras─▒nda YOLOv5 ­čÜÇ model toplulu─čunun nas─▒l kullan─▒laca─č─▒n─▒ a├ž─▒klar.

https://en.wikipedia.org/wiki/Ensemble_learning adresinden:

Topluluk modellemesi, bir├žok farkl─▒ modelleme algoritmas─▒ veya farkl─▒ e─čitim veri setleri kullan─▒larak bir sonucu tahmin etmek i├žin birden fazla farkl─▒ modelin olu┼čturuldu─ču bir s├╝re├žtir. Topluluk modeli daha sonra her bir temel modelin tahminini toplar ve g├Âr├╝lmeyen veriler i├žin bir kez nihai tahminle sonu├žlan─▒r. Topluluk modellerini kullanma motivasyonu, tahminin genelleme hatas─▒n─▒ azaltmakt─▒r. Temel modeller ├že┼čitli ve ba─č─▒ms─▒z oldu─ču s├╝rece, topluluk yakla┼č─▒m─▒ kullan─▒ld─▒─č─▒nda modelin tahmin hatas─▒ azal─▒r. Yakla┼č─▒m, bir tahminde bulunurken kalabal─▒klar─▒n bilgeli─čini arar. Topluluk modeli, i├žinde birden fazla temel model bar─▒nd─▒rsa da tek bir model gibi davran─▒r ve performans g├Âsterir.

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

Topluluk olu┼čturmadan ├Ânce tek bir modelin temel performans─▒n─▒ belirlemek istiyoruz. Bu komut YOLOv5x'i 640 piksel g├Âr├╝nt├╝ boyutunda COCO val2017 ├╝zerinde 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=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, 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
YOLOv5 ­čÜÇ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB)

Fusing layers...
Model Summary: 476 layers, 87730285 parameters, 0 gradients

val: Scanning '../datasets/coco/val2017' images and labels...4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:01<00:00, 2846.03it/s]
val: New cache created: ../datasets/coco/val2017.cache
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95: 100% 157/157 [02:30<00:00,  1.05it/s]
                 all       5000      36335      0.746      0.626       0.68       0.49
Speed: 0.1ms pre-process, 22.4ms inference, 1.4ms NMS per image at shape (32, 3, 640, 640)  # <--- baseline speed

Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...
...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.504  # <--- baseline mAP
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.688
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.546
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.351
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.551
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.644
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.382
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.628
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.681  # <--- baseline mAR
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.826

Topluluk Testi

Birden fazla ├Ân e─čitimli model, test ve ├ž─▒kar─▒m zaman─▒nda, sadece ekstra modeller ekleyerek bir araya getirilebilir. --weights arg├╝man─▒n─▒ mevcut herhangi bir val.py veya detect.py komutunda kullanabilirsiniz. Bu ├Ârnek, 2 modelden olu┼čan bir toplulu─ču birlikte test eder:

  • YOLOv5x
  • YOLOv5l6
python val.py --weights yolov5x.pt yolov5l6.pt --data coco.yaml --img 640 --half

Çıktı:

val: data=./data/coco.yaml, weights=['yolov5x.pt', 'yolov5l6.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, task=val, device=, 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
YOLOv5 ­čÜÇ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB)

Fusing layers...
Model Summary: 476 layers, 87730285 parameters, 0 gradients  # Model 1
Fusing layers...
Model Summary: 501 layers, 77218620 parameters, 0 gradients  # Model 2
Ensemble created with ['yolov5x.pt', 'yolov5l6.pt']  # Ensemble notice

val: Scanning '../datasets/coco/val2017.cache' images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:00<00:00, 49695545.02it/s]
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95: 100% 157/157 [03:58<00:00,  1.52s/it]
                 all       5000      36335      0.747      0.637      0.692      0.502
Speed: 0.1ms pre-process, 39.5ms inference, 2.0ms NMS per image at shape (32, 3, 640, 640)  # <--- ensemble speed

Evaluating pycocotools mAP... saving runs/val/exp3/yolov5x_predictions.json...
...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.515  # <--- ensemble mAP
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.699
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.557
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.356
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.563
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.668
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.387
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.638
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.689  # <--- ensemble mAR
 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.743
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.844

Topluluk Çıkarsaması

Ekstra modelleri --weights topluluk ├ž─▒kar─▒m─▒n─▒ ├žal─▒┼čt─▒rmak i├žin arg├╝man:

python detect.py --weights yolov5x.pt yolov5l6.pt --img 640 --source data/images

Çıktı:

YOLOv5 ­čÜÇ v5.0-267-g6a3ee7c torch 1.9.0+cu102 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB)

Fusing layers...
Model Summary: 476 layers, 87730285 parameters, 0 gradients
Fusing layers...
Model Summary: 501 layers, 77218620 parameters, 0 gradients
Ensemble created with ['yolov5x.pt', 'yolov5l6.pt']

image 1/2 /content/yolov5/data/images/bus.jpg: 640x512 4 persons, 1 bus, 1 tie, Done. (0.063s)
image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 3 persons, 2 ties, Done. (0.056s)
Results saved to runs/detect/exp2
Done. (0.223s)

YOLO ├ž─▒kar─▒m sonucu

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 (6)

Yorumlar