示例#1
0
            transforms.ToTensor(),
            transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                 std=[0.229, 0.224, 0.225])
        ])
        test_dataset = datasets.ImageFolder(args.data_dir,
                                            train=False,
                                            download=False,
                                            transform=test_transform)
        train_pics = 121187
    elif args.model == 'Abalone':
        model = ResNetOnCifar10.abalone_model()
        test_dataset = mldatasets.abalone(args.data_dir, False)
        train_pics = 3342
    elif args.model == "Bodyfat":
        model = ResNetOnCifar10.bodyfat_model()
        test_dataset = mldatasets.bodyfat(args.data_dir, False)
        train_pics = 202
    elif args.model == 'Housing':
        model = ResNetOnCifar10.housing_model()
        test_dataset = mldatasets.housing(args.data_dir, False)
        train_pics = 405
    else:
        print('Model must be {} or {}!'.format('MnistCNN', 'AlexNet'))
        sys.exit(-1)

    train_bsz = args.train_bsz
    train_bsz /= len(workers)

    world_size = args.workers_num + 1
    this_rank = args.this_rank
示例#2
0
        test_transform = train_transform
        train_dataset = datasets.ImageFolder(args.data_dir,
                                             train=True,
                                             download=False,
                                             transform=train_transform)
        test_dataset = datasets.ImageFolder(args.data_dir,
                                            train=False,
                                            download=False,
                                            transform=test_transform)
    elif args.model == 'Abalone':
        model = ResNetOnCifar10.abalone_model()
        train_dataset = mldatasets.abalone(args.data_dir, True)
        test_dataset = mldatasets.abalone(args.data_dir, False)
    elif args.model == "Bodyfat":
        model = ResNetOnCifar10.bodyfat_model()
        train_dataset = mldatasets.bodyfat(args.data_dir, True)
        test_dataset = mldatasets.bodyfat(args.data_dir, False)
    elif args.model == 'Housing':
        model = ResNetOnCifar10.housing_model()
        train_dataset = mldatasets.housing(args.data_dir, True)
        test_dataset = mldatasets.housing(args.data_dir, False)
    else:
        print('Model must be {} or {}!'.format('MnistCNN', 'AlexNet'))
        sys.exit(-1)

    train_bsz = args.train_bsz
    test_bsz = 400

    train_bsz /= len(workers)
    train_bsz = int(train_bsz)