Ultralytics YOLO를 사용한 방향 지정 바운딩 박스 감지
방향성 객체 감지는 추가 각도를 사용해 이미지에서 객체의 위치를 더 정확히 파악하므로 표준 객체 감지보다 한 단계 더 발전한 방식입니다.
방향성 객체 감지기의 출력은 이미지 속 객체를 정밀하게 둘러싸는 회전된 바운딩 박스 집합이며, 각 박스의 클래스 레이블과 신뢰도 점수도 포함됩니다. 방향성 바운딩 박스는 객체가 여러 각도로 나타나는 경우에 특히 유용합니다. 예를 들어 항공 영상에서는 기존의 축 정렬 바운딩 박스가 불필요한 배경을 포함할 수 있습니다. 일반적인 사용 사례로는 위성 및 드론 영상에서 선박과 차량 감지, 도시 계획을 위한 건물 및 기반 시설 분석, 작물 모니터링, 태양광 패널 또는 풍력 터빈 검사 등이 있습니다.
시청: Ultralytics YOLO26 방향 경계 상자(OBB)로 객체를 감지하고 추적하는 방법 | 선박 추적 🚢
YOLO26 OBB 모델은 -obb 접미사를 사용합니다(예: yolo26n-obb.pt). 이 모델은 DOTAv1으로 사전 학습되었습니다.
| OBB를 사용한 선박 감지 | OBB를 사용한 차량 감지 |
|---|---|
![]() | ![]() |
모델#
DOTAv1 데이터셋으로 사전 학습된 YOLO26 OBB 모델은 아래와 같습니다.
모델은 처음 사용할 때 최신 Ultralytics 릴리스에서 자동으로 다운로드됩니다.
DOTAv1 이미지와 주석은 학술적 용도로만 사용할 수 있으며 상업적 사용은 금지됩니다. Ultralytics는 이러한 제한이 사전 학습 또는 미세 조정된 모델 가중치가 아니라 원본 데이터셋에 적용되는 것으로 해석합니다. 사용 목적에 맞는 DOTA 약관을 확인하세요.
| 모델 | 크기 (픽셀) | mAP테스트50-95 (e2e) | mAP테스트50 (e2e) | 속도 CPU ONNX (ms) | 속도 T4 TensorRT10 (ms) | 파라미터 (M) | FLOPs (B) |
|---|---|---|---|---|---|---|---|
| YOLO26n-obb | 1024 | 52.4 | 78.9 | 97.7 ± 0.9 | 2.8 ± 0.0 | 2.4 | 14.8 |
| YOLO26s-obb | 1024 | 54.8 | 80.9 | 218.0 ± 1.4 | 4.9 ± 0.1 | 9.8 | 56.7 |
| YOLO26m-obb | 1024 | 55.3 | 81.0 | 579.2 ± 3.8 | 10.2 ± 0.3 | 21.2 | 184.9 |
| YOLO26l-obb | 1024 | 56.2 | 81.6 | 735.6 ± 3.1 | 13.0 ± 0.2 | 25.6 | 232.4 |
| YOLO26x-obb | 1024 | 56.7 | 81.7 | 1485.7 ± 11.5 | 30.5 ± 0.9 | 57.6 | 520.1 |
- mAPtest 값은 DOTAv1 데이터셋에서 단일 모델, 멀티스케일로 측정한 값입니다.
yolo obb val data=DOTAv1.yaml device=0 split=test nms=False save_json=True로 재현한 후 병합 결과를 DOTA 평가에 제출하세요. - 속도는 CPU에서 ONNX를 사용하고 NVIDIA T4 GPU에서 TensorRT10을 사용하여 DOTAv1 검증 이미지의 평균값을 측정했습니다.
yolo obb val data=DOTAv1.yaml batch=1 device=0|cpu nms=False로 재현할 수 있습니다. - Params 및 FLOPs 값은 Conv/BatchNorm 폴딩과 사용하지 않는 감지 브랜치 제거 후의 융합 모델 기준입니다. 사전 학습된 체크포인트에는 전체 학습 아키텍처가 유지되므로 값이 더 높을 수 있습니다.
예비 DOTAv1 결과는 미출시 YOLO27 미리 보기를 참조하세요.
학습#
이미지 크기 640으로 DOTA8 데이터셋에서 100 에포크 동안 YOLO26n-obb 모델을 학습합니다.
OBB와 180° 회전한 OBB는 동일하므로 회전은 180°를 기준으로 정의되며 박스에는 방향이 없습니다. 학습 라벨은 긴 변을 기준으로 정규화됩니다. 박스 너비 w는 긴 변이며, 각도는 양의 x축에서 w 변의 방향까지 시계 방향으로 측정하고 라디안 단위로 [-π/4, 3π/4) ([-45°, 135°))에 저장됩니다. 예측은 정규화되지 않으므로 예측 박스에서 짧은 변이 w로 표시될 수 있습니다. 결과 출력을 참조하세요. [0°, 90°) 형식은 정규화된 DOTA 스타일 규칙이며 학습이나 추론에는 적용되지 않습니다.
from ultralytics import YOLO
# 모델 로드
model = YOLO("yolo26n-obb.yaml") # YAML에서 새 모델을 생성합니다.
model = YOLO("yolo26n-obb.pt") # 사전 학습된 모델을 불러옵니다(학습에 권장).
model = YOLO("yolo26n-obb.yaml").load("yolo26n-obb.pt") # YAML에서 모델을 생성하고 가중치를 전이합니다.
# 모델 학습
results = model.train(data="dota8.yaml", epochs=100, imgsz=640)시청: Ultralytics Platform을 사용하여 DOTA 데이터셋에서 Ultralytics YOLO-OBB(방향 경계 상자) 모델을 학습하는 방법
전체 train 모드 세부 정보는 학습 페이지를 참조하세요. Ultralytics Platform 클라우드 학습을 사용하여 OBB 모델을 학습할 수도 있습니다.
데이터셋 형식#
OBB 데이터셋 형식에 대한 자세한 내용은 데이터셋 가이드를 참조하세요. YOLO OBB 형식에서는 다음 구조에 따라 네 모서리의 좌표를 0과 1 사이로 정규화하여 바운딩 박스를 지정합니다. Ultralytics Platform 주석은 전용 방향 지정 바운딩 박스 그리기 도구와 OBB 라벨을 지원합니다.
class_index x1 y1 x2 y2 x3 y3 x4 y4내부적으로 YOLO는 손실과 출력을 xywhr 형식으로 처리합니다. 이 형식은 바운딩 박스의 중심점(xy), 너비, 높이, 회전을 나타냅니다.
검증#
DOTA8 데이터셋에서 학습된 YOLO26n-obb 모델의 정확도를 평균 정밀도(mAP)로 측정해 검증합니다. 검증에서 의도한 데이터셋 YAML을 사용하도록 data을 명시적으로 전달하세요.
from ultralytics import YOLO
# 모델 로드
model = YOLO("yolo26n-obb.pt") # 공식 모델을 불러옵니다
model = YOLO("path/to/best.pt") # 사용자 지정 모델 로드
# 모델을 검증합니다
metrics = model.val(data="dota8.yaml") # DOTA8 데이터셋에서 검증
metrics.box.map # map50-95(B)
metrics.box.map50 # map50(B)
metrics.box.map75 # map75(B)
metrics.box.maps # 클래스별 mAP50-95(B); val 세트에 없는 클래스는 전체 mAP(B) 값을 사용합니다
metrics.box.ap_class_index # 실제로 평가된 클래스 인덱스
metrics.box.image_metrics # 정밀도, 재현율, F1, TP, FP, FN이 포함된 이미지별 지표 사전예측#
학습된 YOLO26n-obb 모델을 사용하여 이미지에서 예측을 수행합니다.
from ultralytics import YOLO
# 모델 로드
model = YOLO("yolo26n-obb.pt") # 공식 모델을 불러옵니다
model = YOLO("path/to/best.pt") # 사용자 지정 모델 로드
# 모델로 예측을 수행합니다
results = model("https://ultralytics.com/images/boats.jpg") # 이미지에 대해 예측을 수행합니다
# 결과에 액세스합니다
for result in results:
xywhr = result.obb.xywhr # 중심 x, 중심 y, 너비, 높이, 각도(라디안)
xyxyxyxy = result.obb.xyxyxyxy # 4개 점으로 구성된 다각형 형식
names = [result.names[cls.item()] for cls in result.obb.cls.int()] # 각 박스의 클래스 이름
confs = result.obb.conf # 각 박스의 신뢰도 점수Predict 페이지에서 predict 모드의 전체 세부 정보를 확인하세요.
save_crop=True을 전달하면 각 OBB의 박스 크기에 맞춰 회전 정렬된 크롭을 저장하며, ObjectCropper도 동일하게 작동합니다.
결과 출력#
방향 지정 바운딩 박스 감지는 이미지마다 Results 객체 하나를 반환합니다. 주요 예측 필드는 result.obb이며, 여기에는 감지된 각 객체의 회전 박스, 클래스 ID 및 신뢰도 점수가 포함됩니다.
| 속성 | 유형 | 형태 | 설명 |
|---|---|---|---|
result.obb | OBB | (N) | 회전된 박스입니다. |
result.obb.data | torch.float32 | (N,7/8) | 신뢰도/클래스 정보가 포함된 원시 회전 박스입니다. |
result.obb.xywhr | torch.float32 | (N,5) | xywhr 회전 박스입니다. |
result.obb.xyxyxyxy | torch.float32 | (N,4,2) | 네 개의 모서리 점입니다. |
result.obb.conf | torch.float32 | (N,) | 신뢰도 점수입니다. |
라벨은 긴 변 기준으로 정규화되지만 예측값은 그렇지 않으므로, result.obb.xywhr은 회전 각도를 짧은 변 기준으로 측정할 때 w이 h보다 작다고 보고할 수 있습니다. 두 형식은 동일한 사각형을 나타내므로 어느 쪽이든 result.obb.xyxyxyxy은 올바릅니다. 추적 시 각 트랙은 이전 각도와 가장 가까운 반회전 형식(θ 또는 θ ± π)을 유지하므로, 트랙 각도는 프레임 간에 π만큼 뒤집히지 않으며 [-π/4, 3π/4) 범위를 벗어날 수 있습니다. 후속 코드에서 긴 변 기준 형식이 필요한 경우 모서리를 다시 변환하되, 박스 매개변수를 다시 작성하면 모서리 순서가 순환 이동할 수 있다는 점에 유의하세요:
from ultralytics.utils.ops import xyxyxyxy2xywhr
xywhr = xyxyxyxy2xywhr(result.obb.xyxyxyxy) # w >= h, 회전 각도는 [-pi/4, 3pi/4)입니다모든 작업에서 작업별 Results 필드를 확인하려면 작업별 예측 결과 섹션을 참조하세요.
내보내기#
YOLO26n-obb 모델을 ONNX, CoreML 등 다른 형식으로 내보냅니다.
from ultralytics import YOLO
# 모델 로드
model = YOLO("yolo26n-obb.pt") # 공식 모델을 불러옵니다
model = YOLO("path/to/best.pt") # 사용자 지정 모델 로드
# 모델을 내보냅니다
model.export(format="onnx")사용 가능한 YOLO26-obb 내보내기 형식은 아래 표에 나와 있습니다. format 인수를 사용하면 원하는 형식으로 내보낼 수 있습니다(예: format='onnx' 또는 format='engine'). 내보낸 모델에서 바로 예측하거나 검증할 수 있습니다(예: yolo predict model=yolo26n-obb.onnx). 내보내기가 완료되면 모델 사용 예제가 표시됩니다.
| 형식 | format 인수 | 모델 | 메타데이터 | 인수 |
|---|---|---|---|---|
| PyTorch | - | yolo26n-obb.pt | ✅ | - |
| TorchScript | torchscript | yolo26n-obb.torchscript | ✅ | imgsz, quantize, dynamic, nms, batch, device |
| ONNX | onnx | yolo26n-obb.onnx | ✅ | imgsz, quantize, dynamic, simplify, opset, nms, batch, data, fraction, device |
| OpenVINO | openvino | yolo26n-obb_openvino_model/ | ✅ | imgsz, quantize, dynamic, nms, batch, data, fraction, device |
| TensorRT | engine | yolo26n-obb.engine | ✅ | imgsz, quantize, dynamic, simplify, opset, workspace, nms, batch, data, fraction, device |
| CoreML | coreml | yolo26n-obb.mlpackage | ✅ | imgsz, dynamic, quantize, nms, batch, device |
| Apple Core AI | coreai | yolo26n-obb.aimodel | ✅ | imgsz, batch, quantize |
| TF SavedModel | saved_model | yolo26n-obb_saved_model/ | ✅ | imgsz, quantize, opset, nms, batch, data, fraction, device |
| TF GraphDef | pb | yolo26n-obb.pb | ❌ | imgsz, opset, batch, device |
| TF Edge TPU | edgetpu | yolo26n-obb_edgetpu.tflite | ✅ | imgsz, quantize, opset, data, fraction, device |
| LiteRT | litert | yolo26n-obb.tflite | ✅ | imgsz, quantize, batch, data, fraction, device |
| PaddlePaddle | paddle | yolo26n-obb_paddle_model/ | ✅ | imgsz, batch, device |
| MNN | mnn | yolo26n-obb.mnn | ✅ | imgsz, batch, dynamic, quantize, simplify, opset, nms, device |
| NCNN | ncnn | yolo26n-obb_ncnn_model/ | ✅ | imgsz, quantize, device |
| IMX500 | imx | yolo11n_imx_model/ | ✅ | imgsz, quantize, data, fraction, nms, device |
| RKNN | rknn | yolo26n-obb_rknn_model/ | ✅ | imgsz, batch, name, quantize, simplify, opset, data, fraction, device |
| ExecuTorch | executorch | yolo26n-obb_executorch_model/ | ✅ | imgsz, quantize, batch, data, fraction, device |
| Axelera | axelera | yolo26n-obb_axelera_model/ | ✅ | imgsz, batch, quantize, data, fraction, device |
| DEEPX | deepx | yolo26n-obb_deepx_model/ | ✅ | imgsz, quantize, simplify, opset, data, optimize, device |
| Qualcomm QNN | qnn | yolo26n-obb_qnn.onnx | ✅ | imgsz, batch, name, quantize, simplify, opset, data, fraction, device |
| Hailo | hailo | yolo26n-obb_hailo_model/ | ✅ | imgsz, name, quantize, data, fraction, simplify, conf, iou, device |
| Huawei Ascend | ascend | yolo26n-obb_ascend_model/ | ✅ | imgsz, batch, name, quantize, opset, simplify, nms, device |
| AMD Xilinx | xilinx | yolo26n-obb_xilinx_model/ | ✅ | imgsz, name, quantize, data, fraction, opset, simplify, device |
| NXP | nxp | yolo26n-obb_nxp.tflite | ✅ | imgsz, quantize, data, fraction, device |
| ST Edge AI | stedgeai | yolo26n-obb_stedgeai.onnx | ✅ | imgsz, quantize, data, fraction, opset, simplify, device |
nms=None은 외부 NMS를 위해 기본적으로 원시 출력을 사용합니다(YOLO26은 Axelera에서 NMS가 필요 없는 헤드를 유지합니다). 사용 가능한 NMS가 필요 없는 헤드를 선택하려면 nms=False를 설정하세요. 지원되지 않는 형식은 해당 형식의 기본 출력 경로로 대체됩니다. 위의 nms 항목은 nms=True로 NMS를 포함할 수 있는 형식을 나타냅니다.
자세한 export 내용은 내보내기 페이지를 참조하세요.
자주 묻는 질문#
회전 경계 상자(OBB)에는 이미지에서 객체 위치를 더 정확하게 찾기 위한 각도가 추가됩니다. 축에 정렬된 직사각형인 일반 경계 상자와 달리 OBB는 객체의 방향에 더 잘 맞도록 회전할 수 있습니다. 이는 항공 이미지나 위성 이미지처럼 객체의 위치를 정밀하게 파악해야 하는 애플리케이션에 특히 유용합니다(데이터셋 가이드).
사용자 지정 데이터셋으로 YOLO26n-obb 모델을 학습하려면 아래 예제를 따라 Python 또는 CLI를 사용하세요.
예제from ultralytics import YOLO # 사전 학습된 모델 불러오기 model = YOLO("yolo26n-obb.pt") # 모델 학습 results = model.train(data="path/to/custom_dataset.yaml", epochs=100, imgsz=640)자세한 학습 인수는 구성 섹션을 확인하세요.
아래와 같이 Python 또는 CLI 명령을 사용하여 YOLO26n-obb 모델을 검증할 수 있습니다.
예제from ultralytics import YOLO # 모델 로드 model = YOLO("yolo26n-obb.pt") # 모델을 검증합니다 metrics = model.val(data="dota8.yaml")전체 검증 세부 정보는 Val 섹션을 참조하세요.
Python 또는 CLI를 사용하면 YOLO26-OBB 모델을 ONNX 형식으로 간편하게 내보낼 수 있습니다.
예제from ultralytics import YOLO # 모델 로드 model = YOLO("yolo26n-obb.pt") # 모델을 내보냅니다 model.export(format="onnx")다른 내보내기 형식과 자세한 내용은 Export 페이지를 참조하세요.
댓글252
질문을 하거나 결과를 공유하거나 다른 사람을 도와주세요.
zhouyizhuo
how to do Model Ensembling on yolov8-obb models?
2
Paula DerrengerUltralytics(수정됨)Model ensembling with YOLOv8-obb models involves combining the predictions from multiple trained models to improve the accuracy of your oriented objects detection. Currently, direct support for model ensembling within Ultralytics YOLO isn't provided out-of-the-box. However, you can manually implement ensembling by running predictions with each model separately and then combining these predictions.
One common approach is to average the bounding box coordinates and confidence scores of the same object detected by multiple models. Ensure to consider the rotating angle parameter unique to OBB models in your ensembling logic. Here's a basic conceptual example to get you started:
from ultralytics import YOLO models = [ YOLO('path/to/first_obb_model.pt'), YOLO('path/to/second_obb_model.pt'), # Add more models as needed ] # Assuming you have a method to read your images/videos image = 'path/to/image.jpg' # List to store results from all models all_preds = [] for model in models: results = model(image) all_preds.append(results[0].obb) # Extracting OBB predictions (xywhr, conf, cls) # Assuming you have a method `combine_predictions(all_preds)` # that combines predictions from all models final_predictions = combine_predictions(all_preds) # Process `final_predictions`...This example loads each model, runs predictions on the same image, and stores the results. You'd then need to implement
combine_predictions(all_preds)to handle the logic for combining these predictions based on criteria like IoU, confidence scores, etc., taking into account the angle for rotated bounding boxes.Remember, ensembling may increase inference time due to processing with multiple models. Always weigh the benefits of improved accuracy against potential increases in computational cost. Happy coding! 😊
windzu
if you want draw predict results to img and save , you can ref below easy code :
# you predict code # import cv2 image = cv2.imread(test_img_path) for r in results: xyxyxyxy = r.obb.xyxyxyxy.cpu().numpy() for box in xyxyxyxy: points = box.reshape(4, 2).astype(int) cv2.polylines(image, [points], isClosed=True, color=(0, 255, 0), thickness=2) cv2.imwrite("detected_image.jpg", image)1
Glenn JocherUltralytics@windzu thank you for sharing the code example. For more details on using YOLOv8 Oriented Bounding Boxes, please refer to our documentation on training, validation, and exporting models. If you have further questions, feel free to ask here.
krialm
Hi, when I am using yolov8_obb model in results I always have boxes: None keypoints: None masks: None
even when the model makes prediction. Did someone faced with this problem and if yes, what was the solution? Thank you.🙂
1RizwanMunawar
@krialm In the case of OBB, you can get bounding box data, using the mentioned code below.
model = YOLO("yolov8n-obb.pt") results = model.predict(im0) pred_boxes = results[0].obbI hope this helps! Let me know if you have any additional questions.
Thanks and Regards Ultralytics Team!
1kedardg
Is there a way for me to train OBB models from scratch let's say the P2 or RTDETR models which are not available pre-trained?
Paula DerrengerUltralytics@kedardg absolutely, you can train OBB models like P2 or RTDETR from scratch even if they're not available pre-trained. You'd start by creating a new model from a YAML file, which defines the model architecture. Here's a quick example of how you might do it:
yolo obb train data=your_dataset.yaml model=your_model.yaml epochs=100 imgsz=640Just replace
your_dataset.yamlwith your dataset configuration file andyour_model.yamlwith your model configuration file. Make sure your dataset is properly formatted for OBB tasks. Happy training! 😊🚀RumaisaIlyas
model = YOLO("yolov8n-obb.pt") results = model.predict(im0) pred_boxes = results[0].obb
i did this but i want to draw bounding boxes on the test image and return it. how to do that?
my function is:
def count_detection(image): if image is not None: # Load the YOLO model model = YOLO('bestobbv8s.pt')
# Check the shape of the input image print("Input image shape:", image.shape) # Use the model to predict the wheat spikes in image results = model(image, save=True) # Count count = sum(len(result) for result in results) print("count", count) # Draw bounding boxes for detected wheat heads for result in results: boxes = result.obb #here? return image
Paula DerrengerUltralytics@RumaisaIlyas hey there! 😊 To draw bounding boxes on your test image and return it, you can use the
plot()method available in theResultsobject. Here's how you can modify your function:def count_detection(image): if image is not None: # Load the YOLO model model = YOLO('bestobbv8s.pt') # Check the shape of the input image print("Input image shape:", image.shape) # Use the model to predict results = model.predict(image) # Draw bounding boxes and return the annotated image annotated_image = results[0].plot() # Count detections count = len(results[0].obb) print("count", count) return annotated_imageIn this updated function, after making predictions with
model.predict(image), we useresults[0].plot()to draw bounding boxes on the image. This method returns the annotated image, which we then return from the function. This should give you the visual feedback you're looking for! 🚀Let me know if you need further assistance!
RumaisaIlyas
thankyou so much for your assistance. i am facing a problem that my runs folder is not created after i run the code provided. why is that? what should i do in code so that i get the runs folder with my predicted image
Paula DerrengerUltralytics(수정됨)Hey there! 😊 It sounds like you're doing everything right, but if the
runsfolder isn't being created, it might be due to a small oversight. Here's a quick checklist:- Ensure you're using the latest version of the Ultralytics YOLO library. Sometimes, updates fix these kinds of issues.
- Double-check your command and make sure it's complete. For predictions, it should look something like this:
from ultralytics import YOLO # Load your model model = YOLO('bestobbv8s.pt') # Run prediction # save=True writes the annotated image to the 'runs' folder results = model.predict('path/to/your/image.jpg', save=True)- If you're still not seeing the
runsfolder, try specifying the output directory explicitly in your code:
results = model.predict('path/to/your/image.jpg', save=True, project='runs/detect') # Adjust the path as needed- Lastly, ensure you have the necessary write permissions in your working directory. Sometimes, permission issues can prevent the creation of new folders.
If you've checked all these and the issue persists, it might be helpful to share more details about your environment (like your operating system) or any error messages you're seeing. That way, the community can offer more targeted advice. 🚀
Hope this helps, and happy detecting!
Ci-ne
I also face the same problem. I tried using the code provided but it still says NoneType
ncnn_model = YOLO("./my_ncnn_model", task='detect') results = ncnn_model.predict(image_path)
if results[0] is not None: # Ensure results is not None obb_boxes = results[0].obb # For OBB models print(f"OBB Box: {obb_boxes}") else: print("No detections.")
This is what I get
Speed: 4.1ms preprocess, 93.1ms inference, 1.2ms postprocess per image at shape (1, 3, 640, 640) OBB Box: None
Any help?
1chengz
The document notes that 'OBB angles are constrained to the range 0–90 degrees (exclusive of 90). Angles of 90 degrees or greater are not supported.' So what is the normal radian range for an OBB, [-π/4, 3π/4) or something else?
Murat Raimbekovthe radian range is
[-π/4, 3π/4), i.e.[-45°, 135°), not[0°, 90°). that docs note was inaccurate and is fixed in #24534.ground-truth angles are normalized in
xyxyxyxy2xywhr(ultralytics/utils/ops.py) by two loops,while theta >= 3*pi/4: theta -= piandwhile theta < -pi/4: theta += pi, withwswapped to the longer side. sweeping a rectangle through physical 0->180°:0° -> 0.0000 45° -> 0.7854 (π/4) 90° -> 1.5708 (π/2) 120° -> 2.0944 135° -> -0.7854 (-π/4) 165° -> -0.2618so the span is exactly π wide, half-open at
3π/4.the heads match this:
OBB(yolov8/yolo11):angle = (sigmoid(raw) - 0.25) * π, hard-bounded to[-π/4, 3π/4].OBB26(yolo26): raw output, no sigmoid, trained on targets already in[-π/4, 3π/4).
[0, π/2)is the regularized DOTA-style form produced byregularize_rboxesinops.py. that function is defined but has no callers anywhere inultralytics/, so it is not applied at training or inference. predicted boxes reach you unregularized:result.obb.xywhrreturns the angle in[-π/4, 3π/4)(verified by feeding angles like-0.70and2.30through the predict path and reading them back unchanged).one consequence, which is what the original note was really about: an OBB and its 180° rotation encode to the same
xywhr, so rotation is defined only modulo 180° and the box has no direction. θ and θ+180° are indistinguishable, so you cannot recover a fixed corner ordering from the predicted angle.
UsermAPtest values are for single-model multiscale on DOTAv1 dataset. Reproduce by yolo val obb data=DOTAv1.yaml device=0 split=test and submit merged results to DOTA evaluation. This mentions that the test results are submitted to the DOTAv1 server through a multiscale approach. I would like to ask, what does this "multiscale" mean? How is it specifically implemented? Is it trained at scales like 512512 and 10241024, and then tested on the test dataset? How are the final results obtained? I am not quite clear on what this multiscale refers to. Please help me with this.
Glenn JocherUltralyticsHere, “multiscale” means evaluating the same trained model on multiple resized/split versions of each DOTA image tile, then merging those detections back into the original image for final submission; in Ultralytics this is tied to the DOTA split pipeline with scales like
rates=[0.5, 1.0, 1.5]in the DOTA dataset guide and the merged-result export inOBBValidator.eval_json(), so it is usually multi-scale test-time inference with one model rather than separately training 512 and 1024 models.
Murat Raimbekovit is one model, trained once. there is no separate 512 and 1024 model, and no separate training runs per scale. the "multiscale" lives entirely in the dota tiling step, not inside
yolo val.where it comes from. dota images are huge (800x800 up to ~20000x20000), so they are cut into overlapping tiles before training/val using
split_trainval/split_testfromultralytics/data/split_dota.py. the multiscale variant passesrates=[0.5, 1.0, 1.5](this is exactly what the dota dataset guide shows). for each raterthe code usescrop_size / randgap / r, so with the defaultscrop_size=1024, gap=200you get tiles of:rate 0.5 -> 2048 px tiles (gap 400) rate 1.0 -> 1024 px tiles (gap 200) rate 1.5 -> 682 px tiles (gap 133)every original image is therefore cut into overlapping windows at all three crop sizes. each window is later resized to
imgszat inference, so the same content is effectively seen at three resolutions. concretely, a single 4000x4000 image produces ~98 tiles spread across those three sizes.training. the model is trained once on the multiscale-split trainval tiles (same
rates=[0.5, 1.0, 1.5]). it is not "trained at 512 then at 1024" as separate models.test / how the final number is obtained.
yolo val obb data=DOTAv1.yaml split=testruns that single model over every test tile. each tile filename encodes the source image id and crop offset (name__cropsize__xstart___ystart).OBBValidator.eval_json()parses that, shifts each tile's rotated boxes back into the original full-image coordinates, concatenates detections from all tiles and all scales, then runs a rotated probiou NMS (fast_nms, iou 0.3) to remove the overlap introduced by tiling. the merged per-image results are written as dotaTask1_*.txt, which is what you submit to the dota evaluation server.one practical caveat.
yolo val ... split=testdoes not create the multiscale tiles for you. you have to runsplit_test(rates=[0.5, 1.0, 1.5])first (andsplit_trainvalwith the same rates for training). running val on the raw full dota images is single-scale and will not reproduce themAPtestnumber in the table.so in short: multiscale = offline multi-scale tiling + per-tile single-scale inference + merge-back-and-NMS, all with one model. it is test-time multi-scale through the tiling, not test-time augmentation inside
val.
kssion
WARNING ⚠️ CoreML: 'nms=True' is only available for Detect models like 'yolo11n.pt'.
yolo export model=best.pt format=coreml nms=True conf=0.25 iou=0.45Ultralytics 8.3.232 🚀 Python-3.11.11 torch-2.9.1 CPU (Apple M1) YOLO11n-obb summary (fused): 109 layers, 2,653,918 parameters, 0 gradients, 6.6 GFLOPs
PyTorch: starting from 'best.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) (1, 6, 8400) (5.5 MB) Torch version 2.9.1 has not been tested with coremltools. You may run into unexpected errors. Torch 2.7.0 is the most recent version that has been tested.
CoreML: starting export with coremltools 9.0... WARNING ⚠️ CoreML: 'nms=True' is only available for Detect models like 'yolo11n.pt'. Converting PyTorch Frontend ==> MIL Ops: 100%|██████████████▉| 867/868 [00:00<00:00, 8975.73 ops/s] Running MIL frontend_pytorch pipeline: 100%|███████████████████| 5/5 [00:00<00:00, 166.58 passes/s] Running MIL default pipeline: 100%|███████████████████████████| 95/95 [00:00<00:00, 99.61 passes/s] Running MIL backend_mlprogram pipeline: 100%|████████████████| 12/12 [00:00<00:00, 176.60 passes/s] CoreML: export success ✅ 4.8s, saved as 'best.mlpackage' (5.3 MB)
Export complete (5.0s)
Glenn JocherUltralyticsThat warning is expected for OBB models: CoreML
nms=Trueis only supported for axis-aligned Detect heads, so export your*-obbmodel without NMS and do confidence/IoU (rotated NMS) post-processing on the app side (export success ✅ means you’re fine). See the Ultralytics YOLO OBB task docs for the OBB output formats.yolo export model=best.pt format=coreml
wang18382140151-hub
你好,请问你们未来的工作计划中是否有将rtdetr用于obb检测呢,最近我正在基于贵司源码做改进
AbhisekRao
I'm currently working with the YOLOv11 Oriented Bounding Box (OBB) model exported in TensorRT format, and deploying it on an NVIDIA Jetson device (AGX Orin). While the model works in standard inference pipelines (.pt) , I’m facing challenges integrating it into a DeepStream-based application to process live RTSP video streams.
There seems to be no existing reference implementation or sample Python code that demonstrates how to use the OBB variant of the model with DeepStream. Specifically, I'm looking for guidance on:
1- Integrating the YOLOv11 OBB TensorRT model with DeepStream (preferably using Python bindings). 2- Proper parsing and visualization of oriented bounding boxes from the model output. 3- Any custom parser or config file changes required in the DeepStream pipeline.
Any support, documentation, or examples from the team or community would be greatly appreciated.
cripsgreen
Hello, could you please share some insights on how to train the hyperparameters for YOLOv11-OBB, as well as the pre-trained weights? Thank you.
ziishuo
May I ask if the OBB model can be used to detect subjects in a normal perspective (such as a level shot)? I noticed that most of the examples are from a top-down angle. Thank you!



