| 185 | |
| 186 | |
| 187 | class SequenceDataset(data.Dataset): |
| 188 | def __init__(self, args, split='train'): |
| 189 | root = os.path.join(args.training_data_dir, args.dataset, split) |
| 190 | if not os.path.exists(root): |
| 191 | raise colored('[Error: ]', 'red') + 'file path {:s} is not exist!'.format(root) |
| 192 | |
| 193 | self.images_list = glob(os.path.join(root,'*/*/*/*/*.jpg')) |
| 194 | |
| 195 | def random_select(self): |
| 196 | index = random.randint(0, len(self.images_list)-1) |
| 197 | im_path = self.images_list[index] |
| 198 | im = cv2.imread(im_path, cv2.IMREAD_UNCHANGED) |
| 199 | return im, im_path |
| 200 | |
| 201 | def __getitem__(self, index): |
| 202 | pass |
| 203 | |
| 204 | def __len___(self): |
| 205 | return len(self.images_list) |
| 206 | |
| 207 | class ValidateData(data.Dataset): |
| 208 | def __init__(self, args, split): |