Exemplo n.º 1
0
def test_resnet():
    config_file = 'configs/benchmarks/resnet/r50_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/rxt50_32x4d_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/r50_torchvision_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = build_torchvision_resnet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/rxt50_32x4d_torchvision_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = build_torchvision_resnet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))
Exemplo n.º 2
0
def test_resnetd():
    config_file = 'configs/benchmarks/resnet/rd50_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/rxtd50_32x4d_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/rxtd50_32x4d_fast_avg_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))

    config_file = 'configs/benchmarks/resnet/rxtd50_32x4d_avg_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 100))
Exemplo n.º 3
0
def test_resnest():
    # resnetd
    model = ResNet(arch="resnest50_2s2x40d", num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))

    # resnetd
    model = ResNet(arch="resnest50_2s2x40d_fast", num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))
Exemplo n.º 4
0
def test_resnet():
    # for torchvision
    model = TorchvisionResNet(arch='resnet50', num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))

    # for custom
    model = ResNet(arch="resnet50", num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))

    # resnetxt_32x4d
    model = ResNet(arch="resnext50_32x4d", num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))
Exemplo n.º 5
0
def test_sknet():
    config_file = 'configs/benchmarks/resnet/sknet50_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 100))
Exemplo n.º 6
0
def test_resnet_gn():
    cfg.MODEL.NORM.TYPE = 'GroupNorm'
    norm_layer = get_norm(cfg)
    print(norm_layer)

    # for custom
    model = ResNet(arch="resnet50", num_classes=1000, norm_layer=norm_layer)
    print(model)
    test_data(model, (1, 3, 224, 224), (1, 1000))

    # resnetxt_32x4d
    model = ResNet(arch="resnext50_32x4d",
                   num_classes=1000,
                   norm_layer=norm_layer)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))
Exemplo n.º 7
0
def test_attention_resnetd(with_attentions=(1, 1, 1, 1),
                           reduction=16,
                           attention_type='SqueezeAndExcitationBlock2D'):
    # for custom
    model = ResNet(arch="resnetd50",
                   with_attentions=with_attentions,
                   reduction=reduction,
                   attention_type=attention_type,
                   num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))

    # resnetxt_32x4d
    model = ResNet(arch="resnext50_32x4d",
                   with_attentions=with_attentions,
                   reduction=reduction,
                   attention_type=attention_type,
                   num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))
Exemplo n.º 8
0
def test_resnest():
    config_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 100))

    config_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_fast_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 100))

    config_file = 'configs/benchmarks/resnet/rstd50_2s2x40d_fast_official_cifar100_224_e100_rmsprop.yaml'
    cfg.merge_from_file(config_file)

    model = ResNet(cfg)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 100))
Exemplo n.º 9
0
def test_sknet():
    # resnetd
    model = ResNet(arch="sknet50", num_classes=1000)
    print(model)
    test_data(model, (3, 3, 224, 224), (3, 1000))