Exemple #1
0
    def build_kitti_dataset(base_cfg,
                            use_defaults=True,
                            new_cfg=None,
                            use_custom_input=False) -> KittiDataset:
        """Builds a KittiDataset object using the provided configurations

        Args:
            base_cfg: a base dataset configuration
            use_defaults: whether to use the default config values
            new_cfg: (optional) a custom dataset configuration, no default
                values will be used, all config values must be provided

        Returns:
            KittiDataset object
        """
        cfg_copy = DatasetBuilder.copy_config(base_cfg)

        if use_defaults:
            # Use default values
            text_format.Merge(DatasetBuilder.CONFIG_DEFAULTS_PROTO, cfg_copy)

        if new_cfg:
            # Use new config values if provided
            cfg_copy.MergeFrom(new_cfg)

        return KittiDataset(cfg_copy, use_custom_input)
Exemple #2
0
def fill_feed_dict(dataset: KittiDataset, input_pl, batch_size):
    sample = dataset.next_batch(batch_size)

    bev_input = sample[0].get(constants.KEY_BEV_INPUT)
    bev_input = np.expand_dims(bev_input, axis=0)

    labels = sample[0].get(constants.KEY_LABEL_CLASSES)
    labels = np.expand_dims(labels, axis=1)

    label_pl = tf.placeholder(tf.float32, [None, 1])

    feed_dict = {input_pl: bev_input, label_pl: labels}

    return feed_dict, label_pl
Exemple #3
0
    def build_kitti_dataset(base_cfg,
                            use_defaults=True,
                            new_cfg=None) -> KittiDataset:
        """使用传入的配置参数构建一个KittiDataset类的对象

        Args:
            base_cfg: 一些基础的参数
            use_defaults: 标志位,表示是否利用默认参数
            new_cfg: 新的配置参数(所谓新的配置参数是指默认参数里没有的参数,所以这些参数必须提供相应的值,因为没默认值可用)

        Returns:
            KittiDataset类的对象
        """
        cfg_copy = DatasetBuilder.copy_config(base_cfg)

        if use_defaults:
            # Use default values
            text_format.Merge(DatasetBuilder.CONFIG_DEFAULTS_PROTO, cfg_copy)

        if new_cfg:
            # Use new config values if provided
            cfg_copy.MergeFrom(new_cfg)

        return KittiDataset(cfg_copy)