ultralytics/yolov5

YOLOv5 Output Size Issue

lllittleX opened this issue ยท 2 comments

Search before asking

Question

I want to convert the results to ONNX first, and then to RKNN. However, when testing the ONNX model, I found that my output sizes are as follows:
torch.Size([1, 15120, 133])
torch.Size([1, 3, 48, 80, 133])
torch.Size([1, 3, 24, 40, 133])
torch.Size([1, 3, 12, 20, 133])
But from what I understand, the usual size is 80,80 instead of 48,80. I would like to ask if this is normal?

Additional

No response

๐Ÿ‘‹ Hello @lllittleX, thank you for your interest in YOLOv5 ๐Ÿš€! Please visit our โญ๏ธ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

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.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 ๐Ÿš€

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 ๐Ÿš€!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics

@lllittleX hello! Thanks for reaching out with your question about the output size from the YOLOv5 model when converted to ONNX.

The output sizes you are seeing (e.g., torch.Size([1, 3, 48, 80, 133])) depend on the input image size you are using and the architecture of the model. Normally, YOLOv5 uses a grid that scales down from the input size by factors of 32, 16, and 8. If your input size isn't a multiple of these, the resulting grid sizes could appear unconventional, as is likely the case with a dimension of 80 instead of the usual 40 or 160, etc.

Ensure that your input image size is a multiple of the largest factor (generally 32) to maintain consistent grid dimensions across the different layers. You can adjust this in your initial configuration before training or inference.

Let's verify that input sizes and model configurations align with the expected outputs. Good luck with your conversions! ๐Ÿš€