Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add customized imports
Browse files Browse the repository at this point in the history
dreamerlin committed Oct 15, 2020
1 parent 037e9ac commit f3cf089
Showing 2 changed files with 20 additions and 3 deletions.
13 changes: 11 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
import os
import os.path as osp

import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.cnn import fuse_conv_bn
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
@@ -41,6 +41,12 @@ def parse_args():
help='tmp directory used for collecting results from multiple '
'workers, available when gpu-collect is not specified')
parser.add_argument('--options', nargs='+', help='custom options')
parser.add_argument(
'--cfg-options',
nargs='+',
action=DictAction,
help='override some settings in the used config, the key-value pair '
'in xxx=yyy format will be merged into config file.')
parser.add_argument(
'--average-clips',
choices=['score', 'prob', None],
@@ -72,7 +78,10 @@ def merge_configs(cfg1, cfg2):
def main():
args = parse_args()

cfg = mmcv.Config.fromfile(args.config)
cfg = Config.fromfile(args.config)

if args.cfg_options is not None:
cfg.merge_from_dict(args.cfg_options)

# Load output_config from cfg
output_config = cfg.get('output_config', {})
10 changes: 9 additions & 1 deletion tools/train.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

import mmcv
import torch
from mmcv import Config
from mmcv import Config, DictAction
from mmcv.runner import init_dist, set_random_seed
from mmcv.utils import get_git_hash

@@ -45,6 +45,12 @@ def parse_args():
'--deterministic',
action='store_true',
help='whether to set deterministic options for CUDNN backend.')
parser.add_argument(
'--cfg-options',
nargs='+',
action=DictAction,
help='override some settings in the used config, the key-value pair '
'in xxx=yyy format will be merged into config file.')
parser.add_argument(
'--launcher',
choices=['none', 'pytorch', 'slurm', 'mpi'],
@@ -62,6 +68,8 @@ def main():
args = parse_args()

cfg = Config.fromfile(args.config)
if args.cfg_options is not None:
cfg.merge_from_dict(args.cfg_options)
# set cudnn_benchmark
if cfg.get('cudnn_benchmark', False):
torch.backends.cudnn.benchmark = True

0 comments on commit f3cf089

Please sign in to comment.