Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBB detection failed with SAHI for small object detection #1679

Open
1 task done
ERYAGNIK003 opened this issue Nov 22, 2024 · 0 comments
Open
1 task done

OBB detection failed with SAHI for small object detection #1679

ERYAGNIK003 opened this issue Nov 22, 2024 · 0 comments
Labels
question Further information is requested

Comments

@ERYAGNIK003
Copy link

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

@ERYAGNIK003 ERYAGNIK003 added the question Further information is requested label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant