--- title: Ensemble Learner keywords: fastai sidebar: home_sidebar summary: "Implements functions necessary to build an `EnsembleLearner` suitable for bioimgage segmentation" description: "Implements functions necessary to build an `EnsembleLearner` suitable for bioimgage segmentation" nb_path: "nbs/00_learner.ipynb" ---
t1 = Config(n=3)
t1.save('test_config')
t2 = Config()
t2.load('test_config.json')
test_eq(t1, t2)
e = np.random.randn(1024,1024)
test_close(energy_max(e, ks=100),0, eps=1e-01)
mask = (np.random.rand(1024,1024)>0.5).astype('uint8')
imageio.imsave('tst_msk.png', mask)
files = [Path('tst_msk.png')]
model = TestModel(padding=50)
ds_kwargs = {'tile_shape':(256,256), 'padding':(76,76), 'scale':1}
ds = TileDataset(files, **ds_kwargs)
dls = DataLoaders.from_dsets(ds, batch_size=4, shuffle=False, drop_last=False)
learn = Learner(dls, model, loss_func='')
g_smx, g_seg, g_std, g_eng = learn.predict_tiles(dl=dls.train)
out = g_seg[files[0]][:]
test_eq(mask, out)