forked from vkola-lab/tmi2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
option.py
41 lines (35 loc) · 1.87 KB
/
option.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
###########################################################################
# Created by: YI ZHENG
# Email: [email protected]
# Copyright (c) 2020
###########################################################################
import os
import argparse
import torch
class Options():
def __init__(self):
parser = argparse.ArgumentParser(description='PyTorch Classification')
# model and dataset
parser.add_argument('--n_class', type=int, default=4, help='classification classes')
parser.add_argument('--data_path', type=str, help='path to dataset where images store')
parser.add_argument('--train_set', type=str, help='train')
parser.add_argument('--val_set', type=str, help='validation')
parser.add_argument('--model_path', type=str, help='path to trained model')
parser.add_argument('--log_path', type=str, help='path to log files')
parser.add_argument('--task_name', type=str, help='task name for naming saved model files and log files')
parser.add_argument('--train', action='store_true', default=False, help='train only')
parser.add_argument('--test', action='store_true', default=False, help='test only')
parser.add_argument('--batch_size', type=int, default=6, help='batch size for origin global image (without downsampling)')
parser.add_argument('--log_interval_local', type=int, default=10, help='classification classes')
parser.add_argument('--resume', type=str, default="", help='path for model')
parser.add_argument('--graphcam', action='store_true', default=False, help='GraphCAM')
# the parser
self.parser = parser
def parse(self):
args = self.parser.parse_args()
# default settings for epochs and lr
args.num_epochs = 120
args.lr = 1e-3
if args.test:
args.num_epochs = 1
return args