Ejemplo n.º 1
0
trainloader = DataLoader(ImageNet(
    train=True,
    transform=transforms.Compose([transforms.ToTensor()]),
    target_transform=transforms.Compose([transforms.ToTensor()]),
),
                         batch_size=10,
                         shuffle=False,
                         num_workers=8)

model = ResNetMCC()
model.to(device=DEVICE)

criterion = torch.nn.MSELoss(reduction='sum')
# criterion = multi_angular_loss
optimizer = torch.optim.Adam(model.parameters(),
                             lr=LEARNING_RATE,
                             weight_decay=WEIGHT_DECAY)
# optimizer = torch.optim.SGD(
#     model.parameters(),
#     momentum=0.9,
#     lr=LEARNING_RATE,
#     weight_decay=WEIGHT_DECAY
# )
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.1)


def run(epoch):
    statistical_losses = StatisticalValue()
    statistical_angular_errors = StatisticalValue()
Ejemplo n.º 2
0
        target_transform=transforms.Compose([
            transforms.ToTensor()
        ]),
    ),
    batch_size=10,
    shuffle=False,
    num_workers=8
)

model = ResNetMCC(layer_count=152)
model.to(device=DEVICE)

criterion = torch.nn.MSELoss(reduction='sum')
# criterion = multi_angular_loss
optimizer = torch.optim.Adam(
    model.parameters(),
    lr=LEARNING_RATE,
    weight_decay=WEIGHT_DECAY
)
# optimizer = torch.optim.SGD(
#     model.parameters(),
#     momentum=0.9,
#     lr=LEARNING_RATE,
#     weight_decay=WEIGHT_DECAY
# )
scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.1)

def run(epoch):
    statistical_losses = StatisticalValue()
    statistical_angular_errors = StatisticalValue()