Repository navigation
Conversation
le90 boxes were trained with angle held at 0, so CIoU treated a tall rectangle as its transpose. Horizontal mode now assigns, applies DFL, and computes CIoU on image-axis width and height. The returned loss is the soft-target mean multiplied by the image count, matching the Ultralytics step size at the same nominal learning rate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Horizontal COCO training held the predicted angle at 0 and then applied CIoU to
(cx, cy, w, h). Ground truth still arrived in le90 form, where a taller-than-wide box is stored as(long side, short side, −π/2). CIoU ignores angle, so that target is the transposed rectangle. Distribution focal loss was asked for the same swapped distances. A 20×80 object had CIoU loss 0 on the 80×20 box and loss above 1 on the correct box.The loss gains (box 7.5, cls 0.5, DFL 1.5) match Ultralytics, but the value sent to
backwardwas only the soft-target mean. Ultralytics multiplies that mean by the batch size. At batch 64 the step was 64× smaller than the recipe those gains were tuned for.Change
When
use_ciouis on, each ground-truth box is converted to image-axis width and height before assignment. DFL targets and CIoU both use that rectangle. Decode for this path does not pass through the le90 swap. Oriented ProbIoU training is unchanged aside from the shared scale below.Every YOLO-OBB loss term is the soft-target mean multiplied by the number of images in the forward, for both horizontal and oriented runs.
Tests
tests/test_ciou.pychecks that a tall le90 box prefers the image-axis prediction over the transpose, and that doubling the batch doubles the loss once the soft-target sum is above the clamp of 1.tests/test_yolo_obb.pyandtests/test_ciou.py: 18 passed.The live 500-epoch process is still the code it started with. This change applies on the next launch.