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

ValueError: empty range for randrange() (0,-62, -62) #16

Open
chj1933 opened this issue Aug 15, 2018 · 1 comment
Open

ValueError: empty range for randrange() (0,-62, -62) #16

chj1933 opened this issue Aug 15, 2018 · 1 comment

Comments

@chj1933
Copy link

chj1933 commented Aug 15, 2018

When I use my own dataset, I only use the baseline, but it's wrong.
Traceback (most recent call last):
File "train_baseline.py", line 346, in
num_epochs=130)
File "train_baseline.py", line 227, in train_model
for data in dataloaders[phase]:
File "/home/chenghj/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 281, in next
return self._process_next_batch(batch)
File "/home/chenghj/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 301, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File "/home/chenghj/.local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "train_baseline.py", line 140, in getitem
result = {'img': data_transforms'train', 'label': self.img_label[idx], 'flag':self.img_flag[idx]} # flag=0 for ture data and 0 for generated data
File "/usr/local/lib/python2.7/dist-packages/torchvision/transforms/transforms.py", line 49, in call
img = t(img)
File "/usr/local/lib/python2.7/dist-packages/torchvision/transforms/transforms.py", line 421, in call
i, j, h, w = self.get_params(img, self.size)
File "/usr/local/lib/python2.7/dist-packages/torchvision/transforms/transforms.py", line 399, in get_params
i = random.randint(0, h - th)
File "/usr/lib/python2.7/random.py", line 242, in randint
return self.randrange(a, b+1)
File "/usr/lib/python2.7/random.py", line 218, in randrange
raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
ValueError: empty range for randrange() (0,-62, -62)

@qiaoguan
Copy link
Owner

应该是图片大小的问题,把图片大小裁剪到指定的大小试试!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants