Skip to content

Plots should be explicitly closed in add_cdf_image_summary #3603

@ethereon

Description

@ethereon

In the function add_cdf_image_summary within object_detection/utils/visualization_utils.py:

The CDF plots created using matplotlib (for instance, when training an object detector with focal loss) are not properly closed. Consequently, they aren't garbage collected and result in the following warning during training:

/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py:524: 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.max_open_warning)

Inserting plt.close(fig) before returning the image resolves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions