Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/learnopencv
Path: blob/master/Bag-Of-Tricks-For-Image-Classification/utils/args.py
3143 views
1
import argparse
2
3
4
def get_program_level_args():
5
parser = argparse.ArgumentParser(description="Classification Training")
6
7
parser.add_argument(
8
"-j",
9
"--workers",
10
default=4,
11
type=int,
12
metavar="N",
13
help="Number of data loading workers",
14
)
15
16
parser.add_argument(
17
"--use-smoothing",
18
action="store_true",
19
default=False,
20
help="Use label smoothing trick",
21
)
22
23
parser.add_argument(
24
"--smoothing",
25
type=float,
26
default=0.1,
27
help="Coefficient for label smoothing (from 0.0 to 1.0 where 0.0 means no smoothing)",
28
)
29
30
parser.add_argument(
31
"--use-mixup",
32
action="store_true",
33
default=False,
34
help="Use mixup augmentation during training",
35
)
36
37
parser.add_argument(
38
"--mixup-alpha",
39
type=float,
40
default=0.2,
41
help="Alpha value for mixup augmentation",
42
)
43
44
parser.add_argument(
45
"--use-cosine-scheduler",
46
action="store_true",
47
default=False,
48
help="Use Cosine LR Scheduler instead of MultiStep",
49
)
50
51
parser.add_argument(
52
"--use-knowledge-distillation",
53
action="store_true",
54
default=False,
55
help="Use Knowledge Distillation technique",
56
)
57
58
parser.add_argument(
59
"--distill-alpha", type=float, default=0.5, help="Distillation strength",
60
)
61
62
parser.add_argument(
63
"--distill-temperature",
64
type=int,
65
default=20,
66
help="Temperature hyper-parameter to make the outputs smoother for KD",
67
)
68
69
parser.add_argument(
70
"-e",
71
"--evaluate",
72
dest="evaluate",
73
action="store_true",
74
help="Evaluate model on validation set",
75
)
76
77
parser.add_argument(
78
"--checkpoint",
79
type=str,
80
default=None,
81
help="Path to the trained model for evaluation",
82
)
83
84
parser.add_argument(
85
"--seed", type=int, default=0, help="Seed to initialize all random generators",
86
)
87
88
return parser
89
90