Prepare sample for usage as network input.
| 137 | |
| 138 | |
| 139 | class 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 |
nothing calls this directly
no outgoing calls
no test coverage detected