-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
29 lines (22 loc) · 976 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
from easydict import EasyDict
cfg = EasyDict()
cfg.data_dir = 'data_dir' # Image Folder path which contain train and val folders
cfg.device = '0' # cuda device, i.e. 0 or 0,1,2,3
cfg.image_size = 224 #input image size
cfg.batch_size = 4 # batch size
cfg.epochs = 40 #number of epochs
cfg.learning_rate = 0.001
cfg.momentum = 0.9
cfg.weight_decay = 0
#model configuration
cfg.model = 'resnet50' # model architecture
cfg.pretrained = True # Use pretrained weight
cfg.loss_criterion = 'CrossEntropyLoss' # Loss Function
cfg.optimizer = 'SGD' # optimizer
cfg.lr_scheduler = 'StepLR' # Learning Rate Decay
cfg.steps = 7 # Decay epochs
cfg.gamma = 0.1 # Decay Learning Rate factor
#Early Stopping
cfg.use_early_stopping = True #Use Early stopping
cfg.patience = 8 # how many epochs to wait before stopping when accuracy is not improving
cfg.min_delta = 0.0001 # minimum difference between new accuracy and old accuracy for new accuracy to be considered as an improvement