Ejemplo n.º 1
0
 def test_rsunet_zfactor(self):
     from emvision.models import rsunet_act
     device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
     net = rsunet_act(width=[3, 4, 5, 6], zfactor=[1, 2, 2],
                      act='ELU').to(device)
     x = torch.randn(1, 3, 20, 256, 256).to(device)
     y = net(x)
Ejemplo n.º 2
0
 def test_rsunet_leaky_relu(self):
     from emvision.models import rsunet_act
     device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
     net = rsunet_act(width=[3, 4, 5, 6],
                      act='LeakyReLU',
                      negative_slope=0.1).to(device)
     x = torch.randn(1, 3, 20, 256, 256).to(device)
     y = net(x)
Ejemplo n.º 3
0
def create_model(opt):
    if opt.width:
        width = opt.width
        depth = len(width)
    else:
        width = [16, 32, 64, 128, 256, 512]
        depth = opt.depth
    if opt.group > 0:
        # Group normalization
        core = rsunet_act_gn(width=width[:depth], group=opt.group, act=opt.act)
    else:
        # Batch normalization
        core = rsunet_act(width=width[:depth], act=opt.act)
    return Model(core, opt.in_spec, opt.out_spec, width[0], cropsz=opt.cropsz)