Hannes Kuchelmeister
commited on
Commit
•
8e134e8
1
Parent(s):
10073d6
fix path for image loading being wrong
Browse files
annotation-preprocessing/1_splitting_into_patches.py
CHANGED
@@ -65,13 +65,14 @@ def save_tile(original_file_path, out_dir, x : int, y : int, img, overwrite = Fa
|
|
65 |
path, file_name = os.path.split(original_file_path)
|
66 |
name, ext = os.path.splitext(file_name)
|
67 |
|
68 |
-
|
|
|
69 |
|
70 |
-
if not os.path.exists(
|
71 |
-
os.makedirs(
|
72 |
if overwrite or not os.path.exists(save_to):
|
73 |
img.save(save_to)
|
74 |
-
return
|
75 |
|
76 |
def compute_overlap(rect1, rect2):
|
77 |
dx = min(rect1[2], rect2[2]) - max(rect1[0], rect2[0])
|
|
|
65 |
path, file_name = os.path.split(original_file_path)
|
66 |
name, ext = os.path.splitext(file_name)
|
67 |
|
68 |
+
out_path = os.path.join(out_dir, path)
|
69 |
+
save_to = os.path.join(out_path, f'{name}_{x}_{y}{ext}')
|
70 |
|
71 |
+
if not os.path.exists(out_path):
|
72 |
+
os.makedirs(out_path)
|
73 |
if overwrite or not os.path.exists(save_to):
|
74 |
img.save(save_to)
|
75 |
+
return os.path.join(path, f'{name}_{x}_{y}{ext}')
|
76 |
|
77 |
def compute_overlap(rect1, rect2):
|
78 |
dx = min(rect1[2], rect2[2]) - max(rect1[0], rect2[0])
|