bailvwangzi / repulsion_loss_ssd

Repulsion Loss: Detecting Pedestrians in a Crowd. https://arxiv.org/abs/1711.07752
MIT License
234 stars 66 forks source link

IndexError: too many indices for tensor of dimension 2 #19

Open Halo754 opened 3 years ago

Halo754 commented 3 years ago

Setting up a new session... E:\MyPaper\TargetDetection\OursSSD\Code\SSD\ssd-repulsion_-loss\ssd.py:35: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. self.priors = Variable(self.priorbox.forward(), volatile=True) E:\MyPaper\TargetDetection\OursSSD\Code\SSD\ssd-repulsion-loss\layers\modules\l2norm.py:17: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(self.weight,self.gamma) Loading base network... Initializing weights... Loading the dataset... Training SSD on: VOC0712 Using the specified args: Namespace(basenet='vgg16_reducedfc.pth', batch_size=16, cuda=True, dataset='VOC', dataset_root='E:\MyPaper\TargetDetection\OursSSD\Code\SSD\ssd-repulsion_-loss\data/VOCdevkit/', gamma=0.1, lr=0.0001, momentum=0.9, num_workers=0, resume=None, save_folder='weights/', start_iter=0, visdom=False, weight_decay=0.0005) E:\MyPaper\TargetDetection\OursSSD\Code\SSD\ssd-repulsion_-loss\utils\augmentations.py:238: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. mode = random.choice(self.sample_options) E:/MyPaper/TargetDetection/OursSSD/Code/SSD/ssd-repulsion_-loss/train.py:178: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. targets = [Variable(ann.cuda(), volatile=True) for ann in targets] Traceback (most recent call last): File "E:/MyPaper/TargetDetection/OursSSD/Code/SSD/ssd-repulsion_-loss/train.py", line 265, in train() File "E:/MyPaper/TargetDetection/OursSSD/Code/SSD/ssd-repulsion_-loss/train.py", line 187, in train loss_l, loss_l_repul, loss_c = criterion(out, targets) File "D:\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs) File "E:\MyPaper\TargetDetection\OursSSD\Code\SSD\ssd-repulsion_-loss\layers\modules\multibox_loss.py", line 97, in forward priors = priors[pos_idx].view(-1, 4) IndexError: too many indices for tensor of dimension 2

SeokminJang commented 3 years ago

https://github.com/bailvwangzi/repulsion_loss_ssd/issues/1#issuecomment-538853009

check this comment

hskfn commented 9 months ago

priors = torch.concat([priors[pos_idx[index]] for index in range(pos_idx.shape[0])]).view(-1, 4) torch=1.11.0