Commencer

Détection de boîtes englobantes orientées avec Ultralytics YOLO

Ultralytics YOLO oriented bounding box detection of boats in aerial imagery

La détection d'objets orientés va plus loin que la détection d'objets standard en ajoutant un angle pour localiser les objets plus précisément dans une image.

La sortie d'un détecteur d'objets orientés comprend un ensemble de boîtes englobantes orientées qui délimitent précisément les objets de l'image, ainsi que des étiquettes de classe et des scores de confiance pour chaque boîte. Les boîtes englobantes orientées sont particulièrement utiles lorsque les objets apparaissent sous des angles variés, par exemple dans les images aériennes, où les boîtes englobantes traditionnelles alignées sur les axes peuvent inclure un arrière-plan superflu. Parmi les usages courants figurent la détection de navires et de véhicules à partir d'images satellites et de prises de vue par drone, l'analyse des bâtiments et des infrastructures pour l'aménagement urbain, le suivi des cultures, ainsi que l'inspection des panneaux solaires ou des éoliennes.



Regarder : Comment détecter et suivre des objets avec les boîtes englobantes orientées (OBB) d’Ultralytics YOLO26 | Suivi de navires 🚢
Conseil

Les modèles OBB YOLO26 utilisent le suffixe -obb, par exemple yolo26n-obb.pt, et sont préentraînés sur DOTAv1.

Détection de navires avec OBBDétection de véhicules avec OBB
Détection de navires avec OBBDétection de véhicules avec OBB

Modèles#

Les modèles YOLO26 OBB préentraînés sur le jeu de données DOTAv1 sont présentés ci-dessous.

Les modèles sont automatiquement téléchargés depuis la dernière version d’Ultralytics lors de leur première utilisation.

Licence et provenance du jeu de données

Les images et les annotations de DOTAv1 sont réservées à un usage académique et leur usage commercial est interdit. Ultralytics interprète ces restrictions comme s’appliquant au jeu de données source, et non aux poids de modèles préentraînés ou ajustés. Consulte les conditions de DOTA pour l’usage que tu souhaites en faire.

Modèletaille
(pixels)
mAPtest50-95
(e2e)
mAPtest50
(e2e)
Vitesse
CPU ONNX
(ms)
Vitesse
T4 TensorRT10
(ms)
paramètres
(M)
FLOPs
(B)
YOLO26n-obb102452.478.997.7 ± 0.92.8 ± 0.02.414.8
YOLO26s-obb102454.880.9218.0 ± 1.44.9 ± 0.19.856.7
YOLO26m-obb102455.381.0579.2 ± 3.810.2 ± 0.321.2184.9
YOLO26l-obb102456.281.6735.6 ± 3.113.0 ± 0.225.6232.4
YOLO26x-obb102456.781.71485.7 ± 11.530.5 ± 0.957.6520.1
  • Les valeurs mAPtest correspondent à une évaluation multiscalaire avec un seul modèle sur le jeu de données DOTAv1.
    Reproduis ces résultats avec yolo obb val data=DOTAv1.yaml device=0 split=test nms=False save_json=True et soumets les résultats fusionnés à l’évaluation DOTA.
  • Vitesse moyenne sur les images de validation DOTAv1 avec ONNX sur CPU et TensorRT10 sur un GPU NVIDIA T4.
    Reproduis ces résultats avec yolo obb val data=DOTAv1.yaml batch=1 device=0|cpu nms=False
  • Les valeurs Params et FLOPs correspondent aux modèles fusionnés après la fusion Conv/BatchNorm et la suppression de la branche de détection inutilisée. Les checkpoints préentraînés conservent l’architecture d’entraînement complète et peuvent afficher des valeurs plus élevées.

Consulte l’aperçu de YOLO27 non encore publié pour découvrir les résultats préliminaires sur DOTAv1.

Entraînement#

Entraîne un modèle YOLO26n-obb sur le jeu de données DOTA8 pendant 100 époques avec une taille d’image de 640.

Remarque

Une OBB et sa rotation de 180° sont identiques ; la rotation est donc définie modulo 180° et la boîte n’a pas de direction. Les étiquettes d’entraînement sont normalisées selon la convention du côté long : la largeur de la boîte w correspond au côté le plus long, l’angle est mesuré dans le sens horaire à partir de l’axe x positif jusqu’à l’orientation du côté w, et il est stocké en radians dans [-π/4, 3π/4) ([-45°, 135°)). Les prédictions ne sont pas normalisées selon cette convention ; une boîte prédite peut donc indiquer le côté court comme w ; consulte la page Sortie des résultats. La convention [0°, 90°) est la convention DOTA régularisée et n’est appliquée ni lors de l’entraînement ni lors de l’inférence.

Exemple
from ultralytics import YOLO

# Charger un modèle
model = YOLO("yolo26n-obb.yaml")  # créer un nouveau modèle à partir du fichier YAML
model = YOLO("yolo26n-obb.pt")  # charger un modèle préentraîné (recommandé pour l’entraînement)
model = YOLO("yolo26n-obb.yaml").load("yolo26n-obb.pt")  # créer à partir du fichier YAML et transférer les poids

# Entraîner le modèle
results = model.train(data="dota8.yaml", epochs=100, imgsz=640)


Regarder : Comment entraîner des modèles Ultralytics YOLO-OBB (boîtes englobantes orientées) sur le jeu de données DOTA avec la plateforme Ultralytics

Consulte la page Entraînement pour découvrir tous les détails du mode train. Tu peux aussi entraîner des modèles OBB avec l’entraînement cloud d’Ultralytics Platform.

Format du jeu de données#

Tu trouveras une description détaillée du format des jeux de données OBB dans le Guide des jeux de données. Le format OBB de YOLO représente les boîtes englobantes par les coordonnées de leurs quatre sommets, normalisées entre 0 et 1, selon la structure suivante. L’annotation avec Ultralytics Platform prend en charge les étiquettes OBB grâce à un outil dédié au dessin de boîtes englobantes orientées :

class_index x1 y1 x2 y2 x3 y3 x4 y4

En interne, YOLO traite les pertes et les sorties au format xywhr, qui représente le centre de la boîte englobante (xy), sa largeur, sa hauteur et sa rotation.

Validation#

Valide la précision du modèle YOLO26n-obb entraîné, mesurée par la précision moyenne (mAP), sur le jeu de données DOTA8. Passe explicitement data pour que la validation utilise le fichier YAML du jeu de données prévu.

Exemple
from ultralytics import YOLO

# Charger un modèle
model = YOLO("yolo26n-obb.pt")  # charger un modèle officiel
model = YOLO("path/to/best.pt")  # charger un modèle personnalisé

# Valider le modèle
metrics = model.val(data="dota8.yaml")  # valider sur le jeu de données DOTA8
metrics.box.map  # map50-95(B)
metrics.box.map50  # map50(B)
metrics.box.map75  # map75(B)
metrics.box.maps  # mAP50-95(B) par classe ; les classes absentes de l’ensemble de validation reçoivent la valeur du mAP(B) global
metrics.box.ap_class_index  # indices des classes réellement évaluées
metrics.box.image_metrics  # dictionnaire de métriques par image comprenant la précision, le rappel, le F1, les TP, FP et FN

Prédiction#

Utilise un modèle YOLO26n-obb entraîné pour effectuer des prédictions sur des images.

Exemple
from ultralytics import YOLO

# Charger un modèle
model = YOLO("yolo26n-obb.pt")  # charger un modèle officiel
model = YOLO("path/to/best.pt")  # charger un modèle personnalisé

# Effectuer des prédictions avec le modèle
results = model("https://ultralytics.com/images/boats.jpg")  # effectuer une prédiction sur une image

# Accéder aux résultats
for result in results:
    xywhr = result.obb.xywhr  # centre-x, centre-y, largeur, hauteur, angle (radians)
    xyxyxyxy = result.obb.xyxyxyxy  # format polygone à 4 points
    names = [result.names[cls.item()] for cls in result.obb.cls.int()]  # nom de classe de chaque boîte
    confs = result.obb.conf  # score de confiance de chaque boîte

