| 135 | |
| 136 | |
| 137 | class FlyingThings3D(FlowDataset): |
| 138 | def __init__(self, aug_params=None, root='datasets/FlyingThings3D', dstype='frames_cleanpass', split='training'): |
| 139 | super(FlyingThings3D, self).__init__(aug_params) |
| 140 | |
| 141 | split_dir = 'TRAIN' if split == 'training' else 'TEST' |
| 142 | for cam in ['left']: |
| 143 | for direction in ['into_future', 'into_past']: |
| 144 | image_dirs = sorted(glob(osp.join(root, dstype, f'{split_dir}/*/*'))) |
| 145 | image_dirs = sorted([osp.join(f, cam) for f in image_dirs]) |
| 146 | |
| 147 | flow_dirs = sorted(glob(osp.join(root, f'optical_flow/{split_dir}/*/*'))) |
| 148 | flow_dirs = sorted([osp.join(f, direction, cam) for f in flow_dirs]) |
| 149 | |
| 150 | for idir, fdir in zip(image_dirs, flow_dirs): |
| 151 | images = sorted(glob(osp.join(idir, '*.png')) ) |
| 152 | flows = sorted(glob(osp.join(fdir, '*.pfm')) ) |
| 153 | for i in range(len(flows)-1): |
| 154 | if direction == 'into_future': |
| 155 | self.image_list += [ [images[i], images[i+1]] ] |
| 156 | self.flow_list += [ flows[i] ] |
| 157 | elif direction == 'into_past': |
| 158 | self.image_list += [ [images[i+1], images[i]] ] |
| 159 | self.flow_list += [ flows[i+1] ] |
| 160 | |
| 161 | |
| 162 | class KITTI(FlowDataset): |