(self, index)
| 322 | return self.poses.shape[0] |
| 323 | |
| 324 | def __getitem__(self, index): |
| 325 | # print("index:", index) |
| 326 | img = load_image(self.c_imgs[index]) # chess img.size = (640,480) |
| 327 | pose = self.poses[index] |
| 328 | if self.df != 1.: |
| 329 | img_np = (np.array(img) / 255.).astype(np.float32) |
| 330 | dims = (self.W, self.H) |
| 331 | img_half_res = cv2.resize(img_np, dims, interpolation=cv2.INTER_AREA) # (H, W, 3) |
| 332 | img = img_half_res |
| 333 | |
| 334 | if self.target_transform is not None: |
| 335 | pose = self.target_transform(pose) |
| 336 | |
| 337 | if self.transform is not None: |
| 338 | img = self.transform(img) |
| 339 | |
| 340 | if self.ret_idx: |
| 341 | if self.train and self.fix_idx==False: |
| 342 | return img, pose, index |
| 343 | else: |
| 344 | return img, pose, 0 |
| 345 | |
| 346 | if self.ret_hist: |
| 347 | yuv = rgb_to_yuv(img) |
| 348 | y_img = yuv[0] # extract y channel only |
| 349 | hist = torch.histc(y_img, bins=self.hist_bin, min=0., max=1.) # compute intensity histogram |
| 350 | hist = hist/(hist.sum())*100 # convert to histogram density, in terms of percentage per bin |
| 351 | hist = torch.round(hist) |
| 352 | return img, pose, hist |
| 353 | |
| 354 | return img, pose |
| 355 | |
| 356 | |
| 357 | def main(): |
nothing calls this directly
no test coverage detected