pytorch-YOLOv4
pytorch-YOLOv4 copied to clipboard
RuntimeError: view size is not compatible with input tensor's size and stride
Got this error:
File "train.py", line 211, in build_target
pred_ious = bboxes_iou(pred[b].view(-1, 4), truth_box, xyxy=False)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Solved it by changing view
:
https://github.com/Tianxiaomo/pytorch-YOLOv4/blob/a65d219f9066bae4e12003bd7cdc04531860c672/train.py#L211
to reshape
在view前面加.contiguous()