MCPcopy
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / __getitem__

Method __getitem__

dzoedepth/data/ddad.py:92–109  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

90 self.transform = ToTensor(resize_shape)
91
92 def __getitem__(self, idx):
93
94 image_path = self.image_files[idx]
95 depth_path = self.depth_files[idx]
96
97 image = np.asarray(Image.open(image_path), dtype=np.float32) / 255.0
98 depth = np.load(depth_path) # meters
99
100 # depth[depth > 8] = -1
101 depth = depth[..., None]
102
103 sample = dict(image=image, depth=depth)
104 sample = self.transform(sample)
105
106 if idx == 0:
107 print(sample["image"].shape)
108
109 return sample
110
111 def __len__(self):
112 return len(self.image_files)

Callers

nothing calls this directly

Calls 2

loadMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected