-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (31 loc) · 981 Bytes
/
config.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
import json
class Config:
def __init__(self):
self.imageShape=(1228,1228,3)
self.inputShape=(256,256,3)
self.pretrainedModel=None
self.classes=3
self.model="PathoNet"
self.logPath="logs/"
self.data_path=""
self.loss="mse"
self.optimizer="adam"
self.lr=1e-2
self.batchSize=16
self.epoches=30
self.validationSplit=0.2
self.trainDataPath=""
self.thresholds=[120,180,40]
self.guaMaxValue=255
self.minDistance =5
def load(self,configPath):
with open(configPath,'r') as f:
confDict = json.load(f)
self.__dict__.update(confDict)
def update_thresold_1(self, thr1):
self.thresholds[1] = thr1
def update_thresold_0(self, thr0):
self.thresholds[0] = thr0
def save(self,configPath):
with open(configPath, 'w') as f:
json.dump(self.__dict__, f)