Skip to content

Commit

Permalink
Add: fix image transform to float (#1902)
Browse files Browse the repository at this point in the history
* 📚 Add action to check broken links (#1838)

* Fix broken links

* Add link checker

* Fix link in template

* linter

* nightly check

---------

Co-authored-by: Samet Akcay <[email protected]>

* Use LabelName ENUM for label assignment (#1881)

* Use LabelName ENUM for label assignment

* Update src/anomalib/deploy/inferencers/torch_inferencer.py

Co-authored-by: Samet Akcay <[email protected]>

---------

Co-authored-by: Samet Akcay <[email protected]>

* Changed prediction label assignment for OpenVINO inferencer (#1872)

* Update openvino_inferencer.py

Fixed incorrect label assignment.
Was True/False, now it's "Anomalous/Normal" as for the PyTorch inferencer in torch_inferencer.py

* Fix ruff

---------

Co-authored-by: Samet <[email protected]>

* Add: fix image transform to float

Signed-off-by: Bepitic <[email protected]>

* upd: video dtpe transform from torchvision

Signed-off-by: Bepitic <[email protected]>

* Added the scale.

Signed-off-by: Bepitic <[email protected]>

* Update src/anomalib/data/base/video.py

Co-authored-by: Dick Ameln <[email protected]>

---------

Signed-off-by: Bepitic <[email protected]>
Co-authored-by: Alexander Dokuchaev <[email protected]>
Co-authored-by: Samet Akcay <[email protected]>
Co-authored-by: TurboJonte <[email protected]>
Co-authored-by: Dick Ameln <[email protected]>
  • Loading branch information
5 people authored Mar 26, 2024
1 parent bca285e commit 9b78034
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/anomalib/data/base/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 9b78034

Please sign in to comment.