Example #1
0
        pred_boxes_right = pred_boxes_right.squeeze()

        pred_kpts = torch.cat(
            (pred_kpts, kpts_type, max_prob, pred_left, pred_right), 2)
        pred_kpts = pred_kpts.squeeze()
        dim_orien = dim_orien.squeeze()

        det_toc = time.time()
        detect_time = det_toc - det_tic

        calib = kitti_utils.read_obj_calibration('demo/calib.txt')

        im2show_left = np.copy(cv2.imread(img_l_path))
        im2show_right = np.copy(cv2.imread(img_r_path))

        pointcloud = kitti_utils.get_point_cloud('demo/lidar.bin', calib)
        im_box = vis_utils.vis_lidar_in_bev(pointcloud,
                                            width=im2show_left.shape[0] * 2)

        for j in xrange(1, len(kitti_classes)):
            inds = torch.nonzero(scores[:, j] > eval_thresh).view(-1)
            # if there is det
            if inds.numel() > 0:
                cls_scores = scores[:, j][inds]
                _, order = torch.sort(cls_scores, 0, True)

                cls_boxes_left = pred_boxes_left[inds][:, j * 4:(j + 1) * 4]
                cls_boxes_right = pred_boxes_right[inds][:, j * 4:(j + 1) * 4]
                cls_dim_orien = dim_orien[inds][:, j * 5:(j + 1) * 5]

                cls_kpts = pred_kpts[inds]
            detect_time = det_toc - det_tic

            img_path = imdb.img_left_path_at(i)
            split_path = img_path.split('/')
            image_number = split_path[len(split_path) - 1].split('.')[0]
            calib_path = img_path.replace("image_2", "calib")
            calib_path = calib_path.replace("png", "txt")
            calib = kitti_utils.read_obj_calibration(calib_path)
            label_path = calib_path.replace("calib", "label_2")
            lidar_path = calib_path.replace("calib", "velodyne")
            lidar_path = lidar_path.replace("txt", "bin")

            im2show_left = np.copy(cv2.imread(imdb.img_left_path_at(i)))
            im2show_right = np.copy(cv2.imread(imdb.img_right_path_at(i)))

            pointcloud = kitti_utils.get_point_cloud(lidar_path, calib)
            im_box = vis_utils.vis_lidar_in_bev(pointcloud,
                                                width=im2show_left.shape[0] *
                                                2)

            for j in xrange(1, imdb.num_classes):
                inds = torch.nonzero(scores[:, j] > eval_thresh).view(-1)
                # if there is det
                if inds.numel() > 0:
                    cls_scores = scores[:, j][inds]
                    _, order = torch.sort(cls_scores, 0, True)

                    cls_boxes_left = pred_boxes_left[inds][:,
                                                           j * 4:(j + 1) * 4]
                    cls_boxes_right = pred_boxes_right[inds][:,
                                                             j * 4:(j + 1) * 4]