Ejemplo n.º 1
0
def main():

    structures = [(8, 3), (1, 27)]  #(cardinality, layers)
    substructures = ["ResNeXt3", "RDB3"]
    blocks = ["NeXt", "vanilla"]

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    idx = 0
    for block in blocks:
        for substruct in substructures:
            for struct in structures:
                idx += 1
                #split work across 2 gpus:

                if idx - 1 < 6 and GPU_DEVICE == 1:
                    continue
                elif idx - 1 >= 4 and GPU_DEVICE == 0:
                    continue

                (cardinality, layers) = struct

                kwargs = {
                    "layers": layers,
                    "cardinality": cardinality,
                    "block_type": block,
                    "module_type": substruct
                }

                for k, v in kwargs.items():
                    print("{}={}, ".format(k, v), end="")
                print()

                settings = ResStack3(**kwargs)
                settings.GPU_DEVICE = GPU_DEVICE
                settings.export_env_vars()

                expdir = exp_base + str(idx - 1) + "/"

                trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
                expdir = trainer.expdir  #get full path

                model = trainer.train(expt.EPOCHS,
                                      test_every=expt.test_every,
                                      num_epochs_cv=expt.num_epochs_cv,
                                      learning_rate=expt.LR,
                                      print_every=expt.print_every,
                                      small_debug=expt.SMALL_DEBUG_DOM)
def main():
    kwargs = {
        "cardinality": 1,
        "block_type": "RNAB",
        "sigmoid": True,
        "module_type": "Bespoke",
        "attenuation": False
    }
    layers = [
        1,
        2,
        4,
        8,
    ]

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    idx = 0

    for layer in layers:
        kwargs[
            "subBlock"] = "NeXt"  #this performed slightly better on first case
        kwargs["layers"] = layer
        idx += 1

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx - 1) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)
def main():

    layers = [3, 6, 9, 18, 27]
    cardinalities = [1, 4, 8, 16, 32]
    substructure = "ResNeXt3"
    block = "NeXt"

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    idx = 0
    for layer in layers:
        for cardinality in cardinalities:
            idx_ = idx
            idx += 1
            #split work across 4 gpus:
            if idx_ % 4 != GPU_DEVICE:
                continue

            kwargs = {
                "layers": layer,
                "cardinality": cardinality,
                "block_type": block,
                "module_type": substructure
            }
            for k, v in kwargs.items():
                print("{}={}, ".format(k, v), end="")
            print()

            settings = ResStack3(**kwargs)
            settings.GPU_DEVICE = GPU_DEVICE
            settings.export_env_vars()

            expdir = exp_base + str(idx_) + "/"

            trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
            expdir = trainer.expdir  #get full path

            model = trainer.train(expt.EPOCHS,
                                  test_every=expt.test_every,
                                  num_epochs_cv=expt.num_epochs_cv,
                                  learning_rate=expt.LR,
                                  print_every=expt.print_every,
                                  small_debug=expt.SMALL_DEBUG_DOM)
Ejemplo n.º 4
0
def main():
    activations = ["relu"]
    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    expt.LR *= 0.1

    idx = 0
    for act in activations:

        kwargs = {
            "layers": 0,
            "cardinality": 2,
            "aug_scheme": 4,
            "activation": act
        }

        idx_ = idx
        idx += 1
        if idx_ % NUM_GPU != GPU_DEVICE:
            continue

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx - 1) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)
def main():


    blocks = ["CBAM_vanilla", "vanilla", "CBAM_NeXt"]
    kwargs = {"cardinality": 1, "block_type": "RAB",
                    "sigmoid": True, "module_type": "Bespoke",
                    "attenuation": False, "layers": 4, 
                    "aug_scheme": 0}

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    idx = 0

    for block in blocks:
        kwargs["subBlock"] = block

        idx_ = idx
        idx += 1
        if idx_ % NUM_GPU != GPU_DEVICE:
            continue


        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx_) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir #get full path


            model = trainer.train(expt.EPOCHS, test_every=expt.test_every,
                                    num_epochs_cv=expt.num_epochs_cv,
                                    learning_rate = expt.LR, print_every=expt.print_every,
                                    small_debug=expt.SMALL_DEBUG_DOM)
