This repository was archived by the owner on Jun 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest_path.py
More file actions
147 lines (136 loc) · 3.71 KB
/
Copy pathtest_path.py
File metadata and controls
147 lines (136 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
"""Unit test related to data folder organization
"""
import os
from deeposlandia.utils import (
prepare_input_folder,
prepare_preprocessed_folder,
prepare_output_folder,
)
def test_input_folder(datapath_repo):
"""Test the existence of the raw dataset directory when using
̀utils.prepare_input_folder`
"""
datapath = str(datapath_repo)
dataset = "shapes"
prepare_input_folder(datapath, dataset)
assert os.path.isdir(os.path.join(datapath, dataset, "input"))
def test_preprocessed_folder(datapath_repo):
"""Test the creation of the preprocessed data repositories, by checking the
full expected tree, *i.e.* considering training, validation and testing
repositories within an instance-specific folder, and images and labels
repositories wihtin each of these subrepositories
"""
datapath = str(datapath_repo)
dataset = "shapes"
image_size = 64
prepare_preprocessed_folder(datapath, dataset, image_size)
assert os.path.isdir(os.path.join(datapath, dataset, "preprocessed"))
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"training",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"training",
"images",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"training",
"labels",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"validation",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"validation",
"images",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"validation",
"labels",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"testing",
)
)
assert os.path.isdir(
os.path.join(
datapath,
dataset,
"preprocessed",
str(image_size),
"testing",
"images",
)
)
def test_output_folder(datapath_repo):
"""Test the creation of the dataset output repository, by checking the full
expected tree, *i.e.* until the instance-specific checkpoint folder
"""
datapath = str(datapath_repo)
dataset = "shapes"
image_size = 100
model = "feature_detection"
output_folder = prepare_output_folder(datapath, dataset, image_size, model)
assert len(output_folder.keys()) == 6
assert os.path.isdir(
os.path.join(datapath, dataset, "output", model, "checkpoints")
)
assert os.path.isdir(
os.path.join(datapath, dataset, "output", model, "predicted_labels")
)
dataset = "aerial"
prepare_output_folder(datapath, dataset, image_size, model)
assert os.path.isdir(
os.path.join(datapath, dataset, "output", model, "predicted_geometries")
)
assert os.path.isdir(
os.path.join(datapath, dataset, "output", model, "predicted_rasters")
)