Skip to content

Commit 1f865c6

Browse files
train_test_split path overwriting bug fix
1 parent e6de062 commit 1f865c6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

topaz/utils/data/train_test_split_micrographs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,23 @@ def train_test_split_micrographs(seed, n, path, format, image_dir, file_ext):
5050

5151
paths_train = []
5252
for image_name in image_names_train:
53-
path = get_image_path(image_name, root, ext)
54-
if path is not None:
55-
paths_train.append(path)
53+
image_path = get_image_path(image_name, root, ext)
54+
if image_path is not None:
55+
paths_train.append(image_path)
5656

5757
paths_test = []
5858
for image_name in image_names_test:
59-
path = get_image_path(image_name, root, ext)
60-
if path is not None:
61-
paths_test.append(path)
59+
image_path = get_image_path(image_name, root, ext)
60+
if image_path is not None:
61+
paths_test.append(image_path)
6262

6363
image_list_train = pd.DataFrame({'image_name': image_names_train, 'path': paths_train})
6464
image_list_test = pd.DataFrame({'image_name': image_names_test, 'path': paths_test})
6565

6666

6767
## write the files to the same location as the original labels
6868
root = os.path.dirname(path)
69+
root = '.' if root == '' else root
6970
basename = os.path.splitext(path)[0]
7071

7172
## write the split targets table

0 commit comments

Comments
 (0)