Skip to content

Commit

Permalink
Add docstring to untransform_image
Browse files Browse the repository at this point in the history
  • Loading branch information
robertknight committed Feb 10, 2024
1 parent 548443b commit 24c5d10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ocrs_models/datasets/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def transform_image(img: torch.Tensor) -> torch.Tensor:


def untransform_image(img: torch.Tensor) -> torch.Tensor:
"""
Invert the transforms done by `transform_image`.
:param img: CHW tensor with pixel values in [-0.5, 0.5]
:return: 8-bit CHW tensor with values in [0, 255]
"""
return ((img + 0.5) * 255.0).type(torch.uint8)


Expand Down

0 comments on commit 24c5d10

Please sign in to comment.