Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyplot.py:514: RuntimeWarning: More than 20 figures have been opened. #7

Open
peterjpxie opened this issue Aug 26, 2019 · 0 comments
Open

Comments

@peterjpxie
Copy link

Error:

Epoch 89999     Loss: 0.245816 Average L1 error: 0.491549 Accuracy: 0.530000
Epoch 99999     Loss: 0.245776 Average L1 error: 0.491502 Accuracy: 0.526667
C:\Program Files\Python37\lib\site-packages\matplotlib\pyplot.py:514: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot
interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.m
ax_open_warning`).
  max_open_warning, RuntimeWarning)
Epoch 109999    Loss: 0.245730 Average L1 error: 0.491455 Accuracy: 0.533333
Epoch 119999    Loss: 0.245671 Average L1 error: 0.491410 Accuracy: 0.536667

Reason:
Duplicate plt.figure() in utils.py - plot_function().

Origin code:

def plot_function(losses, save_filepath=None, ylabel=None, title=None):
    plt.figure()
    t = [x[0] for x in losses]
    loss = [x[1] for x in losses]

    plt.figure()
    plt.plot(t, loss, 'b')

Working code:

def plot_function(losses, save_filepath=None, ylabel=None, title=None):
    # plt.figure()
    t = [x[0] for x in losses]
    loss = [x[1] for x in losses]

    plt.figure()
    plt.plot(t, loss, 'b')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant