def create_network(config):
    if 'dorn' in config['ARCHITECTURE']:
        cnn = dorn_architecture.DORN(output_channel=3, training_mode=config['OPERATION'])

    elif 'p_fpn' in config['ARCHITECTURE']:
        if 'resnet101' in config['ARCHITECTURE']:
            cnn = fpn_architecture.PlainFPN(in_channels=3, training_mode=config['OPERATION'], backbone='resnet101')
        else:
            raise Exception('Network architecture not implemented!')

    elif 'd_fpn' in config['ARCHITECTURE']:
        if 'resnext101' in config['ARCHITECTURE']:
            cnn = fpn_architecture.ASPP_FPN(in_channels=3, training_mode=config['OPERATION'], backbone='resnext101')
        elif 'resnet101' in config['ARCHITECTURE']:
            cnn = fpn_architecture.ASPP_FPN(in_channels=3, training_mode=config['OPERATION'], backbone='resnet101')
        else:
            raise Exception('Network architecture not implemented!')

    elif config['ARCHITECTURE'] == 'stn_fpn':
            cnn = stn_fpn.SpatialWarpingFPN(fc_img=np.array([202., 202.]))

    else:
        raise Exception('Network architecture not implemented!')

    cnn = cnn.cuda()
    return cnn
示例#2
0
def create_network(config):
    if config['ARCHITECTURE'] == 'dorn':
        cnn = dorn_architecture.DORN(output_channel=3,
                                     training_mode=config['OPERATION'])
    elif config['ARCHITECTURE'] == 'dorn_batchnorm':
        cnn = dorn_architecture.DORNBN(output_channel=3,
                                       training_mode=config['OPERATION'])
    elif config['ARCHITECTURE'] == 'pfpn':
        cnn = fpn_architecture.PFPN(in_channels=3,
                                    training_mode=config['OPERATION'],
                                    backbone='resnet101')
    elif config['ARCHITECTURE'] == 'dfpn':
        cnn = fpn_architecture.DFPN(backbone='resnext101')
    elif config['ARCHITECTURE'] == 'spatial_rectifier':
        cnn = spatial_rectifier_networks.SpatialRectifier()
    elif config['ARCHITECTURE'] == 'sr_pfpn':
        cnn = spatial_rectifier_networks.SpatialRectifierPFPN(
            sr_cnn_ckpt=config['SR_CKPT_PATH'])
    elif config['ARCHITECTURE'] == 'sr_dfpn':
        cnn = spatial_rectifier_networks.SpatialRectifierDFPN(
            sr_cnn_ckpt=config['SR_CKPT_PATH'])
    elif config['ARCHITECTURE'] == 'sr_dorn':
        cnn = spatial_rectifier_networks.SpatialRectifierDORN(
            sr_cnn_ckpt=config['SR_CKPT_PATH'])

    cnn = cnn.cuda()

    return cnn