def setup_config(cls: type, config_fpath: str, model_fpath: str, args: argparse.Namespace, opts: List[str]): cfg = get_cfg() add_densepose_config(cfg) add_hrnet_config(cfg) cfg.merge_from_file(config_fpath) cfg.merge_from_list(args.opts) if opts: cfg.merge_from_list(opts) cfg.MODEL.WEIGHTS = model_fpath cfg.freeze() return cfg
def setup(args): cfg = get_cfg() add_dataset_category_config(cfg) add_densepose_config(cfg) add_hrnet_config(cfg) cfg.merge_from_file(args.config_file) cfg.merge_from_list(args.opts) cfg.freeze() default_setup(cfg, args) # Setup logger for "densepose" module setup_logger(output=cfg.OUTPUT_DIR, distributed_rank=comm.get_rank(), name="densepose") return cfg
def setup_config(config_fpath: str, model_fpath: str, opts: List[str]): opts.append("MODEL.ROI_HEADS.SCORE_THRESH_TEST") opts.append(0.8) # Min score cfg = get_cfg() add_densepose_config(cfg) add_hrnet_config(cfg) cfg.merge_from_file(config_fpath) if opts: cfg.merge_from_list(opts) cfg.MODEL.WEIGHTS = model_fpath cfg.freeze() return cfg
def _get_model_config(config_file): """ Load and return the configuration from the specified file (relative to the base configuration directory) """ cfg = get_cfg() add_dataset_category_config(cfg) add_densepose_config(cfg) add_hrnet_config(cfg) path = os.path.join(_get_base_config_dir(), config_file) cfg.merge_from_file(path) if not torch.cuda.is_available(): cfg.MODEL_DEVICE = "cpu" return cfg