| @@ 73-85 (lines=13) @@ | ||
| 70 | os.mkdir(os.path.join(path_to_train, "moving_labels")) |
|
| 71 | ||
| 72 | ||
| 73 | def move_files_into_correct_path( |
|
| 74 | fnames, path_to_images_and_labels, new_path, suffix, sub_folder_name |
|
| 75 | ): |
|
| 76 | os.chdir(os.path.join(path_to_images_and_labels, sub_folder_name)) |
|
| 77 | for file in fnames: |
|
| 78 | if "insp" in file: |
|
| 79 | source = file |
|
| 80 | destination = os.path.join(path_to_train, "fixed_" + suffix) |
|
| 81 | shutil.move(source, destination) |
|
| 82 | if "exp" in file: |
|
| 83 | source = file |
|
| 84 | destination = os.path.join(path_to_train, "moving_" + suffix) |
|
| 85 | shutil.move(source, destination) |
|
| 86 | ||
| 87 | ||
| 88 | if os.path.exists(path_to_images_and_labels): |
|
| @@ 69-81 (lines=13) @@ | ||
| 66 | os.mkdir(os.path.join(path_to_train, "moving_labels")) |
|
| 67 | ||
| 68 | ||
| 69 | def move_files_into_correct_path( |
|
| 70 | fnames, path_to_images_and_labels, new_path, suffix, sub_folder_name |
|
| 71 | ): |
|
| 72 | os.chdir(os.path.join(path_to_images_and_labels, sub_folder_name)) |
|
| 73 | for file in fnames: |
|
| 74 | if "insp" in file: |
|
| 75 | source = file |
|
| 76 | destination = os.path.join(path_to_train, "fixed_" + suffix) |
|
| 77 | shutil.move(source, destination) |
|
| 78 | if "exp" in file: |
|
| 79 | source = file |
|
| 80 | destination = os.path.join(path_to_train, "moving_" + suffix) |
|
| 81 | shutil.move(source, destination) |
|
| 82 | ||
| 83 | ||
| 84 | if os.path.exists(path_to_images_and_labels): |
|