def METHOD_NAME(args):
    # load config
    with open(args.config) as f:
        pred_config = yaml.safe_load(f)
    def merge(cfg, arg):
        # update cfg from arg directly
        METHOD_NAME = copy.deepcopy(cfg)
        for k, v in cfg.items():
            if k in arg:
                METHOD_NAME[k] = arg[k]
            else:
                if isinstance(v, dict):
                    METHOD_NAME[k] = merge(v, arg)
        return METHOD_NAME
    def merge_opt(cfg, arg):
        METHOD_NAME = copy.deepcopy(cfg)
        # merge opt
        if 'opt' in arg.keys() and arg['opt']:
            for name, value in arg['opt'].items(
            ):  # example: {'MOT': {'batch_size': 3}}
                if name not in METHOD_NAME.keys():
                    print("No", name, "in config file!")
                    continue
                for sub_k, sub_v in value.items():
                    if sub_k not in METHOD_NAME[name].keys():
                        print("No", sub_k, "in config file of", name, "!")
                        continue
                    METHOD_NAME[name][sub_k] = sub_v
        return METHOD_NAME
    args_dict = vars(args)
    pred_config = merge(pred_config, args_dict)
    pred_config = merge_opt(pred_config, args_dict)
    return pred_config