Skip to content
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

what is the new quad dataloader? #1898

Closed
GriffinTheWu opened this issue Jan 11, 2021 · 3 comments
Closed

what is the new quad dataloader? #1898

GriffinTheWu opened this issue Jan 11, 2021 · 3 comments
Labels
question Further information is requested Stale

Comments

@GriffinTheWu
Copy link

❔Question

I see a new feature in v4.0
parser.add_argument('--quad', action='store_true', help='quad dataloader')
May I ask what is this quad dataloader?

Additional context

@GriffinTheWu GriffinTheWu added the question Further information is requested label Jan 11, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 11, 2021

👋 Hello @GriffinTheWu, 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 screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

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

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 19, 2021

@GriffinTheWu the quad dataloader is an experimental feature we thought of that may allow some benefits of higher --img size training at lower --img sizes.

When python train.py --quad is run, the dataloader is in quad mode, and replaces with the default collate function with a quad-collate function here:

yolov5/utils/datasets.py

Lines 582 to 583 in b1cf25d

@staticmethod
def collate_fn4(batch):

This quad-collate function will reshapes a batch from 16x3x640x640 to 4x3x1280x1280, which does not have much effect by itself as it is only rearranging the mosaics in the batch, but which interestingly allows for 2x upscaling of some images within the batch (one of the 4 mosaics in each quad is upscaled by 2x, the other 3 mosaics are deleted). The upscaling probability is set here:

if random.random() < 0.5:

We haven't been able to run as many experiments as we'd like on it yet, but we did train a normal YOLOv5l model and a YOLOv5l model with --quad, and the --quad model predictably can run inference at --img-sizes above 640, while the normal model suffers worse performance at > 640 image sizes (both models were trained at --img 640). The compromise though (there's always a compromise) is that the quad model performs slightly worse at 640. So you could consider --img 640 --quad as a middle ground that trains with the speed of --img 640 but with a bit of the higher mAP seen when training directly at --img 1280 (which of course would normally take 4x longer than training at --img 640).

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants