-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Clarification of obb behaviour with InferenceSlicer #1394
Comments
Hi, @robmarkcole 👋🏻 Lots to unpack here.
|
Thanks @SkalskiP these results are much better! image_path = "my.png"
image = np.array(Image.open(image_path))
def callback(image_slice: np.ndarray) -> sv.Detections:
result = model(image_slice)[0]
return sv.Detections.from_ultralytics(result)
slicer = sv.InferenceSlicer(callback = callback, slice_wh=(768, 768))
detections = slicer(image)
detections = detections[detections.class_id == 1] # ships id in DOTA
oriented_box_annotator = sv.OrientedBoxAnnotator()
label_annotator = sv.LabelAnnotator()
annotated_image = oriented_box_annotator.annotate(scene=image, detections=detections)
annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections) |
@robmarkcole that is true; this looks a lot better! There is still room for improvement. Especially where it comes to post-processing and merging double detections. We don't have that component yet for OBB. Can I close the issue? |
model = YOLO("/root/autodl-tmp/code/ultralytics/runs/obb/train/weights/best.pt") image_path = "/root/autodl-tmp/DOTA/images/test/P1068.png" def callback(image_slice: np.ndarray) -> sv.Detections: slicer = sv.InferenceSlicer(callback = callback) oriented_box_annotator = sv.OrientedBoxAnnotator() annotated_image = oriented_box_annotator.annotate(scene=image, detections=detections) annotated_pil_image = Image.fromarray(annotated_image) @SkalskiP Why doesn't the target box display at the correct scale when drawing with OrientedBoxAnnotator? |
I believe we have a fix in the Did you try this? |
@LinasKo Yes, that's how I do it. |
@LinasKo I checked the saved CSV file and found that the coordinates were all relative to the pixel position of the slice (up to 640), without considering the position of the slice itself. |
Hi @050603 👋🏻 is there any chance you could provide us with your model and image? |
Search before asking
Question
Based on reviewing source code, I understand that with an obb model, the regular box enclosing the obb box is used with SAHI. As a result, merged regular boxes, and not obb boxes are returned. I wanted to confirm this, and suggest a note is added in the docs.
I also want to know if this could be responsible for the odd predictions below - perhaps the enclosing boxes are not merged correctly:
Additional
No response
The text was updated successfully, but these errors were encountered: