-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Image Resize in Validation #13753
Comments
👋 Hello @Rbrq03, 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. InstallPip install the pip install ultralytics EnvironmentsYOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf 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. |
Additional log are shown below:
|
@Rbrq03 hello! Thank you for reaching out with your question regarding the The From your provided logs, it seems that the images are being resized to dimensions close to 512x512 but not exactly square, resulting in shapes like To ensure that the images are resized to exactly Here’s how you can modify your training script to achieve this: from ultralytics import YOLOv10
import torch
model = YOLOv10("yolov10n.yaml")
model.train(
data="coco.yaml",
epochs=100,
batch=256,
imgsz=512,
optimizer="SGD",
lr0=0.01,
lrf=0.0001,
plots=True,
fna=True,
device=[0, 1, 2, 3, 4, 5, 6, 7],
rect=True # Add this line to enforce rectangular resizing
) By setting If you have any further questions or need additional assistance, feel free to ask. Happy training! 😊 |
Thanks @glenn-jocher! What I further concern is, the shape I print is excepted to be |
Hello @Rbrq03, Thank you for your follow-up question! To ensure that your images are resized to exactly Here’s how you can modify your training script: from ultralytics import YOLOv10
import torch
model = YOLOv10("yolov10n.yaml")
model.train(
data="coco.yaml",
epochs=100,
batch=256,
imgsz=512,
optimizer="SGD",
lr0=0.01,
lrf=0.0001,
plots=True,
fna=True,
device=[0, 1, 2, 3, 4, 5, 6, 7],
rect=True # Add this line to enforce rectangular resizing
) By setting If you continue to experience issues, please ensure you are using the latest versions of Feel free to reach out if you have any more questions! 😊 |
Thanks @plashchynski ! it solves my problem. |
Search before asking
Question
Hey there! I am confused by the imgsz argument in validation.
When i set imgsz to 512, i think the final image shape will be (batch, channel, imgsz, imgsz). However, when i try to print the shape in the batch by:
this code is in
ultralytics/ultralytics/engine/validator.py
Lines 169 to 194 in 605e7f4
and the train code is
excepted output is
torch.Size([64, 3, 320, 544])
, however the output istorch.Size([64, 3, 320, 544])
.So i am confused by this output, my question is:
torch.Size([64, 3, 512, 512])
?Additional
No response
The text was updated successfully, but these errors were encountered: