Пример #1
0
def getOpt(optDN):
    model = optDN['model']
    if not model in mode_switch:
        return
    opt = Option(mode_switch[model][0])
    opt.modelDef = mode_switch[model][1]

    opt.ramCoef = mode_switch[model][2][config.getRunType()]
    opt.cropsize = config.getConfig()[1 if model[:4] == 'lite' else 2]
    opt.modelCached = initModel(opt, opt.model, 'DN' + model)
    opt.squeeze = lambda x: x.squeeze(1)
    opt.unsqueeze = lambda x: x.unsqueeze(1)
    opt.padding = 5
    return opt
Пример #2
0
def getOpt(optSR):
    opt = Option()
    opt.mode = optSR['model']
    opt.scale = optSR['scale']
    nmode = opt.mode + str(opt.scale)
    if not nmode in mode_switch:
        return
    if opt.mode[:3] != 'gan':
        opt.squeeze = lambda x: x.squeeze(1)
        opt.unsqueeze = lambda x: x.unsqueeze(1)
    opt.padding = 9 if opt.scale == 3 else 5
    opt.model = mode_switch[nmode][0]
    opt.modelDef = mode_switch[nmode][1]
    opt.ensemble = optSR['ensemble'] if 'ensemble' in optSR and (
        0 <= optSR['ensemble'] <= 7) else config.ensembleSR

    opt.ramCoef = mode_switch[nmode][2][config.getRunType()]
    opt.cropsize = config.getConfig()[0]
    opt.modelCached = initModel(opt, opt.model, 'SR' + nmode)
    return opt