utils.py 737 B

12345678910111213141516171819
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. def trigger_visualization_hook(cfg, args):
  3. default_hooks = cfg.default_hooks
  4. if 'visualization' in default_hooks:
  5. visualization_hook = default_hooks['visualization']
  6. # Turn on visualization
  7. visualization_hook['draw'] = True
  8. if args.show:
  9. visualization_hook['show'] = True
  10. visualization_hook['wait_time'] = args.wait_time
  11. if args.show_dir:
  12. visualization_hook['test_out_dir'] = args.show_dir
  13. else:
  14. raise RuntimeError(
  15. 'VisualizationHook must be included in default_hooks.'
  16. 'refer to usage '
  17. '"visualization=dict(type=\'VisualizationHook\')"')
  18. return cfg