def setUpClass(cls):
        cls.fake_kitti_dir = tests.test_path() + "/datasets/Kitti/object"
        cls.dataset = generate_fake_dataset()

        # create generic ground plane (normal vector is straight up)
        cls.ground_plane = np.array([0., -1., 0., 0.])
        cls.clusters = np.array([[1., 1., 1.], [2., 1., 1.]])

        cls.anchor_generator = grid_anchor_3d_generator.GridAnchor3dGenerator()
Exemplo n.º 2
0
    def setUpClass(cls):
        # Initialize the Kitti dataset
        test_dir = tests.test_path()

        # Get the unittest-kitti dataset
        dataset_builder = DatasetBuilder()
        cls.dataset = dataset_builder.build_kitti_dataset(
            dataset_builder.KITTI_UNITTEST)

        cls.log_dir = test_dir + '/logs'
        cls.bev_vgg_cls = vgg.BevVggClassification()
Exemplo n.º 3
0
    def test_project_to_image_space_tensors(self):

        anchors = np.asarray([[0, 0, 3, 2, 0, 6], [3, 0, 3, 2, 0, 2]],
                             dtype=np.float64)
        img_idx = int('000217')
        img_shape = [375, 1242]

        dataset_config = DatasetBuilder.copy_config(
            DatasetBuilder.KITTI_UNITTEST)

        dataset_config.data_split = 'train'
        dataset_config.dataset_dir = tests.test_path() + \
            "/datasets/Kitti/object"

        dataset = DatasetBuilder().build_kitti_dataset(dataset_config)

        stereo_calib_p2 = calib_utils.read_calibration(dataset.calib_dir,
                                                       img_idx).p2

        # Project the 3D points in numpy space
        img_corners, img_corners_norm = anchor_projector.project_to_image_space(
            anchors, stereo_calib_p2, img_shape)

        # convert the required params to tensors
        tf_stereo_calib_p2 = tf.convert_to_tensor(stereo_calib_p2,
                                                  dtype=tf.float32)
        tf_anchors = tf.convert_to_tensor(anchors, dtype=tf.float32)
        tf_img_shape = tf.convert_to_tensor(img_shape, dtype=tf.float32)

        # Project the 3D points in tensor space
        img_corners_tensor, img_corners_norm_tensor = \
            anchor_projector.tf_project_to_image_space(tf_anchors,
                                                       tf_stereo_calib_p2,
                                                       tf_img_shape)

        sess = tf.Session()
        with sess.as_default():
            img_corners_out = img_corners_tensor.eval()
            img_corners_norm_out = img_corners_norm_tensor.eval()
            np.testing.assert_allclose(img_corners,
                                       img_corners_out,
                                       atol=1e-04,
                                       err_msg='Incorrect corner projection')
            np.testing.assert_allclose(
                img_corners_norm,
                img_corners_norm_out,
                atol=1e-04,
                err_msg='Incorrect normalized corner projection')
Exemplo n.º 4
0
 def setUpClass(cls):
     cls.fake_kitti_dir = tests.test_path() + "/datasets/Kitti/object"
     cls.dataset = DatasetBuilder.build_kitti_dataset(
         DatasetBuilder.KITTI_UNITTEST)
Exemplo n.º 5
0
 def setUpClass(cls):
     cls.fake_kitti_dir = tests.test_path() + "/datasets/Kitti/object"