Closed nothasson closed 2 years ago
# -------------------------------------------------------# # 将真实框转换一个形式 # num_true_box, 4 # -------------------------------------------------------# gt_box = torch.FloatTensor(torch.cat((torch.zeros((batch_target.size(0), 2)), batch_target[:, 2:4]), 1)) # -------------------------------------------------------# # 将先验框转换一个形式 # 9, 4 # -------------------------------------------------------# anchor_shapes = torch.FloatTensor( torch.cat((torch.zeros((len(anchors), 2)), torch.FloatTensor(anchors)), 1)) # -------------------------------------------------------# # 计算交并比 # self.calculate_iou(gt_box, anchor_shapes) = [num_true_box, 9]每一个真实框和9个先验框的重合情况 # best_ns: # [每个真实框最大的重合度max_iou, 每一个真实框最重合的先验框的序号] # -------------------------------------------------------# best_ns = torch.argmax(self.calculate_iou(gt_box, anchor_shapes), dim=-1)
请问一下,为什么gt_box和anchor_shapes的前两位元素要设为0,0呀?
gt_box
anchor_shapes
请问一下,为什么
gt_box
和anchor_shapes
的前两位元素要设为0,0呀?