Hi, I'm using my own dataset to train the model. But I got the following error when during training, which I have no idea what's wrong. I've checked all the datatype, and they are all the same as the ones in VOC and COCO. Could you please help me with it:
Traceback (most recent call last):
File "train.py", line 114, in
main()
File "train.py", line 105, in main
model = train(cfg, args)
File "train.py", line 44, in train
model = do_train(cfg, model, train_loader, optimizer, scheduler, checkpointer, device, arguments, args)
File "/home/tribta/SSD/ssd/engine/trainer.py", line 82, in do_train
loss_dict = model(images, targets=targets)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, kwargs)
File "/home/tribta/SSD/ssd/modeling/detector/ssd_detector.py", line 16, in forward
detections, detector_losses = self.box_head(features, targets)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, *kwargs)
File "/home/tribta/SSD/ssd/modeling/box_head/box_head.py", line 25, in forward
return self._forward_train(cls_logits, bbox_pred, targets)
File "/home/tribta/SSD/ssd/modeling/box_head/box_head.py", line 31, in _forward_train
reg_loss, cls_loss = self.loss_evaluator(cls_logits, bbox_pred, gt_labels, gt_boxes)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(input, kwargs)
File "/home/tribta/SSD/ssd/modeling/box_head/loss.py", line 32, in forward
mask = box_utils.hard_negative_mining(loss, labels, self.neg_pos_ratio)
File "/home/tribta/SSD/ssd/utils/box_utils.py", line 122, in hard_negative_mining
loss[pos_mask] = -math.inf
IndexError: The shape of the mask [12, 1] at index 1 does not match the shape of the indexed tensor [12, 24564] at index 1
Hi, I'm using my own dataset to train the model. But I got the following error when during training, which I have no idea what's wrong. I've checked all the datatype, and they are all the same as the ones in VOC and COCO. Could you please help me with it:
Traceback (most recent call last): File "train.py", line 114, in
main()
File "train.py", line 105, in main
model = train(cfg, args)
File "train.py", line 44, in train
model = do_train(cfg, model, train_loader, optimizer, scheduler, checkpointer, device, arguments, args)
File "/home/tribta/SSD/ssd/engine/trainer.py", line 82, in do_train
loss_dict = model(images, targets=targets)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, kwargs)
File "/home/tribta/SSD/ssd/modeling/detector/ssd_detector.py", line 16, in forward
detections, detector_losses = self.box_head(features, targets)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, *kwargs)
File "/home/tribta/SSD/ssd/modeling/box_head/box_head.py", line 25, in forward
return self._forward_train(cls_logits, bbox_pred, targets)
File "/home/tribta/SSD/ssd/modeling/box_head/box_head.py", line 31, in _forward_train
reg_loss, cls_loss = self.loss_evaluator(cls_logits, bbox_pred, gt_labels, gt_boxes)
File "/home/tribta/miniconda3/envs/wmod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(input, kwargs)
File "/home/tribta/SSD/ssd/modeling/box_head/loss.py", line 32, in forward
mask = box_utils.hard_negative_mining(loss, labels, self.neg_pos_ratio)
File "/home/tribta/SSD/ssd/utils/box_utils.py", line 122, in hard_negative_mining
loss[pos_mask] = -math.inf
IndexError: The shape of the mask [12, 1] at index 1 does not match the shape of the indexed tensor [12, 24564] at index 1