MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / image_path_to_tensor

Function image_path_to_tensor

examples/image_fitting.py:152–158  ·  view source on GitHub ↗
(image_path: Path)

Source from the content-addressed store, hash-verified

150
151
152def image_path_to_tensor(image_path: Path):
153 import torchvision.transforms as transforms
154
155 img = Image.open(image_path)
156 transform = transforms.ToTensor()
157 img_tensor = transform(img).permute(1, 2, 0)[..., :3]
158 return img_tensor
159
160
161def main(

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected