diff --git a/src/anomalib/data/base/video.py b/src/anomalib/data/base/video.py index 7e9461a0a9..f2882e18a4 100644 --- a/src/anomalib/data/base/video.py +++ b/src/anomalib/data/base/video.py @@ -10,6 +10,7 @@ import torch from pandas import DataFrame from torchvision.transforms.v2 import Transform +from torchvision.transforms.v2.functional import to_dtype_video from torchvision.tv_tensors import Mask from anomalib import TaskType @@ -153,6 +154,7 @@ def __getitem__(self, index: int) -> dict[str, str | torch.Tensor]: msg = "self.indexer must be an instance of ClipsIndexer." raise TypeError(msg) item = self.indexer.get_item(index) + item["image"] = to_dtype_video(video=item["image"], scale=True) # include the untransformed image for visualization item["original_image"] = item["image"].to(torch.uint8)