OpenGVLab / SAM-Med2D

Official implementation of SAM-Med2D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some issue about training proecss

Hhankyangg opened this issue · comments

The training code only uses the training set, and decides whether to save the model based on the loss of the training set. This is very strange. There is also the risk of being overfitting, right?

if average_loss < best_loss:
    best_loss = average_loss
    save_path = os.path.join(args.work_dir, "models", args.run_name, f"epoch{epoch+1}_sam.pth")
    state = {'model': model.float().state_dict(), 'optimizer': optimizer}
    torch.save(state, save_path)