@@ -29,13 +29,16 @@ def pipeline_filepath_validator(ctx, param, value):
29
29
),
30
30
]
31
31
32
- shared_options = [
32
+ output_option = [
33
33
click .option (
34
34
'--output' ,
35
35
help = 'Path to output JSON (if unspecified, results are printed to screen)' ,
36
36
default = None ,
37
37
type = str ,
38
38
),
39
+ ]
40
+
41
+ shared_options = [
39
42
click .option (
40
43
'--backend_device' , # torch backend device
41
44
help = 'Specifies the device for inference (see YOLO and PyTorch documentation for more information).' ,
@@ -93,6 +96,7 @@ def _add_options(func):
93
96
)
94
97
@add_options (model_option )
95
98
@add_options (shared_options )
99
+ @add_options (output_option )
96
100
def pipeline (
97
101
filepath ,
98
102
config ,
@@ -183,6 +187,7 @@ def pipeline(
183
187
)
184
188
@add_options (model_option )
185
189
@add_options (shared_options )
190
+ @add_options (output_option )
186
191
def batch (
187
192
filepaths ,
188
193
config ,
@@ -300,6 +305,21 @@ def example():
300
305
scoutbot .example ()
301
306
302
307
308
+ @click .command ('get_classes' )
309
+ @add_options (output_option )
310
+ def get_classes (output ):
311
+ """
312
+ Run a test of the pipeline on an example image with the default configuration.
313
+ """
314
+ classes = scoutbot .get_classes ()
315
+ log .debug ('Outputting classes list...' )
316
+ if output :
317
+ with open (output , 'w' ) as outfile :
318
+ json .dump (classes , outfile )
319
+ else :
320
+ print (ut .repr3 (classes ))
321
+
322
+
303
323
@click .group ()
304
324
def cli ():
305
325
"""
@@ -312,6 +332,8 @@ def cli():
312
332
cli .add_command (batch )
313
333
cli .add_command (fetch )
314
334
cli .add_command (example )
335
+ cli .add_command (get_classes )
336
+
315
337
316
338
if __name__ == '__main__' :
317
339
cli ()
0 commit comments