Spaces:
Runtime error
Runtime error
File size: 1,960 Bytes
54660f7 |
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 |
###########################################################################
# 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')
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')
parser.add_argument('--dataset_metadata_path', type=str, help='Location of the metadata associated with the created dataset: label mapping, splits and so on')
# 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
|