kozistr / gan-metrics

Lots of evaluation metrics for the generative adversarial networks in pytorch
Apache License 2.0
9 stars 2 forks source link

How to plot the each metric in a line graph? #1

Open Ghaleb-alnakhlani opened 2 years ago

Ghaleb-alnakhlani commented 2 years ago

Hi,

Is it possible to plot the metric outcome into a line graph?

Thank you

kozistr commented 2 years ago

hello!

unfortunately, in this repo, there's no method to plot the metrics : ( but maybe you can plot the metric with libraries like matplotlib or seaborn

Thanks in advance

Ghaleb-alnakhlani commented 2 years ago

Hi thank you for responding.

Can you please share how I can do that? If you have an example?

And just to clarify something I face some issues when I used the script. I was using google colab. Is this correct I just need to run the python3 -m metrics and that is all?

thank you

kozistr commented 2 years ago

well, it depends on what you want to plot! I just attach line plot examples with code.

Hope it helps you : )

kozistr commented 2 years ago

sorry for the usage. final usage is like what you mentioned, python3 -m metrics. But, code isn't completed though : (

To make it works,

  1. build a real & fake (pytorch) dataloaders, like here
  2. define the metric and call it. code
    # pseudo code
    fid = FID()
    fid(real_data_loader, fake_data_loader)
Ghaleb-alnakhlani commented 2 years ago

well, it depends on what you want to plot! I just attach line plot examples with code.

Hope it helps you : )

I would like to plot loss_log.txt produced by pix2pixHD training. xaxis would be the iteration and yaxis the number of epochs. and show the loss curve decreasing during the training.

Ghaleb-alnakhlani commented 2 years ago

sorry for the usage. final usage is like what you mentioned, python3 -m metrics. But, code isn't completed though : (

To make it works,

  1. build a real & fake (pytorch) dataloaders, like here
  2. define the metric and call it. code
    # pseudo code
    fid = FID()
    fid(real_data_loader, fake_data_loader)

Now it make more sense. thank you for clarifying that I will make those changes and try it

kozistr commented 2 years ago

well, it depends on what you want to plot! I just attach line plot examples with code. Hope it helps you : )

I would like to plot loss_log.txt produced by pix2pixHD training. xaxis would be the iteration and yaxis the number of epochs. and show the loss curve decreasing during the training.

you can code like this!

# matplotlib example, you can find more details on the matplotlib documentations
metrics = [10.2, 5.1, 2.1, 1.1, ...]
plt.plot(metrics , list(range(0, num_epochs)))

or you can use the loggers like Tensorboard, Wandb.

Ghaleb-alnakhlani commented 2 years ago

well, it depends on what you want to plot! I just attach line plot examples with code. Hope it helps you : )

I would like to plot loss_log.txt produced by pix2pixHD training. xaxis would be the iteration and yaxis the number of epochs. and show the loss curve decreasing during the training.

you can code like this!

# matplotlib example, you can find more details on the matplotlib documentations
metrics = [10.2, 5.1, 2.1, 1.1, ...]
plt.plot(metrics , list(range(0, num_epochs)))

or you can use the loggers like Tensorboard, Wandb.

Really can I use Tensorboard for this? I just need to upload the loss_log file. I have not tried it before and I though it was only used while training not after training is finished.

kozistr commented 2 years ago

oh i see! it's possible to plot with Tensorboard after the training. However, as you said, usually we use the logger to plot the metrics while training.

in your case, i guess it'd be better to use the visualization library like matplotlib : )