MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / PILtoTorch

Function PILtoTorch

utils/general_utils.py:22–28  ·  view source on GitHub ↗
(pil_image, resolution)

Source from the content-addressed store, hash-verified

20 return torch.log(x/(1-x))
21
22def PILtoTorch(pil_image, resolution):
23 resized_image_PIL = pil_image.resize(resolution)
24 resized_image = torch.from_numpy(np.array(resized_image_PIL)) / 255.0
25 if len(resized_image.shape) == 3:
26 return resized_image.permute(2, 0, 1)
27 else:
28 return resized_image.unsqueeze(dim=-1).permute(2, 0, 1)
29
30def get_expon_lr_func(
31 lr_init, lr_final, lr_delay_steps=0, lr_delay_mult=1.0, max_steps=1000000

Callers 2

loadCamFunction · 0.90
__getitem__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected