MCPcopy Create free account
hub / github.com/DSL-Lab/StreamSplat / PrepareForNet

Class PrepareForNet

datasets/transform_utils.py:139–158  ·  view source on GitHub ↗

Prepare sample for usage as network input.

Source from the content-addressed store, hash-verified

137
138
139class PrepareForNet(object):
140 """Prepare sample for usage as network input.
141 """
142
143 def __init__(self):
144 pass
145
146 def __call__(self, sample):
147 image = np.transpose(sample["image"], (2, 0, 1))
148 sample["image"] = np.ascontiguousarray(image).astype(np.float32)
149
150 if "depth" in sample:
151 depth = sample["depth"].astype(np.float32)
152 sample["depth"] = np.ascontiguousarray(depth)
153
154 if "mask" in sample:
155 sample["mask"] = sample["mask"].astype(np.float32)
156 sample["mask"] = np.ascontiguousarray(sample["mask"])
157
158 return sample

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected