-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathopts.py
132 lines (125 loc) · 4.11 KB
/
opts.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import argparse
def parse_opts():
parser = argparse.ArgumentParser()
arguments = {
'coefficients': [
dict(name='--lambda_0',
default='0.5',
type=float,
help='Penalty Coefficient that Controls the Penalty Extent in PCCE'),
],
'paths': [
dict(name='--resnet101_pretrained',
default='resnet-101-kinetics.pth',
type=str,
help='Global path of pretrained 3d resnet101 model (.pth)'),
dict(name='--root_path',
default="D:/research/大创/project/emotion/多模态情感识别/Emotion_rec",#这个需要改成您那边的root路径
type=str,
help='Global path of root directory'),
dict(name="--video_path",
default="myresult-jpg",
type=str,
help='Local path of videos', ),
dict(name="--annotation_path",
default='tools/annotations/ve8/ve8_01.json',
type=str,
help='Local path of annotation file'),
dict(name="--result_path",
default='results',
type=str,
help="Local path of result directory"),
dict(name='--expr_name',
type=str,
default=''),
dict(name='--audio_path',
type=str,
default='myresult-mp3',
help='Local path of audios')
],
'core': [
dict(name='--batch_size',
default=1,
type=int,
help='Batch Size'),
dict(name='--snippet_duration',
default=16,
type=int),
dict(name='--sample_size',
default=112,
type=int,
help='Heights and width of inputs'),
dict(name='--n_classes',
default=8,
type=int,
help='Number of classes'),
dict(name='--seq_len',
default=12,
type=int),
dict(name='--loss_func',
default='pcce_ve8',
type=str,
help='ce | pcce_ve8'),
dict(name='--learning_rate',
default=2e-4,
type=float,
help='Initial learning rate', ),
dict(name='--weight_decay',
default=0.0,
type=float,
help='Weight Decay'),
dict(name='--fps',
default=30,
type=int,
help='fps')
],
'network': [
{
'name': '--audio_embed_size',
'default': 256,
'type': int,
},
{
'name': '--audio_n_segments',
'default': 16,
'type': int,
}
],
'common': [
dict(name='--dataset',
type=str,
default='ve8',
),
dict(name='--use_cuda',
action='store_true',
default=False,
help='only cuda supported!'
),
dict(name='--debug',
default=False,
action='store_true'),
dict(name='--dl',
action='store_true',
default=False,
help='drop last'),
dict(
name='--n_threads',
default=0,
type=int,
help='Number of threads for multi-thread loading',
),
dict(
name='--n_epochs',
default=100,
type=int,
help='Number of total epochs to run',
)
]
}
for group in arguments.values():
for argument in group:
name = argument['name']
del argument['name']
parser.add_argument(name, **argument)
args = parser.parse_args()
return args