示例#1
0
def train_model(config, dataroot, augment, cv_ratio_test, cv_fold, save_path=None, skip_exist=False):
    C.get()
    C.get().conf = config
    C.get()['aug'] = augment

    result = train_and_eval(None, dataroot, cv_ratio_test, cv_fold, save_path=save_path, only_eval=skip_exist)
    return C.get()['model']['type'], cv_fold, result
示例#2
0
def train_model(config,
                dataloaders,
                dataroot,
                augment,
                cv_ratio_test,
                cv_id,
                save_path=None,
                skip_exist=False,
                evaluation_interval=5,
                gr_assign=None,
                gr_dist=None):
    C.get()
    C.get().conf = config
    C.get()['aug'] = augment
    result = train_and_eval(None,
                            dataloaders,
                            dataroot,
                            cv_ratio_test,
                            cv_id,
                            save_path=save_path,
                            only_eval=skip_exist,
                            evaluation_interval=evaluation_interval,
                            gr_assign=gr_assign,
                            gr_dist=gr_dist)
    return C.get()['model']['type'], cv_id, result
示例#3
0
def train_model(
    config, dataroot, augment, cv_ratio_test, cv_fold, save_path=None, skip_exist=False
):
    C.get()
    C.get().conf = config
    C.get()["aug"] = augment

    # pass the get_dataloaders and num_class instead being imported in the train.py. In this way, these two functions
    # can be monkey-patched.
    result = train_and_eval(
        "search_stage",
        None,
        dataroot,
        cv_ratio_test,
        cv_fold,
        save_path=save_path,
        only_eval=skip_exist,
        get_dataloaders=get_dataloaders,
        num_class=num_class,
        get_model=get_model,
    )
    return C.get()["model"]["type"], cv_fold, result