Skip to content

OBB detection failed with SAHI for small object detection #1679

@ERYAGNIK003

Description

@ERYAGNIK003

Search before asking

  • I have searched the Supervision issues and found no similar feature requests.

Question

I am working on vehicle detection in traffic scene. I have used YOLOv11x-obb (pre-trained on DOTAv1) for vehicle detection. I tried SAHI so I can detect small vehicles successfully but it failed. I used codes from #1394. I have attached codes and results. Please guide me How to improve detection with SAHI.

Platform details:

  • Ultralytics 8.3.35 🚀 Python-3.10.12 torch-2.5.1+cu121 CPU (Intel Xeon 2.20GHz)
  • Supervision version: 0.25.0

YOLO prediction without SAHI:

from ultralytics import YOLO
import cv2
from PIL import Image

model = YOLO("yolo11x-obb.pt")  
model.hide_labels = True
model.hide_conf = True
results=model.predict("img.png",show_labels=False)
img = results[0].plot(labels=False, conf=False)
cv2_imshow(img)

yolo

YOLO prediction with SAHI

import cv2
import supervision as sv
from ultralytics import YOLO
import numpy as np

image = cv2.imread("img.png")
model = YOLO("yolo11x-obb.pt")

def callback(image_slice: np.ndarray) -> sv.Detections:
    result = model(image_slice)[0]
    return sv.Detections.from_ultralytics(result)

slicer = sv.InferenceSlicer(callback = callback,overlap_filter="NON_MAX_SUPPRESSION")
detections = slicer(image)
 
oriented_box_annotator = sv.OrientedBoxAnnotator()
annotated_frame = oriented_box_annotator.annotate(
    scene=image.copy(),
    detections=detections
)
sv.plot_image(annotated_frame)

sahi

Additional

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions