From a8f531f9e97054d45f4ef7a044e973b69e19c454 Mon Sep 17 00:00:00 2001 From: Mactarvish Date: Sat, 24 Feb 2024 03:04:41 +0800 Subject: [PATCH] Compare `plt.get_backend()` in lowercase (#8409) Co-authored-by: Glenn Jocher --- ultralytics/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultralytics/utils/__init__.py b/ultralytics/utils/__init__.py index 5fc0c71b724..ddc9ba3f896 100644 --- a/ultralytics/utils/__init__.py +++ b/ultralytics/utils/__init__.py @@ -212,7 +212,7 @@ def decorator(func): def wrapper(*args, **kwargs): """Sets rc parameters and backend, calls the original function, and restores the settings.""" original_backend = plt.get_backend() - if backend != original_backend: + if backend.lower() != original_backend.lower(): plt.close("all") # auto-close()ing of figures upon backend switching is deprecated since 3.8 plt.switch_backend(backend)