MCPcopy Create free account
hub / github.com/DIVE128/DMVSNet / preprocess

Function preprocess

tools.py:90–96  ·  view source on GitHub ↗
(name, img)

Source from the content-addressed store, hash-verified

88 images_dict = tensor2numpy(images_dict)
89
90 def preprocess(name, img):
91 if not (len(img.shape) == 3 or len(img.shape) == 4):
92 raise NotImplementedError("invalid img shape {}:{} in save_images".format(name, img.shape))
93 if len(img.shape) == 3:
94 img = img[:, np.newaxis, :, :]
95 img = torch.from_numpy(img[:1])
96 return vutils.make_grid(img, padding=0, nrow=1, normalize=True, scale_each=True)
97
98 for key, value in images_dict.items():
99 if not isinstance(value, (list, tuple)):

Callers 1

save_imagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected