PyTorch-YOLOv3 icon indicating copy to clipboard operation
PyTorch-YOLOv3 copied to clipboard

weight not change, but evaluate Map changed?

Open dancingpipi opened this issue 5 years ago • 0 comments

    for epoch in range(opt.epochs):
        model.train()
        start_time = time.time()
        for batch_i, (_, imgs, targets) in enumerate(dataloader):
            batches_done = len(dataloader) * epoch + batch_i

            imgs = Variable(imgs.to(device))
            targets = Variable(targets.to(device), requires_grad=False)

            loss, outputs = model(imgs, targets)
            break
            loss.backward()

            if batches_done % opt.gradient_accumulations:
                # Accumulates gradient before each step
                optimizer.step()
                optimizer.zero_grad()

I add 'break' before loss.backward(), the weight not update, but when I exec evaluate, the Map is change. Could any one can explain it?

dancingpipi avatar Mar 03 '20 13:03 dancingpipi