yolov8-p2.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
  2. # Ultralytics YOLOv8 object detection model with P2/4 - P5/32 outputs
  3. # Model docs: https://docs.ultralytics.com/models/yolov8
  4. # Task docs: https://docs.ultralytics.com/tasks/detect
  5. # Parameters
  6. nc: 80 # number of classes
  7. scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n'
  8. # [depth, width, max_channels]
  9. n: [0.33, 0.25, 1024]
  10. s: [0.33, 0.50, 1024]
  11. m: [0.67, 0.75, 768]
  12. l: [1.00, 1.00, 512]
  13. x: [1.00, 1.25, 512]
  14. # YOLOv8.0 backbone
  15. backbone:
  16. # [from, repeats, module, args]
  17. - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  18. - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4
  19. - [-1, 3, C2f, [128, True]]
  20. - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8
  21. - [-1, 6, C2f, [256, True]]
  22. - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16
  23. - [-1, 6, C2f, [512, True]]
  24. - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32
  25. - [-1, 3, C2f, [1024, True]]
  26. - [-1, 1, SPPF, [1024, 5]] # 9
  27. # YOLOv8.0-p2 head
  28. head:
  29. - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  30. - [[-1, 6], 1, Concat, [1]] # cat backbone P4
  31. - [-1, 3, C2f, [512]] # 12
  32. - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  33. - [[-1, 4], 1, Concat, [1]] # cat backbone P3
  34. - [-1, 3, C2f, [256]] # 15 (P3/8-small)
  35. - [-1, 1, nn.Upsample, [None, 2, "nearest"]]
  36. - [[-1, 2], 1, Concat, [1]] # cat backbone P2
  37. - [-1, 3, C2f, [128]] # 18 (P2/4-xsmall)
  38. - [-1, 1, Conv, [128, 3, 2]]
  39. - [[-1, 15], 1, Concat, [1]] # cat head P3
  40. - [-1, 3, C2f, [256]] # 21 (P3/8-small)
  41. - [-1, 1, Conv, [256, 3, 2]]
  42. - [[-1, 12], 1, Concat, [1]] # cat head P4
  43. - [-1, 3, C2f, [512]] # 24 (P4/16-medium)
  44. - [-1, 1, Conv, [512, 3, 2]]
  45. - [[-1, 9], 1, Concat, [1]] # cat head P5
  46. - [-1, 3, C2f, [1024]] # 27 (P5/32-large)
  47. - [[18, 21, 24, 27], 1, Detect, [nc]] # Detect(P2, P3, P4, P5)