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:
parent
3f16fff832
commit
65bb0e98e9
@ -1,6 +1,6 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
__version__ = "8.3.114"
|
||||
__version__ = "8.3.115"
|
||||
|
||||
import os
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user