Beispiel #1
0
    '--log-interval',
    type=int,
    default=10,
    metavar='N',
    help='how many batches to wait before logging training status')
args = parser.parse_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()

torch.manual_seed(args.seed)
if args.cuda:
    torch.cuda.manual_seed(args.seed)

kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {}
trainset = FashionAI('./',
                     attribute=args.attribute,
                     split=0.8,
                     ci=args.ci,
                     data_type='train',
                     reset=False)
testset = FashionAI('./',
                    attribute=args.attribute,
                    split=0.8,
                    ci=args.ci,
                    data_type='test',
                    reset=trainset.reset)
train_loader = DataLoader(trainset,
                          batch_size=args.batch_size,
                          shuffle=True,
                          **kwargs)
test_loader = DataLoader(testset,
                         batch_size=args.test_batch_size,
                         shuffle=True,
Beispiel #2
0
parser.add_argument(
    '--log-interval',
    type=int,
    default=10,
    metavar='N',
    help='how many batches to wait before logging training status')
args = parser.parse_args()
args.cuda = not args.no_cuda and torch.cuda.is_available()

torch.manual_seed(args.seed)
if args.cuda:
    torch.cuda.manual_seed(args.seed)

kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {}
evalset = FashionAI('./',
                    attribute=args.attribute,
                    data_type='eval',
                    reset=False)
eval_loader = torch.utils.data.DataLoader(evalset,
                                          batch_size=args.batch_size,
                                          shuffle=True,
                                          **kwargs)


class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 10, kernel_size=5)
        self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
        self.conv2_drop = nn.Dropout2d()
        self.fc1 = nn.Linear(180, 50)
        self.fc2 = nn.Linear(50, 8)