Implementing uint16 reading with tifffile

This commit is contained in:
2025-12-16 23:02:45 +02:00
parent e5036c10cf
commit e364d06217
4 changed files with 35 additions and 62 deletions

View File

@@ -1303,6 +1303,14 @@ class TrainingTab(QWidget):
sample_image = self._find_first_image(images_dir)
if not sample_image:
return False
# Do not force an RGB cache for TIFF datasets.
# We handle grayscale/16-bit TIFFs via runtime Ultralytics patches that:
# - load TIFFs with `tifffile`
# - replicate grayscale to 3 channels without quantization
# - normalize uint16 correctly during training
if sample_image.suffix.lower() in {".tif", ".tiff"}:
return False
try:
img = Image(sample_image)
return img.pil_image.mode.upper() != "RGB"