-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
50 lines (34 loc) · 1.03 KB
/
init.py
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
"""
Script to setup the repository environment
"""
import subprocess
from pathlib import Path
DATASET_REPO_URL = 'https://github.com/PRFina/Rinocitologia-Datasets.git'
DATASET_DIR_NAME = 'Datasets'
CONFIG_FILE_NAME = 'config.ini'
cwd = Path(".")
print("1) Downloading datasets")
subprocess.call(['git','clone', DATASET_REPO_URL, DATASET_DIR_NAME])
print("DONE")
print("2) Creating Data directory structure")
data_dir = Path('data')
if not data_dir.exists():
data_dir.mkdir()
assets_dir = data_dir / 'assets'
if not assets_dir.exists():
assets_dir.mkdir()
top_level = ['cells','input','out']
for dirname in top_level:
(assets_dir / dirname).mkdir()
classes = ['epiteliali','neutrofili','eosinofili','mastcellule','linfociti','mucipare','altro']
out_dir = assets_dir / 'out'
for class_name in classes:
(out_dir / class_name).mkdir()
print("DONE")
print("3) Renaming configuration file")
config_file = Path(CONFIG_FILE_NAME + '.example')
try:
config_file.rename(CONFIG_FILE_NAME)
except:
print('Configuration file not found!')
print("DONE")