【发布时间】:2020-10-21 11:26:37
【问题描述】:
文件 “/home/jake/venv/lib/python3.7/site-packages/torchvision/models/detection/rpn.py”, 第 274 行,在 assign_targets_to_anchors match_quality_matrix = self.box_similarity(gt_boxes, anchors_per_image) 文件 “/home/jake/venv/lib/python3.7/site-packages/torchvision/ops/boxes.py”, 第 153 行,在 box_iou 中 lt = torch.max(boxes1[:, None, :2], boxes2[:, :2]) # [N,M,2] RuntimeError: Expected object of scalar type Double but got scalar 在调用 _th_max 时为参数 #2 'other' 键入 Float
得到以下错误,这是类型
annotations-> [{'boxes': tensor([[131.5124, 169.4232, 165.8235, 209.7217],
[157.2659, 185.7604, 199.0850, 210.4478],
[184.4726, 171.3594, 211.5178, 210.3267],
[170.5867, 154.1751, 211.7600, 188.7858],
[162.8364, 156.2324, 182.1313, 186.7285],
[131.2702, 149.8185, 149.4349, 172.3276],
[192.0614, 140.5002, 208.4500, 155.2642],
[165.2583, 140.5002, 188.2670, 158.0476],
[169.5371, 131.9080, 193.3531, 151.1497],
[131.1895, 133.2392, 140.1507, 156.3534]], device='cuda:0',
dtype=torch.float64), 'labels': tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], device='cuda:0'), 'area': tensor([1382.6857, 1032.4053, 1053.8795, 1425.0382, 588.4218, 408.8705,
241.9614, 403.7413, 458.2574, 207.1317], device='cuda:0'), 'iscrowd': tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], device='cuda:0')}]
我认为 box 类型是 float64 。这导致问题如何解决它的两倍?
【问题讨论】:
标签: python pytorch tensor torch torchvision