Output the path of files in the folder with specific suffix
(folder, suffix)
| 4 | from torch.utils.data import Dataset |
| 5 | |
| 6 | def listdir(folder, suffix): |
| 7 | """ Output the path of files in the folder with specific suffix""" |
| 8 | list_path = [] |
| 9 | for root, _, files in os.walk(folder, followlinks=True): |
| 10 | for f in files: |
| 11 | if f.endswith(suffix): |
| 12 | list_path.append(osp.join(root, f)) |
| 13 | return list_path |
| 14 | |
| 15 | class DatasetGivenLabels(Dataset): |
| 16 | """ A self-defined dataset with updated input labels""" |