ultralytics 8.3.115 TIFF image RGB training and prediction support (#20301)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Laughing 2025-04-24 01:36:40 +08:00 committed by GitHub
parent 3f16fff832
commit 65bb0e98e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
__version__ = "8.3.114"
__version__ = "8.3.115"
import os

View File

@ -31,7 +31,8 @@ def imread(filename: str, flags: int = cv2.IMREAD_COLOR):
if filename.endswith((".tiff", ".tif")):
success, frames = cv2.imdecodemulti(file_bytes, cv2.IMREAD_UNCHANGED)
if success:
return np.stack(frames, axis=2) # or np.asarray(frames).transpose(1,2,0)
# handle RGB images in tif/tiff format
return frames[0] if len(frames) == 1 and frames[0].ndim == 3 else np.stack(frames, axis=2)
return None
else:
return cv2.imdecode(file_bytes, flags)