Example #1
0
                                       CONFIG["BATCH_SIZE"],
                                       shuffle=True,
                                       collate_fn=ssd_utils.detection_collate)

if FROM_TRAIN_ITER > 1:
    net.load_state_dict(t.load("outputs/SSD_%03d.pth" % (FROM_TRAIN_ITER - 1)))

index = 0
step_index = 0
# predict = j_m_ssd.SSDPredict(CONFIG["CLASSES"])
bar = j_bar.ProgressBar(CONFIG["EPOCH"], len(train_loader),
                        "Loss : %.3f; Total Loss : %.3f")

predict = ssd_predict.SSDPredict(CONFIG["CLASSES"])
net.train()
log = logger.Logger(CONFIG["LOG_DIR"])
for epoch in range(FROM_TRAIN_ITER, CONFIG["EPOCH"] + 1):
    total_loss = 0.
    t.cuda.empty_cache()
    for i, (images, targets) in enumerate(train_loader):
        index += i
        if epoch >= 30:
            LEARNING_RATE = 0.0005
        if epoch >= 50:
            LEARNING_RATE = 0.00025
        if epoch >= 80:
            LEARNING_RATE = 0.00001
        if epoch >= 100:
            LEARNING_RATE = 0.000005
        for param_group in optimizer.param_groups:
            param_group['lr'] = LEARNING_RATE
Example #2
0
            print("learning rate down")
            lr = lr * scale
            if batch == steps[i]:
                break
        else:
            break
    for param_group in optimizer.param_groups:
        param_group['lr'] = lr / batch_size
    return lr


processed_batches = 0
if FROM_TRAIN_ITER > 1:
    model.load_state_dict(
        torch.load("outputs/YOLOV3_%03d.pth" % (FROM_TRAIN_ITER - 1)))
log = logger.Logger("logs/")
predict = yolo_predict.YoloV3Predict(CONFIG["CLASSES"])
LEARNING_RATE = learning_rate
bar = j_bar.ProgressBar(max_epochs, len(train_loader),
                        "Loss:%.3f;Total Loss:%.3f")
for epoch in range(FROM_TRAIN_ITER, max_epochs + 1):
    model.train()
    total_loss = 0
    torch.cuda.empty_cache()
    # if epoch >= 1:
    #     LEARNING_RATE = 0.01
    # if epoch >= 30:
    #     LEARNING_RATE = 0.005
    # if epoch >= 60:
    #     LEARNING_RATE = 0.001
    # if epoch >= 90: