mmdetection
mmdetection copied to clipboard
[Bug] Possibly false if-clause in dataset builder for distributed use
Prerequisite
- [X] I have searched Issues and Discussions but cannot get the expected help.
- [X] I have read the FAQ documentation but cannot get the expected help.
- [X] The bug has not been fixed in the latest version (master) or latest version (3.x).
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Branch
master branch https://github.com/open-mmlab/mmdetection
Environment
Reproduces the problem - code sample
Link to potential mixed up if-clause
if dist:
# When model is :obj:`DistributedDataParallel`,
# `batch_size` of :obj:`dataloader` is the
# number of training samples on each GPU.
batch_size = samples_per_gpu
num_workers = workers_per_gpu
else:
# When model is obj:`DataParallel`
# the batch size is samples on all the GPUS
batch_size = num_gpus * samples_per_gpu
num_workers = num_gpus * workers_per_gpu
Reproduces the problem - command or script
not needed
Reproduces the problem - error message
not existing
Additional information
Shouldn't the parts be changed to:
if dist:
# When model is :obj:`DistributedDataParallel`,
# `batch_size` of :obj:`dataloader` is the
# number of training samples on each GPU
# multiplied by the number of used gpus.
batch_size = num_gpus * samples_per_gpu
num_workers = num_gpus * workers_per_gpu
else:
# When model is obj:`DataParallel`
# the batch size is samples on one GPU
batch_size = samples_per_gpu
num_workers = workers_per_gpu
I can create a PR for it, but first I wanted to let it be checked that it's actually mixed up.