Skip to content

Commit ee7610e

Browse files
authored
Enable deit_tiny template by default (#2282)
* disable dump_features for ViT backbones * rename deit-tiny template name * update test names
1 parent e7e5ac6 commit ee7610e

File tree

5 files changed

+42
-37
lines changed

5 files changed

+42
-37
lines changed

src/otx/algorithms/classification/adapters/mmcls/task.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ def _export_model(self, precision: ModelPrecision, export_format: ExportType, du
562562
export_options["precision"] = str(precision)
563563
export_options["type"] = str(export_format)
564564

565+
# [TODO] Enable dump_features for ViT backbones
566+
model_type = cfg.model.backbone.type.split(".")[-1] # mmcls.VisionTransformer => VisionTransformer
567+
if model_type in TRANSFORMER_BACKBONES:
568+
dump_features = False
569+
565570
export_options["deploy_cfg"]["dump_features"] = dump_features
566571
if dump_features:
567572
output_names = export_options["deploy_cfg"]["ir_config"]["output_names"]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Description.
2-
model_template_id: Custom_Image_Classification_deit-tiny
3-
name: deit-tiny
2+
model_template_id: Custom_Image_Classification_DeiT-Tiny
3+
name: DeiT-Tiny
44
task_type: CLASSIFICATION
55
task_family: VISION
66
instantiation: "CLASS"
7-
summary: Custom Image Classification for deit-tiny
7+
summary: Custom Image Classification for DeiT-Tiny
88
application: ~
99

1010
# Algo backend.

tests/e2e/cli/classification/test_classification.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class TestToolsMultiClassClassification:
101101
@e2e_pytest_component
102102
@pytest.mark.parametrize("template", templates, ids=templates_ids)
103103
def test_otx_train_supcon(self, template, tmp_dir_path):
104-
if template.name == "deit-tiny":
104+
if template.name == "DeiT-Tiny":
105105
pytest.skip(reason="Supcon for ViT template is not supported yet.")
106106
tmp_dir_path = tmp_dir_path / "multi_class_cls/test_supcon"
107107
args1 = copy.deepcopy(args)
@@ -137,7 +137,7 @@ def test_otx_resume(self, template, tmp_dir_path):
137137
@pytest.mark.parametrize("template", templates, ids=templates_ids)
138138
@pytest.mark.parametrize("dump_features", [True, False])
139139
def test_otx_export(self, template, tmp_dir_path, dump_features):
140-
if template.name == "deit-tiny" and dump_features:
140+
if template.name == "DeiT-Tiny" and dump_features:
141141
pytest.skip(reason="Issue#2098 ViT template does not support dump_features.")
142142
tmp_dir_path = tmp_dir_path / "multi_class_cls"
143143
otx_export_testing(template, tmp_dir_path, dump_features)
@@ -160,7 +160,7 @@ def test_otx_eval(self, template, tmp_dir_path):
160160
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
161161
@pytest.mark.parametrize("template", templates, ids=templates_ids)
162162
def test_otx_explain(self, template, tmp_dir_path):
163-
if template.name == "deit-tiny":
163+
if template.name == "DeiT-Tiny":
164164
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
165165
tmp_dir_path = tmp_dir_path / "multi_class_cls"
166166
otx_explain_testing(template, tmp_dir_path, otx_dir, args)
@@ -169,7 +169,7 @@ def test_otx_explain(self, template, tmp_dir_path):
169169
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
170170
@pytest.mark.parametrize("template", templates, ids=templates_ids)
171171
def test_otx_explain_openvino(self, template, tmp_dir_path):
172-
if template.name == "deit-tiny":
172+
if template.name == "DeiT-Tiny":
173173
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
174174
tmp_dir_path = tmp_dir_path / "multi_class_cls"
175175
otx_explain_openvino_testing(template, tmp_dir_path, otx_dir, args)
@@ -285,7 +285,7 @@ def test_pot_optimize(self, template, tmp_dir_path):
285285
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
286286
@pytest.mark.parametrize("template", templates, ids=templates_ids)
287287
def test_pot_validate_fq(self, template, tmp_dir_path):
288-
if template.name == "deit-tiny":
288+
if template.name == "DeiT-Tiny":
289289
pytest.skip(reason="Fake quantization for DeiT template is not supported yet.")
290290
tmp_dir_path = tmp_dir_path / "multi_class_cls"
291291
pot_validate_fq_testing(template, tmp_dir_path, otx_dir, "classification", type(self).__name__)
@@ -398,7 +398,7 @@ def test_otx_resume(self, template, tmp_dir_path):
398398
@pytest.mark.parametrize("template", templates, ids=templates_ids)
399399
@pytest.mark.parametrize("dump_features", [True, False])
400400
def test_otx_export(self, template, tmp_dir_path, dump_features):
401-
if template.name == "deit-tiny" and dump_features:
401+
if template.name == "DeiT-Tiny" and dump_features:
402402
pytest.skip(reason="Issue#2098 ViT template does not support dump_features.")
403403
tmp_dir_path = tmp_dir_path / "multi_label_cls"
404404
otx_export_testing(template, tmp_dir_path, dump_features)
@@ -414,7 +414,7 @@ def test_otx_eval(self, template, tmp_dir_path):
414414
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
415415
@pytest.mark.parametrize("template", templates, ids=templates_ids)
416416
def test_otx_explain(self, template, tmp_dir_path):
417-
if template.name == "deit-tiny":
417+
if template.name == "DeiT-Tiny":
418418
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
419419
tmp_dir_path = tmp_dir_path / "multi_label_cls"
420420
otx_explain_testing(template, tmp_dir_path, otx_dir, args_m)
@@ -508,7 +508,7 @@ def test_pot_optimize(self, template, tmp_dir_path):
508508
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
509509
@pytest.mark.parametrize("template", templates, ids=templates_ids)
510510
def test_pot_validate_fq(self, template, tmp_dir_path):
511-
if template.name == "deit-tiny":
511+
if template.name == "DeiT-Tiny":
512512
pytest.skip(reason="Fake quantization for DeiT template is not supported yet.")
513513
tmp_dir_path = tmp_dir_path / "multi_label_cls"
514514
pot_validate_fq_testing(template, tmp_dir_path, otx_dir, "classification", type(self).__name__)
@@ -576,7 +576,7 @@ def test_otx_resume(self, template, tmp_dir_path):
576576
@pytest.mark.parametrize("template", templates, ids=templates_ids)
577577
@pytest.mark.parametrize("dump_features", [True, False])
578578
def test_otx_export(self, template, tmp_dir_path, dump_features):
579-
if template.name == "deit-tiny" and dump_features:
579+
if template.name == "DeiT-Tiny" and dump_features:
580580
pytest.skip(reason="Issue#2098 ViT template does not support dump_features.")
581581
tmp_dir_path = tmp_dir_path / "h_label_cls"
582582
otx_export_testing(template, tmp_dir_path, dump_features)
@@ -592,7 +592,7 @@ def test_otx_eval(self, template, tmp_dir_path):
592592
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
593593
@pytest.mark.parametrize("template", templates, ids=templates_ids)
594594
def test_otx_explain(self, template, tmp_dir_path):
595-
if template.name == "deit-tiny":
595+
if template.name == "DeiT-Tiny":
596596
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
597597
tmp_dir_path = tmp_dir_path / "h_label_cls"
598598
otx_explain_testing(template, tmp_dir_path, otx_dir, args_h)
@@ -693,7 +693,7 @@ def test_pot_eval(self, template, tmp_dir_path):
693693
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
694694
@pytest.mark.parametrize("template", templates, ids=templates_ids)
695695
def test_pot_validate_fq(self, template, tmp_dir_path):
696-
if template.name == "deit-tiny":
696+
if template.name == "DeiT-Tiny":
697697
pytest.skip(reason="Fake quantization for DeiT template is not supported yet.")
698698
tmp_dir_path = tmp_dir_path / "h_label_cls"
699699
pot_validate_fq_testing(template, tmp_dir_path, otx_dir, "classification", type(self).__name__)
@@ -729,7 +729,7 @@ class TestToolsSelfSLClassification:
729729
@e2e_pytest_component
730730
@pytest.mark.parametrize("template", templates, ids=templates_ids)
731731
def test_otx_selfsl_train(self, template, tmp_dir_path):
732-
if template.name == "deit-tiny":
732+
if template.name == "DeiT-Tiny":
733733
pytest.skip(reason="Self-SL for ViT template is not supported yet.")
734734
tmp_dir_path_1 = tmp_dir_path / "multi_class_cls/test_selfsl"
735735
otx_train_testing(template, tmp_dir_path_1, otx_dir, args_selfsl)
@@ -744,7 +744,7 @@ def test_otx_selfsl_train(self, template, tmp_dir_path):
744744
@pytest.mark.skipif(TT_STABILITY_TESTS, reason="This is TT_STABILITY_TESTS")
745745
@pytest.mark.parametrize("template", templates, ids=templates_ids)
746746
def test_otx_selfsl_eval(self, template, tmp_dir_path):
747-
if template.name == "deit-tiny":
747+
if template.name == "DeiT-Tiny":
748748
pytest.skip(reason="Self-SL for ViT template is not supported yet.")
749749
tmp_dir_path = tmp_dir_path / "multi_class_cls/test_selfsl_sl"
750750
otx_eval_testing(template, tmp_dir_path, otx_dir, args)
@@ -754,7 +754,7 @@ def test_otx_selfsl_eval(self, template, tmp_dir_path):
754754
@pytest.mark.skipif(MULTI_GPU_UNAVAILABLE, reason="The number of gpu is insufficient")
755755
@pytest.mark.parametrize("template", templates, ids=templates_ids)
756756
def test_otx_multi_gpu_train_selfsl(self, template, tmp_dir_path):
757-
if template.name == "deit-tiny":
757+
if template.name == "DeiT-Tiny":
758758
pytest.skip(reason="Self-SL for ViT template is not supported yet.")
759759
tmp_dir_path = tmp_dir_path / "multi_class_cls/test_multi_gpu_selfsl"
760760
args_selfsl_multigpu = copy.deepcopy(args_selfsl)

tests/integration/cli/classification/test_classification.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_otx_resume(self, template, tmp_dir_path):
114114
@pytest.mark.parametrize("template", templates, ids=templates_ids)
115115
@pytest.mark.parametrize("dump_features", [True, False])
116116
def test_otx_export(self, template, tmp_dir_path, dump_features):
117-
if template.name == "deit-tiny" and dump_features:
117+
if template.name == "DeiT-Tiny" and dump_features:
118118
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
119119
tmp_dir_path = tmp_dir_path / "multi_class_cls"
120120
otx_export_testing(template, tmp_dir_path, dump_features, check_ir_meta=True)
@@ -140,47 +140,47 @@ def test_otx_eval(self, template, tmp_dir_path):
140140
@e2e_pytest_component
141141
@pytest.mark.parametrize("template", templates, ids=templates_ids)
142142
def test_otx_explain(self, template, tmp_dir_path):
143-
if template.name == "deit-tiny":
143+
if template.name == "DeiT-Tiny":
144144
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
145145
tmp_dir_path = tmp_dir_path / "multi_class_cls"
146146
otx_explain_testing(template, tmp_dir_path, otx_dir, args)
147147

148148
@e2e_pytest_component
149149
@pytest.mark.parametrize("template", templates, ids=templates_ids)
150150
def test_otx_explain_all_classes(self, template, tmp_dir_path):
151-
if template.name == "deit-tiny":
151+
if template.name == "DeiT-Tiny":
152152
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
153153
tmp_dir_path = tmp_dir_path / "multi_class_cls"
154154
otx_explain_testing_all_classes(template, tmp_dir_path, otx_dir, args)
155155

156156
@e2e_pytest_component
157157
@pytest.mark.parametrize("template", templates, ids=templates_ids)
158158
def test_otx_explain_process_saliency_maps(self, template, tmp_dir_path):
159-
if template.name == "deit-tiny":
159+
if template.name == "DeiT-Tiny":
160160
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
161161
tmp_dir_path = tmp_dir_path / "multi_class_cls"
162162
otx_explain_testing_process_saliency_maps(template, tmp_dir_path, otx_dir, args)
163163

164164
@e2e_pytest_component
165165
@pytest.mark.parametrize("template", templates, ids=templates_ids)
166166
def test_otx_explain_openvino(self, template, tmp_dir_path):
167-
if template.name == "deit-tiny":
167+
if template.name == "DeiT-Tiny":
168168
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
169169
tmp_dir_path = tmp_dir_path / "multi_class_cls"
170170
otx_explain_openvino_testing(template, tmp_dir_path, otx_dir, args)
171171

172172
@e2e_pytest_component
173173
@pytest.mark.parametrize("template", templates, ids=templates_ids)
174174
def test_otx_explain_all_classes_openvino(self, template, tmp_dir_path):
175-
if template.name == "deit-tiny":
175+
if template.name == "DeiT-Tiny":
176176
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
177177
tmp_dir_path = tmp_dir_path / "multi_class_cls"
178178
otx_explain_all_classes_openvino_testing(template, tmp_dir_path, otx_dir, args)
179179

180180
@e2e_pytest_component
181181
@pytest.mark.parametrize("template", templates, ids=templates_ids)
182182
def test_otx_explain_process_saliency_maps_openvino(self, template, tmp_dir_path):
183-
if template.name == "deit-tiny":
183+
if template.name == "DeiT-Tiny":
184184
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
185185
tmp_dir_path = tmp_dir_path / "multi_class_cls"
186186
otx_explain_process_saliency_maps_openvino_testing(template, tmp_dir_path, otx_dir, args)
@@ -346,47 +346,47 @@ def test_otx_eval(self, template, tmp_dir_path):
346346
@e2e_pytest_component
347347
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
348348
def test_otx_explain(self, template, tmp_dir_path):
349-
if template.name == "deit-tiny":
349+
if template.name == "DeiT-Tiny":
350350
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
351351
tmp_dir_path = tmp_dir_path / "multi_label_cls"
352352
otx_explain_testing(template, tmp_dir_path, otx_dir, args_m)
353353

354354
@e2e_pytest_component
355355
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
356356
def test_otx_explain_all_classes(self, template, tmp_dir_path):
357-
if template.name == "deit-tiny":
357+
if template.name == "DeiT-Tiny":
358358
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
359359
tmp_dir_path = tmp_dir_path / "multi_label_cls"
360360
otx_explain_testing_all_classes(template, tmp_dir_path, otx_dir, args_m)
361361

362362
@e2e_pytest_component
363363
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
364364
def test_otx_explain_process_saliency_maps(self, template, tmp_dir_path):
365-
if template.name == "deit-tiny":
365+
if template.name == "DeiT-Tiny":
366366
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
367367
tmp_dir_path = tmp_dir_path / "multi_label_cls"
368368
otx_explain_testing_process_saliency_maps(template, tmp_dir_path, otx_dir, args_m)
369369

370370
@e2e_pytest_component
371371
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
372372
def test_otx_explain_openvino(self, template, tmp_dir_path):
373-
if template.name == "deit-tiny":
373+
if template.name == "DeiT-Tiny":
374374
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
375375
tmp_dir_path = tmp_dir_path / "multi_label_cls"
376376
otx_explain_openvino_testing(template, tmp_dir_path, otx_dir, args_m)
377377

378378
@e2e_pytest_component
379379
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
380380
def test_otx_explain_all_classes_openvino(self, template, tmp_dir_path):
381-
if template.name == "deit-tiny":
381+
if template.name == "DeiT-Tiny":
382382
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
383383
tmp_dir_path = tmp_dir_path / "multi_label_cls"
384384
otx_explain_all_classes_openvino_testing(template, tmp_dir_path, otx_dir, args_m)
385385

386386
@e2e_pytest_component
387387
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
388388
def test_otx_explain_process_saliency_maps_openvino(self, template, tmp_dir_path):
389-
if template.name == "deit-tiny":
389+
if template.name == "DeiT-Tiny":
390390
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
391391
tmp_dir_path = tmp_dir_path / "multi_label_cls"
392392
otx_explain_process_saliency_maps_openvino_testing(template, tmp_dir_path, otx_dir, args_m)
@@ -474,47 +474,47 @@ def test_otx_eval(self, template, tmp_dir_path):
474474
@e2e_pytest_component
475475
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
476476
def test_otx_explain(self, template, tmp_dir_path):
477-
if template.name == "deit-tiny":
477+
if template.name == "DeiT-Tiny":
478478
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
479479
tmp_dir_path = tmp_dir_path / "h_label_cls"
480480
otx_explain_testing(template, tmp_dir_path, otx_dir, args_h)
481481

482482
@e2e_pytest_component
483483
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
484484
def test_otx_explain_all_classes(self, template, tmp_dir_path):
485-
if template.name == "deit-tiny":
485+
if template.name == "DeiT-Tiny":
486486
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
487487
tmp_dir_path = tmp_dir_path / "h_label_cls"
488488
otx_explain_testing_all_classes(template, tmp_dir_path, otx_dir, args_h)
489489

490490
@e2e_pytest_component
491491
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
492492
def test_otx_explain_process_saliency_maps(self, template, tmp_dir_path):
493-
if template.name == "deit-tiny":
493+
if template.name == "DeiT-Tiny":
494494
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
495495
tmp_dir_path = tmp_dir_path / "h_label_cls"
496496
otx_explain_testing_process_saliency_maps(template, tmp_dir_path, otx_dir, args_h)
497497

498498
@e2e_pytest_component
499499
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
500500
def test_otx_explain_openvino(self, template, tmp_dir_path):
501-
if template.name == "deit-tiny":
501+
if template.name == "DeiT-Tiny":
502502
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
503503
tmp_dir_path = tmp_dir_path / "h_label_cls"
504504
otx_explain_openvino_testing(template, tmp_dir_path, otx_dir, args_h)
505505

506506
@e2e_pytest_component
507507
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
508508
def test_otx_explain_all_classes_openvino(self, template, tmp_dir_path):
509-
if template.name == "deit-tiny":
509+
if template.name == "DeiT-Tiny":
510510
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
511511
tmp_dir_path = tmp_dir_path / "h_label_cls"
512512
otx_explain_all_classes_openvino_testing(template, tmp_dir_path, otx_dir, args_h)
513513

514514
@e2e_pytest_component
515515
@pytest.mark.parametrize("template", default_templates, ids=default_templates_ids)
516516
def test_otx_explain_process_saliency_maps_openvino(self, template, tmp_dir_path):
517-
if template.name == "deit-tiny":
517+
if template.name == "DeiT-Tiny":
518518
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
519519
tmp_dir_path = tmp_dir_path / "h_label_cls"
520520
otx_explain_process_saliency_maps_openvino_testing(template, tmp_dir_path, otx_dir, args_h)

tests/unit/algorithms/classification/test_xai_classification_validity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TestExplainMethods:
3131
@e2e_pytest_unit
3232
@pytest.mark.parametrize("template", templates_cls, ids=templates_cls_ids)
3333
def test_saliency_map_cls(self, template):
34-
if template.name == "deit-tiny":
34+
if template.name == "DeiT-Tiny":
3535
pytest.skip(reason="Issue#2098 ViT inference does not work by FeatureVectorHook.")
3636
torch.manual_seed(0)
3737
base_dir = os.path.abspath(os.path.dirname(template.model_template_path))

0 commit comments

Comments
 (0)