| 187 | |
| 188 | class FlyingThings3D(FlowDataset): |
| 189 | def __init__(self, aug_params=None, root='datasets/FlyingThings3D', dstype='frames_cleanpass'): |
| 190 | super(FlyingThings3D, self).__init__(aug_params) |
| 191 | |
| 192 | root = 's3://' |
| 193 | |
| 194 | self.image_list = [] |
| 195 | with open("./flow_dataset/flying_things/flyingthings_"+dstype+"_png.txt") as f: |
| 196 | images = f.readlines() |
| 197 | for img1, img2 in zip(images[0::2], images[1::2]): |
| 198 | self.image_list.append([root+img1.strip(), root+img2.strip()]) |
| 199 | self.flow_list = [] |
| 200 | with open("./flow_dataset/flying_things/flyingthings_"+dstype+"_pfm.txt") as f: |
| 201 | flows = f.readlines() |
| 202 | for flow in flows: |
| 203 | self.flow_list.append(root+flow.strip()) |
| 204 | |
| 205 | # for cam in ['left']: |
| 206 | # for direction in ['into_future', 'into_past']: |
| 207 | # image_dirs = sorted(glob(osp.join(root, dstype, 'TRAIN/*/*'))) |
| 208 | # image_dirs = sorted([osp.join(f, cam) for f in image_dirs]) |
| 209 | |
| 210 | # flow_dirs = sorted(glob(osp.join(root, 'optical_flow/TRAIN/*/*'))) |
| 211 | # flow_dirs = sorted([osp.join(f, direction, cam) for f in flow_dirs]) |
| 212 | |
| 213 | # for idir, fdir in zip(image_dirs, flow_dirs): |
| 214 | # images = sorted(glob(osp.join(idir, '*.png')) ) |
| 215 | # flows = sorted(glob(osp.join(fdir, '*.pfm')) ) |
| 216 | # for i in range(len(flows)-1): |
| 217 | # if direction == 'into_future': |
| 218 | # self.image_list += [ [images[i], images[i+1]] ] |
| 219 | # self.flow_list += [ flows[i] ] |
| 220 | # elif direction == 'into_past': |
| 221 | # self.image_list += [ [images[i+1], images[i]] ] |
| 222 | # self.flow_list += [ flows[i+1] ] |
| 223 | |
| 224 | |
| 225 | class KITTI(FlowDataset): |