| 291 | return self.wrapped_data[index] |
| 292 | |
| 293 | def detect_new_datasets(args): |
| 294 | if args.new_dataset_path is None: |
| 295 | return None |
| 296 | if not os.path.exists(args.new_dataset_path): |
| 297 | print('Warning: new_dataset_path not exists... skip detection.') |
| 298 | return None |
| 299 | current_datasets = [str(os.path.abspath(path)) for path in args.train_data] |
| 300 | |
| 301 | found = [] |
| 302 | for _p in os.listdir(args.new_dataset_path): |
| 303 | p = os.path.join(args.new_dataset_path, _p) |
| 304 | if (str(p).endswith('lmdb') or str(p).endswith('bin')) and not str(os.path.abspath(p)) in current_datasets: |
| 305 | found.append(p) |
| 306 | if len(found) == 0: |
| 307 | return None |
| 308 | else: |
| 309 | args.train_data = args.train_data + found |
| 310 | return make_loaders(args) |