Example #1
0
class Config(object):
    os.environ["CUDA_VISIBLE_DEVICES"] = "0"

    num_workers = 8
    batch_size = 64
    val_freq = 10

    learning_rate = 0.001

    num_way = 5
    num_shot = 1

    episode_size = 15
    test_episode = 600

    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()
    feature_encoder_ic = CNNEncoder()

    # ic
    ic_in_dim = 64
    ic_out_dim = 512
    ic_ratio = 1

    train_epoch = 900
    loss_fsl_ratio = 10.0
    loss_ic_ratio = 0.1

    model_name = "1_{}_{}_{}_{}_{}_{}_{}_{}_{}".format(
        train_epoch, batch_size, num_way, num_shot, ic_in_dim, ic_out_dim,
        ic_ratio, loss_fsl_ratio, loss_ic_ratio)

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"

    _root_path = "../models/two_ic_ufsl_2net"
    fe_dir = Tools.new_dir("{}/{}_fe_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    fe_ic_dir = Tools.new_dir("{}/{}_fe_ic_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    rn_dir = Tools.new_dir("{}/{}_rn_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    ic_dir = Tools.new_dir("{}/{}_ic_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    pass
class Config(object):
    os.environ["CUDA_VISIBLE_DEVICES"] = "0"

    # train_epoch = 300
    train_epoch = 180
    learning_rate = 0.001
    num_workers = 8

    val_freq = 10

    num_way = 5
    num_shot = 1
    batch_size = 64

    episode_size = 15
    test_episode = 600

    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()
    # feature_encoder, relation_network = CNNEncoder1(), RelationNetwork1()

    model_name = "{}_{}_{}_{}".format(train_epoch, batch_size, num_way,
                                      num_shot)

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"

    fe_dir = Tools.new_dir("../models/fsl/{}_fe_{}way_{}shot.pkl".format(
        model_name, num_way, num_shot))
    rn_dir = Tools.new_dir("../models/fsl/{}_rn_{}way_{}shot.pkl".format(
        model_name, num_way, num_shot))
    pass
Example #3
0
class Config(object):
    gpu_id = 2
    os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_id)

    num_workers = 8
    episode_size = 15
    test_episode = 600
    test_avg_num = 5

    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()

    # model_path = "../models/two_ic_ufsl_2net_res_sgd_acc"
    # model_fe_name = "0_2100_64_5_1_500_200_512_1_1.0_1.0_fe_5way_1shot.pkl"
    # model_rn_name = "0_2100_64_5_1_500_200_512_1_1.0_1.0_rn_5way_1shot.pkl"

    model_path = "../models/two_ic_ufsl_2net_res_sgd_acc_duli"
    model_fe_name = "2_2100_64_5_1_500_200_512_1_1.0_1.0_fe_5way_1shot.pkl"
    model_rn_name = "2_2100_64_5_1_500_200_512_1_1.0_1.0_rn_5way_1shot.pkl"

    fe_dir = Tools.new_dir(os.path.join(model_path, model_fe_name))
    rn_dir = Tools.new_dir(os.path.join(model_path, model_rn_name))

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"

    pass
Example #4
0
class Config(object):
    gpu_id = 0
    os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_id)

    num_workers = 16

    num_way = 5
    num_shot = 1
    batch_size = 64

    val_freq = 10
    episode_size = 15
    test_episode = 600

    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()

    # ic
    ic_out_dim = 512
    # ic_out_dim = 2560
    ic_ratio = 1

    learning_rate = 0.01
    # loss_fsl_ratio = 10.0
    # loss_ic_ratio = 0.1
    loss_fsl_ratio = 1.0
    loss_ic_ratio = 1.0

    # train_epoch = 500
    # first_epoch, t_epoch = 300, 150
    # adjust_learning_rate = RunnerTool.adjust_learning_rate2

    train_epoch = 2100
    first_epoch, t_epoch = 500, 200
    adjust_learning_rate = RunnerTool.adjust_learning_rate1

    model_name = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}_{}".format(
        gpu_id, train_epoch, batch_size, num_way, num_shot, first_epoch,
        t_epoch, ic_out_dim, ic_ratio, loss_fsl_ratio, loss_ic_ratio)

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"

    _root_path = "../models/two_ic_ufsl_2net_res_sgd_acc"
    fe_dir = Tools.new_dir("{}/{}_fe_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    rn_dir = Tools.new_dir("{}/{}_rn_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    ic_dir = Tools.new_dir("{}/{}_ic_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    pass
class Config(object):
    os.environ["CUDA_VISIBLE_DEVICES"] = "2"

    learning_rate = 0.01
    num_workers = 8

    num_way = 5
    num_shot = 1
    batch_size = 64

    val_freq = 10
    episode_size = 15
    test_episode = 600

    # ic
    ic_in_dim = 64
    ic_out_dim = 512
    ic_ratio = 1

    loss_fsl_ratio = 10.0
    loss_ic_ratio = 0.1

    train_epoch = 600
    first_epoch, t_epoch = 300, 150
    adjust_learning_rate = RunnerTool.adjust_learning_rate2

    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()
    # feature_encoder, relation_network = CNNEncoder1(), RelationNetwork1()

    model_name = "2_{}_{}_{}_{}_{}_{}_{}_{}_{}".format(
        train_epoch, batch_size, first_epoch, t_epoch, ic_in_dim, ic_out_dim,
        ic_ratio, loss_fsl_ratio, loss_ic_ratio)

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"

    fe_dir = Tools.new_dir(
        "../models/two_ic_fsl_sgd/{}_fe_{}way_{}shot.pkl".format(
            model_name, num_way, num_shot))
    rn_dir = Tools.new_dir(
        "../models/two_ic_fsl_sgd/{}_rn_{}way_{}shot.pkl".format(
            model_name, num_way, num_shot))
    ic_dir = Tools.new_dir(
        "../models/two_ic_fsl_sgd/{}_ic_{}way_{}shot.pkl".format(
            model_name, num_way, num_shot))
    pass
class Config(object):
    gpu_id = 0
    os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_id)

    num_workers = 8

    num_way = 5
    num_shot = 1
    batch_size = 64

    val_freq = 10
    episode_size = 15
    test_episode = 600

    learning_rate = 0.01
    loss_fsl_ratio = 1.0
    loss_ic_ratio = 1.0

    train_epoch = 2100
    first_epoch, t_epoch = 500, 200
    adjust_learning_rate = RunnerTool.adjust_learning_rate1

    # ic
    ic_out_dim = 512
    ic_ratio = 1

    ##############################################################################################################
    # resnet = resnet18
    resnet = resnet34
    feature_encoder, relation_network = CNNEncoder(), RelationNetwork()

    is_png = True
    # is_png = False

    # modify_head = False
    modify_head = True
    ##############################################################################################################

    model_name = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}_{}{}{}".format(
        gpu_id, train_epoch, batch_size, num_way, num_shot, first_epoch,
        t_epoch, ic_out_dim, ic_ratio, loss_fsl_ratio, loss_ic_ratio,
        "_head" if modify_head else "", "_png" if is_png else "")

    if "Linux" in platform.platform():
        data_root = '/mnt/4T/Data/data/miniImagenet'
        if not os.path.isdir(data_root):
            data_root = '/media/ubuntu/4T/ALISURE/Data/miniImagenet'
    else:
        data_root = "F:\\data\\miniImagenet"
    data_root = os.path.join(data_root,
                             "miniImageNet_png") if is_png else data_root
    Tools.print(data_root)

    _root_path = "../models/two_ic_ufsl_2net_res_sgd_acc_duli"
    fe_dir = Tools.new_dir("{}/{}_fe_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    rn_dir = Tools.new_dir("{}/{}_rn_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    ic_dir = Tools.new_dir("{}/{}_ic_{}way_{}shot.pkl".format(
        _root_path, model_name, num_way, num_shot))
    pass