[英]sampler argument in DataLoader of Pytorch
While using Pytorch's DataLoader utility, in sampler what is the purpose of RandomIdentitySampler
?在使用 Pytorch 的 DataLoader 实用程序时,在采样器中
RandomIdentitySampler
的目的是什么? And in RandomIdentitySampler
there is an argument instances
.在
RandomIdentitySampler
中有一个参数instances
。 Does instances
depends upon number of workers ? instances
是否取决于工人的数量? If there is are 4 workers then should there be 4 instances as well?如果有 4 个工人,那么也应该有 4 个实例吗?
Following is the chunk of code:以下是代码块:
c_dataloaders = DataLoader(Preprocessor(cluster_dataset.train_set,
root=cluster_dataset.images_dir,
transform=train_transformer),
batch_size=args.batch_size_stage2,
num_workers=args.workers,
sampler=RandomIdentitySampler(cluster_dataset.train_set,
args.batch_size_stage2,
args.instances)
This sampler is not part of the PyTorch or any other official lib (torchvision, torchtext, etc.).此采样器不是 PyTorch 或任何其他官方库(torchvision、torchtext 等)的一部分。 Anyway, there is a
RandomIdentitySampler
in the torchreid
from KaiyangZhou .不管怎样,开阳周的
torchreid
里有一个RandomIdentitySampler
。 Assuming this is the case:假设是这种情况:
- While using Pytorch's DataLoader utility, in sampler what is the purpose of
RandomIdentitySampler
?在使用 Pytorch 的 DataLoader 实用程序时,在采样器中
RandomIdentitySampler
的目的是什么?
- And in
RandomIdentitySampler
there is an argumentinstances
.在
RandomIdentitySampler
中有一个参数instances
。 Doesinstances
depends upon number of workers?instances
是否取决于工人的数量?
instances
does not depend on the number of workers.instances
不依赖于工作人员的数量。 It simply sets the number of instances of each identity that will be drawn from the dataset for each batch.
- If there are 4 workers then should there be 4 instances as well?
如果有 4 个工人,那么也应该有 4 个实例吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.