Adapt browse_dataset for concatenated datasets. (#5935)

pull/5973/head
guigarfr 3 years ago committed by GitHub
parent 3545915bf1
commit 5590f80edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      tools/misc/browse_dataset.py

@ -1,6 +1,7 @@
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
from collections import Sequence
from pathlib import Path
import mmcv
@ -46,6 +47,12 @@ def parse_args():
def retrieve_data_cfg(config_path, skip_type, cfg_options):
def skip_pipeline_steps(config):
config['pipeline'] = [
x for x in config.pipeline if x['type'] not in skip_type
]
cfg = Config.fromfile(config_path)
if cfg_options is not None:
cfg.merge_from_dict(cfg_options)
@ -57,9 +64,11 @@ def retrieve_data_cfg(config_path, skip_type, cfg_options):
while 'dataset' in train_data_cfg and train_data_cfg[
'type'] != 'MultiImageMixDataset':
train_data_cfg = train_data_cfg['dataset']
train_data_cfg['pipeline'] = [
x for x in train_data_cfg.pipeline if x['type'] not in skip_type
]
if isinstance(train_data_cfg, Sequence):
[skip_pipeline_steps(c) for c in train_data_cfg]
else:
skip_pipeline_steps(train_data_cfg)
return cfg

Loading…
Cancel
Save