Skip to content

Commit

Permalink
🐞Fix visualization (#1766)
Browse files Browse the repository at this point in the history
Fix visualization
  • Loading branch information
ashwinvaidya17 authored Feb 22, 2024
1 parent 8c6a4fa commit 8a67e1e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/anomalib/utils/visualization/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ def generate(self) -> np.ndarray:
"""
num_cols = len(self.images)
figure_size = (num_cols * 5, 5)

# Use Agg backend. This method fails when using backend like MacOSX which might be automatically selected
# The dimension of image returned by tostring_rgb() does not match the dimension of the canvas
matplotlib.use("Agg")

self.figure, self.axis = plt.subplots(1, num_cols, figsize=figure_size)
self.figure.subplots_adjust(right=0.9)

Expand Down

0 comments on commit 8a67e1e

Please sign in to comment.