MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / __getitem__

Method __getitem__

CV/PWCNet/data/datasets.py:267–286  ·  view source on GitHub ↗
(self, index)

Source from the content-addressed store, hash-verified

265 args.inference_size = self.render_size
266
267 def __getitem__(self, index):
268 index = index % self.size
269
270 img1 = frame_utils.read_gen(self.image_list[index][0])
271 img2 = frame_utils.read_gen(self.image_list[index][1])
272
273 flow = frame_utils.read_gen(self.flow_list[index])
274
275 images = [img1, img2]
276 image_size = img1.shape[:2]
277 if self.is_cropped:
278 cropper = StaticRandomCrop(image_size, self.crop_size)
279 else:
280 cropper = StaticCenterCrop(image_size, self.render_size)
281 images = list(map(cropper, images))
282 flow = cropper(flow)
283
284 images = np.array(images).transpose(3, 0, 1, 2)
285 flow = flow.transpose(2, 0, 1)
286 return [images], [flow]
287
288 def __len__(self):
289 return self.size * self.replicates

Callers

nothing calls this directly

Calls 3

StaticRandomCropClass · 0.85
StaticCenterCropClass · 0.85
transposeMethod · 0.45

Tested by

no test coverage detected