|
1 |
| -# import glob |
| 1 | +import glob |
2 | 2 | import os.path
|
3 | 3 | # import argparse
|
4 | 4 | import warnings
|
|
44 | 44 | # return parser.parse_args()
|
45 | 45 |
|
46 | 46 |
|
47 |
| -# def get_files(path, format, postfix): |
48 |
| -# pattern = '*%s.%s' % (postfix, format) |
| 47 | +def get_files(dataset_root, format, postfix, image_folder_path): |
| 48 | + dataset_root = "/".join(image_folder_path.split("/")[:-2]) |
| 49 | + pattern = '*%s.%s' % (postfix, format) |
49 | 50 |
|
50 |
| -# search_files = os.path.join(path, pattern) |
51 |
| -# search_files2 = os.path.join(path, "*", pattern) # Include subdirectories |
52 |
| -# search_files3 = os.path.join(path, "*", "*", pattern) # Contains three levels of directories |
| 51 | + search_files = os.path.join(dataset_root, pattern) |
| 52 | + search_files2 = os.path.join(dataset_root, "*", pattern) # Include subdirectories |
| 53 | + search_files3 = os.path.join(dataset_root, "*", "*", pattern) # Contains three levels of directories |
53 | 54 |
|
54 |
| -# filenames = glob.glob(search_files) |
55 |
| -# filenames2 = glob.glob(search_files2) |
56 |
| -# filenames3 = glob.glob(search_files3) |
| 55 | + filenames = glob.glob(search_files) |
| 56 | + filenames2 = glob.glob(search_files2) |
| 57 | + filenames3 = glob.glob(search_files3) |
57 | 58 |
|
58 |
| -# filenames = filenames + filenames2 + filenames3 |
| 59 | + filenames = filenames + filenames2 + filenames3 |
59 | 60 |
|
60 |
| -# return sorted(filenames) |
| 61 | + return sorted(filenames) |
61 | 62 |
|
62 | 63 |
|
63 |
| -def pp_generate_list(args): |
| 64 | +def pp_generate_list(args, image_folder_path, label_folder_path, Training_Set, Val_Set, Testing_Set): |
64 | 65 | separator = "args.separator"
|
65 |
| - dataset_root = "/".join(rasdir.split("/")[:-2]) |
66 |
| - if sum(args.split) != 1.0: |
| 66 | + dataset_root = "/".join(image_folder_path.split("/")[:-2]) |
| 67 | + all_sum_sets = Training_Set+Val_Set+Testing_Set |
| 68 | + if all_sum_sets != 1.0: |
67 | 69 | raise ValueError("The sum of the division ratios must be 1")
|
68 | 70 |
|
69 | 71 | file_list = os.path.join(dataset_root, 'labels.txt')
|
|
0 commit comments