Search code examples
pythonpytorchtensorboard

Tensorboard only showing dots, line not showing


I am using tensorboard through pytorch and have created a scaler which shows accuracy, loss, and validation accuracy. When I open the graph it only shows dot and dosen't show a line connecting these dots.

Here is a snippet of my code

tb = SummaryWriter(comment=f'-{epoch}')

tb.add_scalar("Accuracy", float(correct/len(train_tensor)*100), epoch)
tb.add_scalar("Loss", loss, epoch)
tb.add_scalar("ValiAccuracy", float(correct/len(train_tensor)*100), epoch)
tb.close()

What is leading tensorboard to not show these lines? Here is what tensorboard looks like


Solution

  • You are always creating a new directory with your "comment" (depends on your epoch) in the definition of the SummaryWriter. Each subdirectory will be treated as a different experiment in the tensorboard. Thats why they have different colors and only show dots instead of a connected line.

    You can try to define your SummaryWriter without a comment:

    tb = SummaryWriter()