bearpaw/pytorch-pose

ValueError: A global iterator flag was passed as a per-operand flag to the iterator constructor

Closed this issue · 2 comments

Hi,
when I run the testing and training example following the Usage instructions, there is a mistake. I don't know how to fix it.

==> creating model 'hg', stacks=2, blocks=1
=> loading checkpoint 'checkpoint/mpii/hg_s2_b1/model_best.pth.tar'
=> loaded checkpoint 'checkpoint/mpii/hg_s2_b1/model_best.pth.tar' (epoch 185)
Total params: 6.73M
Mean: 0.4404, 0.4440, 0.4327
Std: 0.2458, 0.2410, 0.2468

Evaluation only
Traceback (most recent call last):
File "example/mpii.py", line 352, in
main(parser.parse_args())
File "example/mpii.py", line 92, in main
loss, acc, predictions = validate(val_loader, model, criterion, args.num_classes, args.debug, args.flip)
File "example/mpii.py", line 222, in validate
for i, (inputs, target, meta) in enumerate(val_loader):
File "/home/amax/anaconda2/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 201, in next
return self._process_next_batch(batch)
File "/home/amax/anaconda2/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 221, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File "/home/amax/anaconda2/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 40, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/amax/pytorch-hourglass/pytorch-pose/pose/datasets/mpii.py", line 119, in getitem
target[i] = draw_labelmap(target[i], tpts[i]-1, self.sigma, type=self.label_type)
File "/home/amax/pytorch-hourglass/pytorch-pose/pose/utils/imutils.py", line 72, in draw_labelmap
g = np.exp(- ((x - x0) ** 2 + (y - y0) ** 2) / (2 * sigma ** 2))
ValueError: A global iterator flag was passed as a per-operand flag to the iterator constructor

Hi @heroxx2011 , I cannot reproduce your error.

Can you try to train a small model for just 1 epoch and save it to the disc? Then you may test with this saved model. See what happens.

Thanks for your attention. I have changed the machine and there is no that problem. @bearpaw