mirror of https://github.com/open-mmlab/mmyolo.git
fix the browse_dataset for visualization of test and val (#641)
* correct the scale_factor and pad_param value in LetterResize * correct the scale_factor and pad_param value in LetterResize * correct the scale_factor and pad_param value in LetterResize * tang * update * tang * tang * fix linting * tang * tang * tang * add print registers * add print registers * add print registers * add print registers * add print registers * tang * tang v1 finished * tang * print registers v1.2 * update * tang * update version * update * update * remove exclude_prefix * swap the val pipeline for visualization * swap the val pipeline for visualization * swap the val pipeline for visualization * swap the val pipeline for visualization * swap the val pipeline for visualization --------- Co-authored-by: hha <1286304229@qq.com> Co-authored-by: huanghaian <huanghaian@sensetime.com>pull/649/head^2
parent
421be537e4
commit
b4bf125d15
|
@ -140,6 +140,18 @@ def make_grid(imgs, names):
|
|||
return visualizer.get_image()
|
||||
|
||||
|
||||
def swap_pipeline_position(dataset_cfg):
|
||||
load_ann_tfm_name = 'LoadAnnotations'
|
||||
pipeline = dataset_cfg.get('pipeline')
|
||||
if (pipeline is None):
|
||||
return dataset_cfg
|
||||
all_transform_types = [tfm['type'] for tfm in pipeline]
|
||||
if load_ann_tfm_name in all_transform_types:
|
||||
load_ann_tfm_index = all_transform_types.index(load_ann_tfm_name)
|
||||
load_ann_tfm = pipeline.pop(load_ann_tfm_index)
|
||||
pipeline.insert(1, load_ann_tfm)
|
||||
|
||||
|
||||
class InspectCompose(Compose):
|
||||
"""Compose multiple transforms sequentially.
|
||||
|
||||
|
@ -185,6 +197,8 @@ def main():
|
|||
init_default_scope(cfg.get('default_scope', 'mmyolo'))
|
||||
|
||||
dataset_cfg = cfg.get(args.phase + '_dataloader').get('dataset')
|
||||
if (args.phase in ['test', 'val']):
|
||||
swap_pipeline_position(dataset_cfg)
|
||||
dataset = DATASETS.build(dataset_cfg)
|
||||
visualizer = VISUALIZERS.build(cfg.visualizer)
|
||||
visualizer.dataset_meta = dataset.metainfo
|
||||
|
|
Loading…
Reference in New Issue