Ejemplo n.º 1
0
        box_delta_right = box_delta_right * torch.FloatTensor(cfg.TRAIN.BBOX_NORMALIZE_STDS).cuda() \
                          + torch.FloatTensor(cfg.TRAIN.BBOX_NORMALIZE_MEANS).cuda()
        dim_orien = dim_orien * torch.FloatTensor(cfg.TRAIN.DIM_NORMALIZE_STDS).cuda() \
                    + torch.FloatTensor(cfg.TRAIN.DIM_NORMALIZE_MEANS).cuda()

        box_delta_left = box_delta_left.view(1, -1, 4 * len(kitti_classes))
        box_delta_right = box_delta_right.view(1, -1, 4 * len(kitti_classes))
        dim_orien = dim_orien.view(1, -1, 5 * len(kitti_classes))
        kpts_delta = kpts_delta.view(1, -1, 1)
        left_delta = left_delta.view(1, -1, 1)
        right_delta = right_delta.view(1, -1, 1)
        max_prob = max_prob.view(1, -1, 1)

        pred_boxes_left = bbox_transform_inv(boxes_left, box_delta_left, 1)
        pred_boxes_right = bbox_transform_inv(boxes_right, box_delta_right, 1)
        pred_kpts, kpts_type = kpts_transform_inv(boxes_left, kpts_delta,
                                                  cfg.KPTS_GRID)
        pred_left = border_transform_inv(boxes_left, left_delta, cfg.KPTS_GRID)
        pred_right = border_transform_inv(boxes_left, right_delta,
                                          cfg.KPTS_GRID)

        pred_boxes_left = clip_boxes(pred_boxes_left, im_info.data, 1)
        pred_boxes_right = clip_boxes(pred_boxes_right, im_info.data, 1)

        pred_boxes_left /= im_info[0, 2].data
        pred_boxes_right /= im_info[0, 2].data
        pred_kpts /= im_info[0, 2].data
        pred_left /= im_info[0, 2].data
        pred_right /= im_info[0, 2].data

        scores = scores.squeeze()
        pred_boxes_left = pred_boxes_left.squeeze()
            box_delta_left = box_delta_left.view(1, -1, 4 * len(imdb._classes))
            box_delta_right = box_delta_right.view(1, -1,
                                                   4 * len(imdb._classes))
            dim_orien = dim_orien.view(1, -1, 5 * len(imdb._classes))
            kpts_delta = kpts_delta.view(1, -1, 1)
            left_delta = left_delta.view(1, -1, 1)
            right_delta = right_delta.view(1, -1, 1)
            max_prob = max_prob.view(1, -1, 1)

            pred_boxes_left = \
                bbox_transform_inv(boxes_left, box_delta_left, 1)
            pred_boxes_right = \
                bbox_transform_inv(boxes_right, box_delta_right, 1)
            pred_kpts, kpts_type = \
                kpts_transform_inv(boxes_left, kpts_delta, cfg.KPTS_GRID)
            pred_left = \
                border_transform_inv(boxes_left, left_delta, cfg.KPTS_GRID)
            pred_right = \
                border_transform_inv(boxes_left, right_delta, cfg.KPTS_GRID)

            pred_boxes_left = clip_boxes(pred_boxes_left, im_info.data, 1)
            pred_boxes_right = clip_boxes(pred_boxes_right, im_info.data, 1)

            pred_boxes_left /= im_info[0, 2].data
            pred_boxes_right /= im_info[0, 2].data
            pred_kpts /= im_info[0, 2].data
            pred_left /= im_info[0, 2].data
            pred_right /= im_info[0, 2].data

            scores = scores.squeeze()