Skip to content

Commit 0ba2dcd

Browse files
author
valhassan
committed
Improve visualization function with explicit figure closing
1 parent cb66c34 commit 0ba2dcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

geo_deep_learning/tools/visualization.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def visualize_prediction(image,
4545
plt.imsave(save_path / f"{sample_name}_prediction.png", prediction, cmap=cmap, vmin=0, vmax=num_classes-1)
4646

4747
# Create the visualization
48+
plt.close('all')
4849
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
4950
# axes = axes.reshape(num_samples, 3) if num_samples > 1 else axes.reshape(1, 3)
5051

@@ -75,5 +76,5 @@ def visualize_prediction(image,
7576

7677
if save_path:
7778
plt.savefig(save_path)
78-
79+
plt.close(fig)
7980
return fig

0 commit comments

Comments
 (0)