YOLOv8 P2 and P6 variants for small object detection #8227
Replies: 3 comments 10 replies
-
Hello! I'm glad to hear you're exploring the P2 and P6 variants for small object detection. 🕵️♂️ The P2 and P6 variants refer to the strides of the feature pyramids used in the models. The P2 models have a stride of 2, meaning they preserve more fine-grained spatial details, which can be beneficial for detecting smaller objects. On the other hand, P6 models have a stride of 6, which makes them more suited for larger objects as they capture higher-level features. For small object detection, P2 variants are typically more effective due to their finer feature maps. However, using P6 won't necessarily improve small object detection; it might even hinder it because of the coarser feature maps. The tradeoffs when using these specialized models usually involve a balance between speed and accuracy. P2 models might be slower but better for small objects, while P6 models could be faster but less precise for small details. Here's a simple example of how you might train a P2 model: from ultralytics import YOLO
# Load a P2 model
model = YOLO('yolov8n-p2.pt')
# Train the model on your dataset
model.train(data='your_dataset.yaml', epochs=50, imgsz=1920) Remember to adjust the |
Beta Was this translation helpful? Give feedback.
-
Hi @glenn-jocher
|
Beta Was this translation helpful? Give feedback.
-
Hello, right now I'm facing a problem. When I use YOLOv8 to detect my object, which is 20x70 (w*h), in an image sized 896x544, the results are good. However, when I try to detect an object that is 5x40 in an image sized 1024x600, the results are poor. I also tried using yolov8x-pose-p2, but it didn't meet my needs. When I increase the bounding box size to 8x40, the results improve, but the extra part of the bounding box contains background, which doesn't provide any additional information. I believe this is because the object is too small. If I want to detect objects smaller than what P2 can handle, what should I do? Should I change the model's YAML configuration? |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you for your time. I am training a model to detect small objects (as small as 10px in width) in large images (1920x1080). I saw in a similar forum post someone recommended using one of the yolov8-p2 models to improve performance on small objects. I tried them and indeed they perform better, but I still have subpar results. Looking at the models list inside of the Ultralytics library, I see there is a P6 variant. I know P2 and P6 relates to feature pyramids in some way, but I found very little information regarding P2 online, and none at all for P6. Maybe I'm looking it up wrong. Can you shed some light on what exactly is different about these models compared to the normal versions? What are the tradeoffs when using these? Will the P6 variants increase performance on small objects further?
Beta Was this translation helpful? Give feedback.
All reactions