-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfigs.py
42 lines (33 loc) · 828 Bytes
/
configs.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
import yaml
from enum import Enum
import os
DEFAULT_TITLE = "SAMLabeler Pro"
DEFAULT_CONFIG_FILE = 'settings/init.yaml'
CONFIG_FILE = 'settings/default.yaml'
REMOTE_CONFIG_FILE = 'settings/remote.yaml'
DEFAULT_EDIT_CONFIG = "cache/last_edit.yaml"
os.makedirs("cache", exist_ok=True)
os.makedirs("settings", exist_ok=True)
def load_config(file):
with open(file, 'rb')as f:
cfg = yaml.load(f.read(), Loader=yaml.FullLoader)
return cfg
def save_config(cfg, file):
s = yaml.dump(cfg)
with open(file, 'w') as f:
f.write(s)
return True
class STATUSMode(Enum):
VIEW = 0
CREATE = 1
EDIT = 2
class DRAWMode(Enum):
POLYGON = 0
SEGMENTANYTHING = 1
class CLICKMode(Enum):
POSITIVE = 0
NEGATIVE = 1
class MAPMode(Enum):
LABEL = 0
SEMANTIC = 1
INSTANCE = 2