Beispiel #1
0
def regression_test_nproof(cache_folder, data_folder):

    # if the cache does not exist, create it
    if not os.path.exists( os.path.join(cache_folder, 'nproof_train') ):
        meta = init(cache_folder, data_folder, 'nproof')
    else:
        meta = MetaSet(cache_folder)
        meta.load()

    # isbi params
    params = ExperimentSettings()
    params.rf_cache_folder = os.path.join(cache_folder, "rf_cache")
    params.use_2d = False
    params.anisotropy_factor = 1.
    params.ignore_mask = False
    params.n_trees = 500
    params.solver = "multicut_fusionmoves"
    params.lifted_neighborhood = 2

    local_feats_list  = ("raw", "prob", "reg", "topo")
    lifted_feats_list = ("cluster", "reg")

    ds_train = meta.get_dataset('nproof_train')
    ds_test  = meta.get_dataset('nproof_test')
    mc_seg  = run_mc( ds_train, ds_test, local_feats_list, params)

    lmc_seg = run_lmc(ds_train, ds_test, local_feats_list, lifted_feats_list, params, 2.)

    print "Regression Test MC..."
    # Eval differences with same parameters and according regression thresholds
    # vi-split: 0.31985479849 -> 0.35
    vi_split_ref = 0.35
    # vi-merge: 0.402968960935 -> 0.45
    vi_merge_ref = 0.45
    # adapted-ri: 0.122123986224 -> 0.15
    adapted_ri_ref = 0.15
    regression_test(
            vigra.readHDF5(os.path.join(data_folder,'gt_test.h5'), 'data'),
            mc_seg,
            vi_split_ref,
            vi_merge_ref,
            adapted_ri_ref
            )
    print "... passed"

    # Eval differences with same parameters and according regression thresholds
    # vi-split: 0.332745302066 => 0.4
    vi_split_ref = 0.4
    # vi-merge: 0.332349723508 => 0.4
    vi_merge_ref = 0.4
    # adapted-ri: 0.0942531472586 => 0.12
    adapted_ri_ref = 0.12

    regression_test(
            vigra.readHDF5(os.path.join(data_folder,'gt_test.h5'), 'data'),
            lmc_seg
            )
    print "... passed"
Beispiel #2
0
def regression_test_isbi(cache_folder, data_folder):

    # if the cache does not exist, create it
    if not os.path.exists(os.path.join(cache_folder, 'isbi_train')):
        meta = init(cache_folder, data_folder, 'isbi')
    else:
        meta = MetaSet(cache_folder)
        meta.load()

    # isbi params
    params = ExperimentSettings()
    params.rf_cache_folder = os.path.join(cache_folder, "rf_cache")
    params.use_2d = True
    params.anisotropy_factor = 25.
    params.learn_2d = True
    params.ignore_mask = False
    params.n_trees = 500
    params.weighting_scheme = "z"
    params.solver = "multicut_fusionmoves"

    local_feats_list = ("raw", "prob", "reg", "topo")
    lifted_feats_list = ("mc", "cluster", "reg")

    ds_train = meta.get_dataset('isbi_train')
    ds_test = meta.get_dataset('isbi_test')
    mc_seg = run_mc(ds_train, ds_test, local_feats_list, params)
    lmc_seg = run_lmc(ds_train, ds_test, local_feats_list, lifted_feats_list,
                      params, 2.)

    #vigra.writeHDF5(mc_seg, './cache_isbi/isbi_test/mc_seg.h5', 'data', compression = 'gzip')
    #vigra.writeHDF5(lmc_seg, './cache_isbi/isbi_test/lmc_seg.h5', 'data', compression = 'gzip')

    print "Regression Test MC..."
    # Eval differences with same parameters and according regression thresholds
    # vi-split:   0.0718660622942 -> 0.1
    vi_split_ref = 0.1
    # vi-merge:   0.0811051987574 -> 0.1
    vi_merge_ref = 0.1
    # adapted-ri: 0.0218391269081 -> 0.05
    adapted_ri_ref = 0.05
    regression_test(
        vigra.readHDF5(os.path.join(data_folder, 'mc_seg.h5'), 'data'), mc_seg,
        vi_split_ref, vi_merge_ref, adapted_ri_ref)
    print "... passed"

    print "Regression Test LMC..."
    # Eval differences with same parameters and according regression thresholds
    # vi-split: 0.161923549092 -> 0.2
    vi_split_ref = 0.2
    # vi-merge: 0.0792288680404 -> 0.1
    vi_merge_ref = 0.1
    # adapted-ri: 0.0334914933439 -> 0.05
    adapted_ri_ref = 0.05
    regression_test(
        vigra.readHDF5(os.path.join(data_folder, 'lmc_seg.h5'), 'data'),
        lmc_seg, vi_split_ref, vi_merge_ref, adapted_ri_ref)
    print "... passed"
Beispiel #3
0
def regression_test_snemi(cache_folder, data_folder):

    # if the cache does not exist, create it
    if not os.path.exists(os.path.join(cache_folder, 'snmei_train')):
        meta = init(cache_folder, data_folder, 'snemi')
    else:
        meta = MetaSet(cache_folder)
        meta.load()

    # isbi params
    params = ExperimentSettings()
    params.rf_cache_folder = os.path.join(cache_folder, "rf_cache")
    params.use_2d = True
    params.learn_fuzzy = True
    params.anisotropy_factor = 5.
    params.ignore_mask = False
    params.n_trees = 500
    params.weighting_scheme = "all"
    params.solver = "multicut_exact"
    params.lifted_neighborhood = 3

    local_feats_list = ("raw", "prob", "reg", "topo")
    lifted_feats_list = ("cluster", "reg")

    ds_train = meta.get_dataset('snemi_train')
    ds_test = meta.get_dataset('snemi_test')
    mc_seg = run_mc(ds_train, ds_test, local_feats_list, params)
    gamma = 10000.
    lmc_seg = run_lmc(ds_train, ds_test, local_feats_list, lifted_feats_list,
                      params, gamma)

    print "Regression Test MC..."
    # Eval differences with same parameters and according regression thresholds
    # vi-split: 0.0501385345177 -> 0.1
    vi_split_ref = 0.1
    # vi-merge: 0.049803253098 -> 0.1
    vi_merge_ref = 0.1
    # adaptred-ri: 0.0170138077554 -> 0.05
    adapted_ri_ref = 0.05
    regression_test(
        vigra.readHDF5(os.path.join(data_folder, 'mc_seg.h5'), 'data'), mc_seg,
        vi_split_ref, vi_merge_ref, adapted_ri_ref)
    print "... passed"

    print "Regression Test LMC..."
    # FIXME why are these differences so big?
    # vi-split: 0.291149212478 0.141228313621 0.0536859650649
    regression_test(
        vigra.readHDF5(os.path.join(data_folder, 'lmc_seg.h5'), 'data'),
        lmc_seg)
    print "... passed"