Consulte les détails complets du mode predict sur la page Predict.

Passe save_crop=True pour enregistrer un recadrage aligné sur la rotation de chaque OBB à la taille de sa boîte, comme le fait également ObjectCropper.

Sortie des résultats#

La détection de boîtes englobantes orientées renvoie un objet Results par image. Le principal champ de prédiction est result.obb, qui contient les boîtes pivotées, les identifiants de classe et les scores de confiance de chaque objet détecté.

AttributTypeFormeDescription
result.obbOBB(N)Boîtes orientées.
result.obb.datatorch.float32(N,7/8)Boîtes pivotées brutes avec confiance/classe.
result.obb.xywhrtorch.float32(N,5)Boîtes pivotées xywhr.
result.obb.xyxyxyxytorch.float32(N,4,2)Quatre points d’angle.
result.obb.conftorch.float32(N,)Scores de confiance.

Les étiquettes sont normalisées selon la convention du côté long, contrairement aux prédictions. Ainsi, result.obb.xywhr peut indiquer que w est inférieur à h, alors que la rotation est mesurée à partir du côté court. Les deux formes décrivent le même rectangle : result.obb.xyxyxyxy est donc correct dans les deux cas. Lors du suivi, chaque piste conserve la représentation modulo un demi-tour (θ ou θ ± π) la plus proche de son angle précédent. Ainsi, les angles des pistes ne basculent pas de π d’une image à l’autre et peuvent sortir de [-π/4, 3π/4). Reconvertis les coins lorsque le code en aval a besoin de la forme selon la convention du côté long, en gardant à l’esprit que la réécriture des paramètres de la boîte peut décaler cycliquement l’ordre des coins :

from ultralytics.utils.ops import xyxyxyxy2xywhr

xywhr = xyxyxyxy2xywhr(result.obb.xyxyxyxy)  # w >= h, rotation in [-pi/4, 3pi/4)

Pour connaître les champs Results propres à chaque tâche, consulte la section Résultats des prédictions par tâche.

Export#

Exporte un modèle YOLO26n-obb vers un autre format, comme ONNX, CoreML, etc.

Exemple
from ultralytics import YOLO

# Charger un modèle
model = YOLO("yolo26n-obb.pt")  # charger un modèle officiel
model = YOLO("path/to/best.pt")  # charger un modèle personnalisé

# Exporter le modèle
model.export(format="onnx")

Les formats d'exportation YOLO26-obb disponibles sont indiqués dans le tableau ci-dessous. Tu peux exporter vers n'importe quel format à l'aide de l'argument format, par exemple format='onnx' ou format='engine'. Tu peux lancer directement des prédictions ou la validation sur les modèles exportés, par exemple avec yolo predict model=yolo26n-obb.onnx. Des exemples d'utilisation de ton modèle s'affichent une fois l'exportation terminée.

FormatArgument formatModèleMétadonnéesArguments
PyTorch-yolo26n-obb.pt✅-
TorchScripttorchscriptyolo26n-obb.torchscript✅imgsz, quantize, dynamic, nms, batch, device
ONNXonnxyolo26n-obb.onnx✅imgsz, quantize, dynamic, simplify, opset, nms, batch, data, fraction, device
OpenVINOopenvinoyolo26n-obb_openvino_model/✅imgsz, quantize, dynamic, nms, batch, data, fraction, device
TensorRTengineyolo26n-obb.engine✅imgsz, quantize, dynamic, simplify, opset, workspace, nms, batch, data, fraction, device
CoreMLcoremlyolo26n-obb.mlpackage✅imgsz, dynamic, quantize, nms, batch, device
Apple Core AIcoreaiyolo26n-obb.aimodel✅imgsz, batch, quantize
TF SavedModelsaved_modelyolo26n-obb_saved_model/✅imgsz, quantize, opset, nms, batch, data, fraction, device
TF GraphDefpbyolo26n-obb.pb❌imgsz, opset, batch, device
TF Edge TPUedgetpuyolo26n-obb_edgetpu.tflite✅imgsz, quantize, opset, data, fraction, device
LiteRTlitertyolo26n-obb.tflite✅imgsz, quantize, batch, data, fraction, device
PaddlePaddlepaddleyolo26n-obb_paddle_model/✅imgsz, batch, device
MNNmnnyolo26n-obb.mnn✅imgsz, batch, dynamic, quantize, simplify, opset, nms, device
NCNNncnnyolo26n-obb_ncnn_model/✅imgsz, quantize, device
IMX500imxyolo11n_imx_model/✅imgsz, quantize, data, fraction, nms, device
RKNNrknnyolo26n-obb_rknn_model/✅imgsz, batch, name, quantize, simplify, opset, data, fraction, device
ExecuTorchexecutorchyolo26n-obb_executorch_model/✅imgsz, quantize, batch, data, fraction, device
Axeleraaxelerayolo26n-obb_axelera_model/✅imgsz, batch, quantize, data, fraction, device
DEEPXdeepxyolo26n-obb_deepx_model/✅imgsz, quantize, simplify, opset, data, optimize, device
Qualcomm QNNqnnyolo26n-obb_qnn.onnx✅imgsz, batch, name, quantize, simplify, opset, data, fraction, device
Hailohailoyolo26n-obb_hailo_model/✅imgsz, name, quantize, data, fraction, simplify, conf, iou, device
Huawei Ascendascendyolo26n-obb_ascend_model/✅imgsz, batch, name, quantize, opset, simplify, nms, device
AMD Xilinxxilinxyolo26n-obb_xilinx_model/✅imgsz, name, quantize, data, fraction, opset, simplify, device
NXPnxpyolo26n-obb_nxp.tflite✅imgsz, quantize, data, fraction, device
ST Edge AIstedgeaiyolo26n-obb_stedgeai.onnx✅imgsz, quantize, data, fraction, opset, simplify, device

nms=None utilise par défaut les sorties brutes pour une NMS externe (YOLO26 conserve sa tête sans NMS sur Axelera). Définis nms=False pour sélectionner une tête sans NMS disponible ; les formats non pris en charge reviennent à leur chemin de sortie natif. Les entrées nms ci-dessus identifient les formats qui peuvent intégrer la NMS avec nms=True.

Consulte tous les détails de export sur la page Exportation.

FAQ#

  • Les boîtes englobantes orientées (OBB) intègrent un angle supplémentaire pour améliorer la précision de la localisation des objets dans les images. Contrairement aux boîtes englobantes classiques, qui sont des rectangles alignés sur les axes, les OBB peuvent pivoter pour mieux s’adapter à l’orientation de l’objet. C’est particulièrement utile pour les applications qui nécessitent un positionnement précis des objets, comme l’imagerie aérienne ou satellitaire (Guide des jeux de données).

  • Pour entraîner un modèle YOLO26n-obb avec un jeu de données personnalisé, suis l’exemple ci-dessous avec Python ou la CLI :

    Exemple
    from ultralytics import YOLO
    
    # Charger un modèle préentraîné
    model = YOLO("yolo26n-obb.pt")
    
    # Entraîner le modèle
    results = model.train(data="path/to/custom_dataset.yaml", epochs=100, imgsz=640)

    Pour découvrir d’autres arguments d’entraînement, consulte la section Configuration.

  • Les modèles YOLO26-OBB sont préentraînés sur des jeux de données comme DOTAv1, mais tu peux utiliser n’importe quel jeu de données au format OBB. Tu trouveras des informations détaillées sur les formats de jeux de données OBB dans le Guide des jeux de données.

  • Pour valider un modèle YOLO26n-obb, tu peux utiliser Python ou les commandes de la CLI, comme indiqué ci-dessous :

    Exemple
    from ultralytics import YOLO
    
    # Charger un modèle
    model = YOLO("yolo26n-obb.pt")
    
    # Valider le modèle
    metrics = model.val(data="dota8.yaml")

    Consulte la section Val pour obtenir tous les détails sur la validation.

  • L’export d’un modèle YOLO26-OBB au format ONNX est simple, que tu utilises Python ou la CLI :

    Exemple
    from ultralytics import YOLO
    
    # Charger un modèle
    model = YOLO("yolo26n-obb.pt")
    
    # Exporter le modèle
    model.export(format="onnx")

    Pour découvrir d’autres formats d’export et en savoir plus, consulte la page Export.