Ejemplo n.º 6
0
def main():
    blocks = ["NeXt", "vanilla"]
    kwargs = {
        "layers": 1,
        "cardinality": 1,
        "block_type": "RNAB",
        "module_type": "Bespoke"
    }
    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()

    idx = 0

    for block in blocks:
        kwargs["subBlock"] = block
        idx += 1

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx - 1) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)
def main():
    exp_base = "experiments/train2/07c/"
    kwargs = {
        "model_name": "Tucodec",
        "block_type": "NeXt",
        "Cstd": 64,
        "sigmoid": False,
        "activation": "prelu"
    }
    aug_schemes = list(range(5, 7))

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()
        expt.EPOCHS = 300

    idx = 0
    for aug_scheme in aug_schemes:
        kwargs["aug_scheme"] = aug_scheme

        idx_ = idx
        idx += 1
        if idx_ % NUM_GPU != GPU_DEVICE:
            continue

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = CLIC(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx - 1) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)

    exp_base = "experiments/train2/09b/"

    activations = ["relu", "GDN"]
    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()
        expt.EPOCHS = 150

    for act in activations:

        kwargs = {
            "layers": 0,
            "cardinality": 2,
            "aug_scheme": 0,
            "activation": act
        }

        idx_ = idx
        idx += 1
        if idx_ % NUM_GPU != GPU_DEVICE:
            continue

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx - 1) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)
def main():
    idx = 0
    ##################### 02c

    structure = (4, 27)  #(cardinality, layers)
    substructures = ["ResNeXt3", "RDB3"]
    blocks = ["CBAM_vanilla", "vanilla", "NeXt", "CBAM_NeXt"]

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()
        expt.EPOCHS = 150

    for substruct in substructures:

        for block in blocks:
            (cardinality, layers) = structure
            idx_ = idx
            idx += 1
            if idx_ % NUM_GPU != GPU_DEVICE:
                continue

            kwargs = {
                "layers": layers,
                "cardinality": cardinality,
                "block_type": block,
                "module_type": substruct,
                "aug_scheme": 0
            }

            for k, v in kwargs.items():
                print("{}={}, ".format(k, v), end="")
            print()

            settings = ResStack3(**kwargs)
            settings.GPU_DEVICE = GPU_DEVICE
            settings.export_env_vars()

            expdir = exp_base + str(idx_) + "/"

            trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
            expdir = trainer.expdir  #get full path

            model = trainer.train(expt.EPOCHS,
                                  test_every=expt.test_every,
                                  num_epochs_cv=expt.num_epochs_cv,
                                  learning_rate=expt.LR,
                                  print_every=expt.print_every,
                                  small_debug=expt.SMALL_DEBUG_DOM)

    ################# 03c
    blocks = ["CBAM_vanilla", "vanilla", "CBAM_NeXt"]
    kwargs = {
        "cardinality": 1,
        "block_type": "RAB",
        "sigmoid": True,
        "module_type": "Bespoke",
        "attenuation": False,
        "layers": 4,
        "aug_scheme": 0
    }

    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()
        expt.EPOCHS = 150

    for block in blocks:
        kwargs["subBlock"] = block

        idx_ = idx
        idx += 1
        if idx_ % NUM_GPU != GPU_DEVICE:
            continue

        for k, v in kwargs.items():
            print("{}={}, ".format(k, v), end="")
        print()

        settings = ResStack3(**kwargs)
        settings.GPU_DEVICE = GPU_DEVICE
        settings.export_env_vars()

        expdir = exp_base + str(idx_) + "/"

        trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
        expdir = trainer.expdir  #get full path

        model = trainer.train(expt.EPOCHS,
                              test_every=expt.test_every,
                              num_epochs_cv=expt.num_epochs_cv,
                              learning_rate=expt.LR,
                              print_every=expt.print_every,
                              small_debug=expt.SMALL_DEBUG_DOM)

    ################################06a5
    blocks = [
        "NeXt",
        "vanilla",
        "CBAM_vanilla",
        "CBAM_NeXt",
    ]
    Cstd = 64
    sigmoid = False
    activations = ["relu"]
    if TEST:
        expt = ExptConfigTest()
    else:
        expt = ExptConfig()
        expt.EPOCHS = 300

    for activation in activations:
        for block in blocks:
            kwargs = {
                "model_name": "Tucodec",
                "block_type": block,
                "Cstd": Cstd,
                "sigmoid": sigmoid,
                "activation": activation,
                "aug_scheme": 0
            }
            idx_ = idx
            idx += 1

            if idx_ % NUM_GPU != GPU_DEVICE:
                continue

            for k, v in kwargs.items():
                print("{}={}, ".format(k, v), end="")
            print()

            settings = CLIC(**kwargs)
            settings.GPU_DEVICE = GPU_DEVICE
            settings.export_env_vars()

            expdir = exp_base + str(idx - 1) + "/"

            trainer = TrainAE(settings, expdir, expt.calc_DA_MAE)
            expdir = trainer.expdir  #get full path

            model = trainer.train(expt.EPOCHS,
                                  test_every=expt.test_every,
                                  num_epochs_cv=expt.num_epochs_cv,
                                  learning_rate=expt.LR,
                                  print_every=expt.print_every,
                                  small_debug=expt.SMALL_DEBUG_DOM)