Closed feiwenxiong closed 7 months ago
👋 Hello @feiwenxiong, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.
If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.
Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
Pip install the ultralytics
package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.
pip install ultralytics
YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
@feiwenxiong hey there! 😊 It's great that you're diving into the details of rotating bounding boxes (rboxes). Let's clarify the confusion around the angle t
range.
The purpose of the regularize_rboxes
function is to ensure that the longer side of the bounding box is always considered the width (w
) and its angle t
is adjusted accordingly to maintain consistency. This adjustment helps in standardizing the boxes for further processing.
When we swap w
and h
for cases where h > w
, we also adjust the angle t
by adding pi/2
to it. This is because we're essentially rotating the box by 90 degrees to keep the longer side as the width. The modulo operation % math.pi
ensures that the angle stays within the range [0, pi]
.
However, you're right to notice that the comment and the function's docstring mention the range [0, pi/2]
, which seems to be a discrepancy since the actual range after regularization is [0, pi]
. This is because after adding pi/2
, the angle could indeed be in the range [pi/2, pi]
.
Here's a quick fix to align with the intended range [0, pi/2]
:
t = (torch.where(w > h, t, t + math.pi / 2) + math.pi) % (math.pi / 2)
This adjustment ensures t
is correctly wrapped within [0, pi/2]
after regularization. However, note that this modification might not directly apply to your use case without additional context on how angles are interpreted in your application.
Thanks for pointing out this confusion, and I hope this clears things up! If you have more questions, feel free to ask.
Hi,got it, appreciate your patience and clear answer!
@feiwenxiong you're welcome! I'm glad the explanation was helpful. If you have more questions or need further assistance, don't hesitate to ask. Happy coding! 😊
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
Search before asking
Question
def regularize_rboxes(rboxes): """ Regularize rotated boxes in range [0, pi/2].
Hi ,i am confused: since t is in [0 , pi / 2], and this function returns regularized boxes in range [0, pi/2] as stated in docString, how come " torch.where(w > h, t, t + math.pi / 2) % math.pi " ranges in [0, pi / 2]?
Additional
No response