Commentaires252

Pose une question, partage tes résultats ou aide quelqu’un d’autre.

    1. Paula DerrengerUltralytics(modifié)

      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! 😊

  1. windzuGitHub

    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
    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.

  2. krialmGitHub

    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.🙂

    1
    1. RizwanMunawarGitHub

      @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].obb

      I hope this helps! Let me know if you have any additional questions.

      Thanks and Regards Ultralytics Team!

      1
    2. kedardgGitHub

      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?

    3. 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=640

      Just replace your_dataset.yaml with your dataset configuration file and your_model.yaml with your model configuration file. Make sure your dataset is properly formatted for OBB tasks. Happy training! 😊🚀

    4. RumaisaIlyasGitHub

      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
    5. Paula DerrengerUltralytics

      @RumaisaIlyas hey there! 😊 To draw bounding boxes on your test image and return it, you can use the plot() method available in the Results object. 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_image

      In this updated function, after making predictions with model.predict(image), we use results[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!

    6. RumaisaIlyasGitHub

      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

    7. Paula DerrengerUltralytics(modifié)

      Hey there! 😊 It sounds like you're doing everything right, but if the runs folder isn't being created, it might be due to a small oversight. Here's a quick checklist:

      1. Ensure you're using the latest version of the Ultralytics YOLO library. Sometimes, updates fix these kinds of issues.
      2. 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)
      1. If you're still not seeing the runs folder, 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
      1. 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!

    8. Ci-neGitHub

      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?

  3. 1chengzGitHub

    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?

    1. Murat Raimbekov

      the 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 -= pi and while theta < -pi/4: theta += pi, with w swapped 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.2618

      so 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 by regularize_rboxes in ops.py. that function is defined but has no callers anywhere in ultralytics/, so it is not applied at training or inference. predicted boxes reach you unregularized: result.obb.xywhr returns the angle in [-π/4, 3π/4) (verified by feeding angles like -0.70 and 2.30 through 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.

  4. User

    mAPtest 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.

    1. Glenn JocherUltralytics

      Here, “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 in OBBValidator.eval_json(), so it is usually multi-scale test-time inference with one model rather than separately training 512 and 1024 models.

    2. Murat Raimbekov

      it 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_test from ultralytics/data/split_dota.py. the multiscale variant passes rates=[0.5, 1.0, 1.5] (this is exactly what the dota dataset guide shows). for each rate r the code uses crop_size / r and gap / r, so with the defaults crop_size=1024, gap=200 you 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 imgsz at 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=test runs 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 dota Task1_*.txt, which is what you submit to the dota evaluation server.

      one practical caveat. yolo val ... split=test does not create the multiscale tiles for you. you have to run split_test(rates=[0.5, 1.0, 1.5]) first (and split_trainval with the same rates for training). running val on the raw full dota images is single-scale and will not reproduce the mAPtest number 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.

  5. kssionGitHub

    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.45

    Ultralytics 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)

    1. Glenn JocherUltralytics

      That warning is expected for OBB models: CoreML nms=True is only supported for axis-aligned Detect heads, so export your *-obb model 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
  6. wang18382140151-hubGitHub

    你好,请问你们未来的工作计划中是否有将rtdetr用于obb检测呢,最近我正在基于贵司源码做改进

  7. AbhisekRaoGitHub

    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.

  8. cripsgreenGitHub

    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.

  9. ziishuoGitHub

    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!