MCPcopy Create free account
hub / github.com/amazon-science/patchcore-inspection / image_transform

Function image_transform

bin/run_patchcore.py:147–157  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

145 ]
146
147 def image_transform(image):
148 in_std = np.array(
149 dataloaders["testing"].dataset.transform_std
150 ).reshape(-1, 1, 1)
151 in_mean = np.array(
152 dataloaders["testing"].dataset.transform_mean
153 ).reshape(-1, 1, 1)
154 image = dataloaders["testing"].dataset.transform_img(image)
155 return np.clip(
156 (image.numpy() * in_std + in_mean) * 255, 0, 255
157 ).astype(np.uint8)
158
159 def mask_transform(mask):
160 return dataloaders["testing"].dataset.transform_mask(mask).numpy()

Callers 1

plot_segmentation_imagesFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected