@@ -136,30 +136,35 @@ def main():
136
136
137
137
dataset_type = cfg .data .test .type
138
138
if output_config .get ('out' , None ):
139
- out = output_config ['out' ]
140
- # make sure the dirname of the output path exists
141
- mmcv .mkdir_or_exist (osp .dirname (out ))
142
- _ , suffix = osp .splitext (out )
143
- if dataset_type == 'AVADataset' :
144
- assert suffix [1 :] == 'csv' , ('For AVADataset, the format of the '
145
- 'output file should be csv' )
139
+ if 'output_format' in output_config :
140
+ # ugly workround to make recognition and localization the same
141
+ warnings .warn (
142
+ 'Skip checking `output_format` in localization task.' )
146
143
else :
147
- assert suffix [1 :] in file_handlers , (
148
- 'The format of the output '
149
- 'file should be json, pickle or yaml' )
144
+ out = output_config ['out' ]
145
+ # make sure the dirname of the output path exists
146
+ mmcv .mkdir_or_exist (osp .dirname (out ))
147
+ _ , suffix = osp .splitext (out )
148
+ if dataset_type == 'AVADataset' :
149
+ assert suffix [1 :] == 'csv' , ('For AVADataset, the format of '
150
+ 'the output file should be csv' )
151
+ else :
152
+ assert suffix [1 :] in file_handlers , (
153
+ 'The format of the output '
154
+ 'file should be json, pickle or yaml' )
150
155
151
156
# set cudnn benchmark
152
157
if cfg .get ('cudnn_benchmark' , False ):
153
158
torch .backends .cudnn .benchmark = True
154
159
cfg .data .test .test_mode = True
155
160
156
- if cfg .model .get ('test_cfg' ) is None and cfg .get ('test_cfg' ) is None :
157
- cfg .model .setdefault ('test_cfg' ,
158
- dict (average_clips = args .average_clips ))
159
- else :
161
+ if args .average_clips is not None :
160
162
# You can set average_clips during testing, it will override the
161
- # original settting
162
- if args .average_clips is not None :
163
+ # original setting
164
+ if cfg .model .get ('test_cfg' ) is None and cfg .get ('test_cfg' ) is None :
165
+ cfg .model .setdefault ('test_cfg' ,
166
+ dict (average_clips = args .average_clips ))
167
+ else :
163
168
if cfg .model .get ('test_cfg' ) is not None :
164
169
cfg .model .test_cfg .average_clips = args .average_clips
165
170
else :
0 commit comments