Skip to content
Snippets Groups Projects

Implementation of Deep Learning unit tests, as well as paths to the 2d data for windows users in the UNet jupyter notebook.

1 file
+ 34
0
Compare changes
  • Side-by-side
  • Inline
+ 34
0
import qim3d
from os import name
# unit test for model summary()
def test_model_summary():
if name == 'nt':
path = '//home.cc.dtu.dk/3dimage/projects/2023_STUDIOS_SD/analysis/data/Belialev2020/side'
else:
path = '/dtu/3d-imaging-center/projects/2023_STUDIOS_SD/analysis/data/Belialev2020/side'
unet = qim3d.models.UNet(size = 'small')
augment = qim3d.utils.Augmentation()
train_set,val_set,test_set = qim3d.utils.prepare_datasets(path,0.1,unet,augment)
train_loader,_,_ = qim3d.utils.prepare_dataloaders(train_set,val_set,test_set,
batch_size = 1,num_workers = 1,
pin_memory = False)
summary = qim3d.utils.model_summary(train_loader,unet)
assert summary.input_size[0] == (1,1,256,256)
# unit test for inference()
def test_inference():
if name == 'nt':
path = '//home.cc.dtu.dk/3dimage/projects/2023_STUDIOS_SD/analysis/data/Belialev2020/side'
else:
path = '/dtu/3d-imaging-center/projects/2023_STUDIOS_SD/analysis/data/Belialev2020/side'
unet = qim3d.models.UNet(size = 'small')
augment = qim3d.utils.Augmentation()
train_set,_,_ = qim3d.utils.prepare_datasets(path,0.1,unet,augment)
_, targ,_ = qim3d.utils.inference(train_set,unet)
assert tuple(targ[0].unique()) == (0,1)
Loading