diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7c2d1e0d7..d3b97fd7aa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - Add a new feature to configure input size() - Introduce the OTXSampler and AdaptiveRepeatDataHook to achieve faster training at the small data regime () - Add a new object detector Lite-DINO() +- Official supports for YOLOX-X, YOLOX-L, YOLOX-S, ResNeXt101-ATSS () ### Enhancements diff --git a/docs/source/guide/explanation/algorithms/object_detection/object_detection.rst b/docs/source/guide/explanation/algorithms/object_detection/object_detection.rst index e629d390d9e..df3331e3510 100644 --- a/docs/source/guide/explanation/algorithms/object_detection/object_detection.rst +++ b/docs/source/guide/explanation/algorithms/object_detection/object_detection.rst @@ -74,12 +74,20 @@ We support the following ready-to-use model templates: +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ | Template ID | Name | Complexity (GFLOPs) | Model size (MB) | +===========================================================================================================================================================================================+=====================+=====================+=================+ -| `Custom_Object_Detection_YOLOX `_ | YOLOX | 6.5 | 20.4 | +| `Custom_Object_Detection_YOLOX `_ | YOLOX-TINY | 6.5 | 20.4 | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ +| `Object_Detection_YOLOX_S `_ | YOLOX_S | 33.51 | 46.0 | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ +| `Object_Detection_YOLOX_L `_ | YOLOX_L | 194.57 | 207.0 | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ +| `Object_Detection_YOLOX_X `_ | YOLOX_X | 352.42 | 378.0 | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ | `Custom_Object_Detection_Gen3_SSD `_ | SSD | 9.4 | 7.6 | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ | `Custom_Object_Detection_Gen3_ATSS `_ | MobileNetV2-ATSS | 20.6 | 9.1 | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ +| `Object_Detection_ResNeXt101_ATSS `_ | ResNeXt101-ATSS | 434.75 | 344.0 | ++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ Above table can be found using the following command @@ -90,32 +98,24 @@ Above table can be found using the following command `SSD `_ and `YOLOX `_ are light models, that a perfect for the fastest inference on low-power hardware. YOLOX achieved the same accuracy as SSD, and even outperforms its inference on CPU 1.5 times, but requires 3 times more time for training due to `Mosaic augmentation `_, which is even more than for ATSS. So if you have resources for a long training, you can pick the YOLOX model. +ATSS still shows good performance among `RetinaNet `_ based models. Therfore, We added ATSS with large scale backbone, ResNeXt101-ATSS. We integrated large ResNeXt101 backbone to our Custom ATSS head, and it shows good transfer learning performance. +In addition, we added a YOLOX variants to support users' diverse situations. In addition to these models, we supports experimental models for object detection. These experimental models will be changed to official models within a few releases. +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ | Template ID | Name | Complexity (GFLOPs) | Model size (MB) | +===========================================================================================================================================================================================================================+=====================+=====================+=================+ -| `Custom_Object_Detection_Gen3_Deformable_DETR `_ | Deformable_DETR | 165 | 157.0 | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Custom_Object_Detection_Gen3_DINO `_ | DINO | 235 | 182.0 | +| `Object_Detection_Deformable_DETR `_ | Deformable_DETR | 165 | 157.0 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Custom_Object_Detection_Gen3_Lite_DINO `_ | Lite-DINO | 140 | 190.0 | +| `Object_Detection_DINO `_ | DINO | 235 | 182.0 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Custom_Object_Detection_Gen3_ResNeXt101_ATSS `_ | ResNeXt101-ATSS | 434.75 | 344.0 | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Object_Detection_YOLOX_S `_ | YOLOX_S | 33.51 | 46.0 | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Object_Detection_YOLOX_L `_ | YOLOX_L | 194.57 | 207.0 | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ -| `Object_Detection_YOLOX_X `_ | YOLOX_X | 352.42 | 378.0 | +| `Object_Detection_Lite_DINO `_ | Lite-DINO | 140 | 190.0 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+-----------------+ + `Deformable_DETR `_ is `DETR `_ based model, and it solves slow convergence problem of DETR. `DINO `_ improves Deformable DETR based methods via denoising anchor boxes. Current SOTA models for object detection are based on DINO. `Lite-DINO `_ is efficient structure for DINO. It reduces FLOPS of transformer's encoder which takes the highest computational costs. -Although transformer based models show notable performance on various object detection benchmark, CNN based model still show good performance with proper latency. -Therefore, we added a new experimental CNN based method, ResNeXt101-ATSS. ATSS still shows good performance among `RetinaNet `_ based models. We integrated large ResNeXt101 backbone to our Custom ATSS head, and it shows good transfer learning performance. -In addition, we added a YOLOX variants to support users' diverse situations. .. note:: @@ -145,7 +145,7 @@ We trained each model with a single Nvidia GeForce RTX3090. +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ | Model name | COCO(AP50) | BDD100K | Brackish | Plantdoc | BCCD | Chess pieces | +============================+==================+===========+===========+===========+===========+==============+ -| YOLOX | 31.0 (48.2) | 24.8 | 96.3 | 51.5 | 88.5 | 99.2 | +| YOLOX-TINY | 31.0 (48.2) | 24.8 | 96.3 | 51.5 | 88.5 | 99.2 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ | SSD | 13.5 | 28.2 | 96.5 | 52.9 | 91.1 | 99.1 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ @@ -159,11 +159,11 @@ We trained each model with a single Nvidia GeForce RTX3090. +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ | ResNet50-Lite-DINO | 48.1 (64.4) | 47.0 | 99.0 | 62.5 | 93.6 | 99.4 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ -| YOLOX_S | 40.3 (59.1) | 37.1 | 93.6 | 54.8 | 92.7 | 98.8 | +| YOLOX-S | 40.3 (59.1) | 37.1 | 93.6 | 54.8 | 92.7 | 98.8 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ -| YOLOX_L | 49.4 (67.1) | 44.5 | 94.6 | 55.8 | 91.8 | 99.0 | +| YOLOX-L | 49.4 (67.1) | 44.5 | 94.6 | 55.8 | 91.8 | 99.0 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ -| YOLOX_X | 50.9 (68.4) | 44.2 | 96.3 | 56.2 | 91.5 | 98.9 | +| YOLOX-X | 50.9 (68.4) | 44.2 | 96.3 | 56.2 | 91.5 | 98.9 | +----------------------------+------------------+-----------+-----------+-----------+-----------+--------------+ ************************ diff --git a/docs/source/guide/get_started/cli_commands.rst b/docs/source/guide/get_started/cli_commands.rst index a177388d27f..74d1e975729 100644 --- a/docs/source/guide/get_started/cli_commands.rst +++ b/docs/source/guide/get_started/cli_commands.rst @@ -32,14 +32,17 @@ Example to find ready-to-use templates for the detection task: .. code-block:: (otx) ...$ otx find --task detection - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+ - | TASK | ID | NAME | BASE PATH | - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+ - | DETECTION | Custom_Object_Detection_Gen3_SSD | SSD | src/otx/algorithms/detection/configs/detection/mobilenetv2_ssd/template.yaml | - | DETECTION | Custom_Object_Detection_YOLOX | YOLOX | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/template.yaml | - | DETECTION | Custom_Object_Detection_Gen3_ATSS | MobileNetV2-ATSS | src/otx/algorithms/detection/configs/detection/mobilenetv2_atss/template.yaml | - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+ - + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ + | TASK | ID | NAME | BASE PATH | + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ + | DETECTION | Custom_Object_Detection_Gen3_ATSS | MobileNetV2-ATSS | src/otx/algorithms/detection/configs/detection/mobilenetv2_atss/template.yaml | + | DETECTION | Object_Detection_ResNeXt101_ATSS | ResNeXt101-ATSS | src/otx/algorithms/detection/configs/detection/resnext101_atss/template.yaml | + | DETECTION | Custom_Object_Detection_Gen3_SSD | SSD | src/otx/algorithms/detection/configs/detection/mobilenetv2_ssd/template.yaml | + | DETECTION | Object_Detection_YOLOX_L | YOLOX-L | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template.yaml | + | DETECTION | Object_Detection_YOLOX_S | YOLOX-S | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template.yaml | + | DETECTION | Custom_Object_Detection_YOLOX | YOLOX-TINY | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/template.yaml | + | DETECTION | Object_Detection_YOLOX_X | YOLOX-X | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template.yaml | + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ Example to find supported torchvision backbones for the detection task: diff --git a/docs/source/guide/tutorials/base/how_to_train/detection.rst b/docs/source/guide/tutorials/base/how_to_train/detection.rst index ac31cbf89be..f6235e76d84 100644 --- a/docs/source/guide/tutorials/base/how_to_train/detection.rst +++ b/docs/source/guide/tutorials/base/how_to_train/detection.rst @@ -134,13 +134,17 @@ The list of supported templates for object detection is available with the comma .. code-block:: (otx) ...$ otx find --template --task DETECTION - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+ - | TASK | ID | NAME | BASE PATH | - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+ - | DETECTION | Custom_Object_Detection_Gen3_SSD | SSD | src/otx/algorithms/detection/configs/detection/mobilenetv2_ssd/template.yaml | - | DETECTION | Custom_Object_Detection_YOLOX | YOLOX | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/template.yaml | - | DETECTION | Custom_Object_Detection_Gen3_ATSS | MobileNetV2-ATSS | src/otx/algorithms/detection/configs/detection/mobilenetv2_atss/template.yaml | - +-----------+-----------------------------------------------+------------------+-------------------------------------------------------------------------------+v + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ + | TASK | ID | NAME | BASE PATH | + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ + | DETECTION | Custom_Object_Detection_Gen3_ATSS | MobileNetV2-ATSS | src/otx/algorithms/detection/configs/detection/mobilenetv2_atss/template.yaml | + | DETECTION | Object_Detection_ResNeXt101_ATSS | ResNeXt101-ATSS | src/otx/algorithms/detection/configs/detection/resnext101_atss/template.yaml | + | DETECTION | Custom_Object_Detection_Gen3_SSD | SSD | src/otx/algorithms/detection/configs/detection/mobilenetv2_ssd/template.yaml | + | DETECTION | Object_Detection_YOLOX_L | YOLOX-L | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template.yaml | + | DETECTION | Object_Detection_YOLOX_S | YOLOX-S | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template.yaml | + | DETECTION | Custom_Object_Detection_YOLOX | YOLOX-TINY | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/template.yaml | + | DETECTION | Object_Detection_YOLOX_X | YOLOX-X | src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template.yaml | + +-----------+-----------------------------------+------------------+------------------------------------------------------------------------------------+ .. _detection_workspace: diff --git a/src/otx/algorithms/detection/configs/base/data/tiling/yolox_tile_pipeline.py b/src/otx/algorithms/detection/configs/base/data/tiling/yolox_tile_pipeline.py index 5b1c3be1f09..c1d1ee5c50e 100644 --- a/src/otx/algorithms/detection/configs/base/data/tiling/yolox_tile_pipeline.py +++ b/src/otx/algorithms/detection/configs/base/data/tiling/yolox_tile_pipeline.py @@ -21,7 +21,6 @@ scaling_ratio_range=(0.1, 2), border=(-img_scale[0] // 2, -img_scale[1] // 2), ), - dict(type="MixUp", img_scale=img_scale, ratio_range=(0.8, 1.6), pad_val=114.0), dict(type="YOLOXHSVRandomAug"), dict(type="RandomFlip", flip_ratio=0.5), dict(type="Resize", img_scale=img_scale, keep_ratio=True), @@ -46,15 +45,13 @@ ] test_pipeline = [ - dict(type="LoadImageFromOTXDataset"), dict( type="MultiScaleFlipAug", img_scale=img_scale, flip=False, transforms=[ - dict(type="Resize", keep_ratio=True), + dict(type="Resize", keep_ratio=False), dict(type="RandomFlip"), - dict(type="Pad", pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict(type="Normalize", **img_norm_cfg), dict(type="DefaultFormatBundle"), dict(type="Collect", keys=["img"]), diff --git a/src/otx/algorithms/detection/configs/base/data/yolox_data_pipeline.py b/src/otx/algorithms/detection/configs/base/data/yolox_data_pipeline.py index b98e50d3e70..614d1009861 100644 --- a/src/otx/algorithms/detection/configs/base/data/yolox_data_pipeline.py +++ b/src/otx/algorithms/detection/configs/base/data/yolox_data_pipeline.py @@ -50,7 +50,7 @@ transforms=[ dict(type="Resize", keep_ratio=True), dict(type="RandomFlip"), - dict(type="Pad", pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), + dict(type="Pad", size=__img_size, pad_val=114.0), dict(type="Normalize", **__img_norm_cfg), dict(type="DefaultFormatBundle"), dict(type="Collect", keys=["img"]), diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template.yaml similarity index 99% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template_experimental.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template.yaml index 0d61b5a3d62..83a90ecfcca 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template.yaml @@ -1,6 +1,6 @@ # Description. model_template_id: Object_Detection_YOLOX_L -name: YOLOX_L +name: YOLOX-L task_type: DETECTION task_family: VISION instantiation: "CLASS" diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template.yaml similarity index 99% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template_experimental.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template.yaml index 1f804f3415c..0c94a081ce3 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template.yaml @@ -1,6 +1,6 @@ # Description. model_template_id: Object_Detection_YOLOX_S -name: YOLOX_S +name: YOLOX-S task_type: DETECTION task_family: VISION instantiation: "CLASS" diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/__init__.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/__init__.py similarity index 90% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/__init__.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/__init__.py index bf2be80b225..e8c550026f4 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/__init__.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/__init__.py @@ -1,4 +1,4 @@ -"""Initialization of YOLOX model for Detection Task.""" +"""Initialization of YOLOX Tiny model for Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/compression_config.json b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/compression_config.json similarity index 100% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/compression_config.json rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/compression_config.json diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/data_pipeline.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/data_pipeline.py similarity index 98% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/data_pipeline.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/data_pipeline.py index f96975e4ffc..81341cca449 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/data_pipeline.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/data_pipeline.py @@ -1,4 +1,4 @@ -"""Data Pipeline of YOLOX model for Detection Task.""" +"""Data Pipeline of YOLOX Tiny model for Detection Task.""" # Copyright (C) 2022-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/deployment.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/deployment.py similarity index 77% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/deployment.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/deployment.py index fe3d750dd7e..5cc28292e96 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/deployment.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/deployment.py @@ -1,4 +1,4 @@ -"""MMDeploy config of YOLOX model for Detection Task.""" +"""MMDeploy config of YOLOX Tiny model for Detection Task.""" _base_ = ["../../base/deployments/base_detection_dynamic.py"] diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/hpo_config.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/hpo_config.yaml similarity index 100% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/hpo_config.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/hpo_config.yaml diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/model.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/model.py similarity index 95% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/model.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/model.py index 2438de3188d..d8c806e3c57 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/model.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/model.py @@ -1,4 +1,4 @@ -"""Model configuration of YOLOX model for Detection Task.""" +"""Model configuration of YOLOX Tiny model for Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/__init__.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/__init__.py similarity index 89% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/__init__.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/__init__.py index 0d8f8f3a769..45891e04f7d 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/__init__.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/__init__.py @@ -1,4 +1,4 @@ -"""Initialization of YOLOX model for Semi-SL Detection Task.""" +"""Initialization of YOLOX Tiny model for Semi-SL Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/compression_config.json b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/compression_config.json similarity index 100% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/compression_config.json rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/compression_config.json diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/data_pipeline.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/data_pipeline.py similarity index 98% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/data_pipeline.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/data_pipeline.py index bd4fcb67f26..3167483245e 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/data_pipeline.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/data_pipeline.py @@ -1,4 +1,4 @@ -"""Data Pipeline of YOLOX model for Semi-Supervised Learning Detection Task.""" +"""Data Pipeline of YOLOX Tiny model for Semi-Supervised Learning Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/hparam.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/hparam.yaml similarity index 100% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/hparam.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/hparam.yaml diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/model.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/model.py similarity index 96% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/model.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/model.py index dfec937a5ba..ee23e00cdd4 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/semisl/model.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/semisl/model.py @@ -1,4 +1,4 @@ -"""Model configuration of YOLOX model for Detection Task.""" +"""Model configuration of YOLOX Tiny model for Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/template.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/template.yaml similarity index 94% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/template.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/template.yaml index cffc3157d88..5937daa1064 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/template.yaml +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/template.yaml @@ -1,10 +1,10 @@ # Description. model_template_id: Custom_Object_Detection_YOLOX -name: YOLOX +name: YOLOX-TINY task_type: DETECTION task_family: VISION instantiation: "CLASS" -summary: Class-Incremental Object Detection for YOLOX +summary: Class-Incremental Object Detection for YOLOX-TINY application: ~ # Algo backend. diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/tile_pipeline.py b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/tile_pipeline.py similarity index 98% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/tile_pipeline.py rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/tile_pipeline.py index a7eb808e153..af72de6ea48 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox/tile_pipeline.py +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_tiny/tile_pipeline.py @@ -1,4 +1,4 @@ -"""Tiling Pipeline of YOLOX model for Detection Task.""" +"""Tiling Pipeline of YOLOX Tiny model for Detection Task.""" # Copyright (C) 2022 Intel Corporation # diff --git a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template.yaml similarity index 95% rename from src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template_experimental.yaml rename to src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template.yaml index e0c6fe44065..50e07835a96 100644 --- a/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template.yaml @@ -1,6 +1,6 @@ # Description. model_template_id: Object_Detection_YOLOX_X -name: YOLOX_X +name: YOLOX-X task_type: DETECTION task_family: VISION instantiation: "CLASS" @@ -26,10 +26,10 @@ hyper_parameters: parameter_overrides: learning_parameters: batch_size: - default_value: 8 + default_value: 4 auto_hpo_state: POSSIBLE inference_batch_size: - default_value: 8 + default_value: 4 learning_rate: default_value: 0.001 auto_hpo_state: POSSIBLE diff --git a/src/otx/algorithms/detection/configs/detection/resnet50_deformable_detr/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/resnet50_deformable_detr/template_experimental.yaml index 0ad636abd4e..a306a66a3dd 100644 --- a/src/otx/algorithms/detection/configs/detection/resnet50_deformable_detr/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/resnet50_deformable_detr/template_experimental.yaml @@ -1,5 +1,5 @@ # Description. -model_template_id: Custom_Object_Detection_Gen3_Deformable_DETR +model_template_id: Object_Detection_Deformable_DETR name: Deformable_DETR task_type: DETECTION task_family: VISION diff --git a/src/otx/algorithms/detection/configs/detection/resnet50_dino/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/resnet50_dino/template_experimental.yaml index b439173785b..ee0fef31702 100644 --- a/src/otx/algorithms/detection/configs/detection/resnet50_dino/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/resnet50_dino/template_experimental.yaml @@ -1,5 +1,5 @@ # Description. -model_template_id: Custom_Object_Detection_Gen3_DINO +model_template_id: Object_Detection_DINO name: DINO task_type: DETECTION task_family: VISION diff --git a/src/otx/algorithms/detection/configs/detection/resnet50_lite_dino/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/resnet50_lite_dino/template_experimental.yaml index 34692cd9a36..18e7963be63 100644 --- a/src/otx/algorithms/detection/configs/detection/resnet50_lite_dino/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/resnet50_lite_dino/template_experimental.yaml @@ -1,5 +1,5 @@ # Description. -model_template_id: Custom_Object_Detection_Gen3_Lite_DINO +model_template_id: Object_Detection_Lite_DINO name: Lite-DINO task_type: DETECTION task_family: VISION diff --git a/src/otx/algorithms/detection/configs/detection/resnext101_atss/template_experimental.yaml b/src/otx/algorithms/detection/configs/detection/resnext101_atss/template.yaml similarity index 92% rename from src/otx/algorithms/detection/configs/detection/resnext101_atss/template_experimental.yaml rename to src/otx/algorithms/detection/configs/detection/resnext101_atss/template.yaml index ea395ab6b22..27fe398fd1b 100644 --- a/src/otx/algorithms/detection/configs/detection/resnext101_atss/template_experimental.yaml +++ b/src/otx/algorithms/detection/configs/detection/resnext101_atss/template.yaml @@ -1,5 +1,5 @@ # Description. -model_template_id: Custom_Object_Detection_Gen3_ResNeXt101_ATSS +model_template_id: Object_Detection_ResNeXt101_ATSS name: ResNeXt101-ATSS task_type: DETECTION task_family: VISION @@ -26,10 +26,10 @@ hyper_parameters: parameter_overrides: learning_parameters: batch_size: - default_value: 8 + default_value: 4 auto_hpo_state: POSSIBLE inference_batch_size: - default_value: 8 + default_value: 4 learning_rate: default_value: 0.004 auto_hpo_state: POSSIBLE diff --git a/src/otx/cli/tools/find.py b/src/otx/cli/tools/find.py index 69cf2e44118..bbc8e17e360 100644 --- a/src/otx/cli/tools/find.py +++ b/src/otx/cli/tools/find.py @@ -105,7 +105,8 @@ def main(): if not args.backbone or args.template: template_table = PrettyTable(["TASK", "ID", "NAME", "BASE PATH"]) - for template in otx_registry.templates: + templates = sorted(otx_registry.templates, key=lambda x: x.name) + for template in templates: relpath = os.path.relpath(template.model_template_path, os.path.abspath(".")) template_table.add_row( [ diff --git a/tests/e2e/cli/detection/reference/Object_Detection_ResNeXt101_ATSS/compressed_model.yml b/tests/e2e/cli/detection/reference/Object_Detection_ResNeXt101_ATSS/compressed_model.yml new file mode 100644 index 00000000000..9fb1e85cf6f --- /dev/null +++ b/tests/e2e/cli/detection/reference/Object_Detection_ResNeXt101_ATSS/compressed_model.yml @@ -0,0 +1,10 @@ +TestToolsMPADetection: + nncf: + number_of_fakequantizers: 232 + ptq: + number_of_fakequantizers: 272 +TestToolsTilingDetection: + nncf: + number_of_fakequantizers: 232 + ptq: + number_of_fakequantizers: 272 diff --git a/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_L/compressed_model.yml b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_L/compressed_model.yml new file mode 100644 index 00000000000..08909711d52 --- /dev/null +++ b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_L/compressed_model.yml @@ -0,0 +1,10 @@ +TestToolsMPADetection: + nncf: + number_of_fakequantizers: 146 + ptq: + number_of_fakequantizers: 146 +TestToolsTilingDetection: + nncf: + number_of_fakequantizers: 146 + ptq: + number_of_fakequantizers: 146 diff --git a/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_S/compressed_model.yml b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_S/compressed_model.yml new file mode 100644 index 00000000000..5c70893c4cc --- /dev/null +++ b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_S/compressed_model.yml @@ -0,0 +1,10 @@ +TestToolsMPADetection: + nncf: + number_of_fakequantizers: 108 + ptq: + number_of_fakequantizers: 108 +TestToolsTilingDetection: + nncf: + number_of_fakequantizers: 108 + ptq: + number_of_fakequantizers: 108 diff --git a/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_X/compressed_model.yml b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_X/compressed_model.yml new file mode 100644 index 00000000000..df27e7a34cb --- /dev/null +++ b/tests/e2e/cli/detection/reference/Object_Detection_YOLOX_X/compressed_model.yml @@ -0,0 +1,10 @@ +TestToolsMPADetection: + nncf: + number_of_fakequantizers: 177 + ptq: + number_of_fakequantizers: 177 +TestToolsTilingDetection: + nncf: + number_of_fakequantizers: 177 + ptq: + number_of_fakequantizers: 177 diff --git a/tests/e2e/cli/detection/test_detection.py b/tests/e2e/cli/detection/test_detection.py index 79ce1476c24..5df9259e2b6 100644 --- a/tests/e2e/cli/detection/test_detection.py +++ b/tests/e2e/cli/detection/test_detection.py @@ -64,7 +64,7 @@ "--test-data-roots": "tests/assets/car_tree_bug", "--unlabeled-data-roots": "tests/assets/car_tree_bug", "--input": "tests/assets/car_tree_bug/images/train", - "train_params": ["params", "--learning_parameters.num_iters", "2", "--learning_parameters.batch_size", "4"], + "train_params": ["params", "--learning_parameters.num_iters", "2", "--learning_parameters.batch_size", "2"], } # Training params for resume, num_iters*2 @@ -88,6 +88,9 @@ templates_ids = [template.model_template_id + f"-{i+1}" for i, template in enumerate(templates)] else: templates = Registry("src/otx/algorithms/detection").filter(task_type="DETECTION").templates + for i, template in enumerate(templates): + if template.name in ["YOLOX-S", "YOLOX-X"]: + templates.pop(i) # YOLOX-S, and YOLOX-X use same model and data pipeline config with YOLOX-L templates_ids = [template.model_template_id for template in templates] diff --git a/tests/e2e/cli/detection/test_tiling_detection.py b/tests/e2e/cli/detection/test_tiling_detection.py index 0aff270dff9..325702d9c9f 100644 --- a/tests/e2e/cli/detection/test_tiling_detection.py +++ b/tests/e2e/cli/detection/test_tiling_detection.py @@ -45,7 +45,7 @@ "--learning_parameters.num_iters", "10", "--learning_parameters.batch_size", - "4", + "2", "--tiling_parameters.enable_tiling", "1", "--tiling_parameters.enable_adaptive_params", diff --git a/tests/integration/cli/detection/test_detection.py b/tests/integration/cli/detection/test_detection.py index ffbbb6f62f9..76e4aee4d51 100644 --- a/tests/integration/cli/detection/test_detection.py +++ b/tests/integration/cli/detection/test_detection.py @@ -67,6 +67,9 @@ default_templates_ids = [default_template.model_template_id] templates = Registry("src/otx/algorithms/detection").filter(task_type="DETECTION").templates +for i, template in enumerate(templates): + if template.name in ["YOLOX-S", "YOLOX-X"]: + templates.pop(i) # YOLOX-S, and YOLOX-X use same model and data pipeline config with YOLOX-L templates_ids = [template.model_template_id for template in templates] experimental_templates = [ @@ -77,16 +80,6 @@ parse_model_template( "src/otx/algorithms/detection/configs/detection/resnet50_lite_dino/template_experimental.yaml" ), - parse_model_template("src/otx/algorithms/detection/configs/detection/resnext101_atss/template_experimental.yaml"), - parse_model_template( - "src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_s/template_experimental.yaml" - ), - parse_model_template( - "src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_l/template_experimental.yaml" - ), - parse_model_template( - "src/otx/algorithms/detection/configs/detection/cspdarknet_yolox_x/template_experimental.yaml" - ), ] experimental_template_ids = [template.model_template_id for template in experimental_templates] diff --git a/tests/unit/algorithms/detection/test_xai_detection_validity.py b/tests/unit/algorithms/detection/test_xai_detection_validity.py index d14284484cf..8bc8cf9235b 100644 --- a/tests/unit/algorithms/detection/test_xai_detection_validity.py +++ b/tests/unit/algorithms/detection/test_xai_detection_validity.py @@ -25,19 +25,31 @@ class TestExplainMethods: ref_saliency_shapes = { "MobileNetV2-ATSS": (2, 4, 4), + "ResNeXt101-ATSS": (2, 4, 4), "SSD": (81, 13, 13), - "YOLOX": (80, 13, 13), + "YOLOX-TINY": (80, 13, 13), + "YOLOX-S": (80, 13, 13), + "YOLOX-L": (80, 13, 13), + "YOLOX-X": (80, 13, 13), } ref_saliency_vals_det = { "MobileNetV2-ATSS": np.array([67, 216, 255, 57], dtype=np.uint8), - "YOLOX": np.array([80, 28, 42, 53, 49, 68, 72, 75, 69, 57, 65, 6, 157], dtype=np.uint8), + "ResNeXt101-ATSS": np.array([75, -42, -27, -83], dtype=np.int8), + "YOLOX-TINY": np.array([80, 28, 42, 53, 49, 68, 72, 75, 69, 57, 65, 6, 157], dtype=np.uint8), + "YOLOX-S": np.array([75, -78, -105, -97, -106, -108, -112, -112, -109, -112, -109, -114, -67], dtype=np.int8), + "YOLOX-L": np.array([43, 28, 0, 6, 7, 19, 22, 17, 14, 18, 25, 7, 34], dtype=np.int8), + "YOLOX-X": np.array([-1, -112, 83, 76, 83, 86, 82, 90, 91, 93, 110, 104, 83], dtype=np.int8), "SSD": np.array([119, 72, 118, 35, 39, 30, 31, 31, 36, 28, 44, 23, 61], dtype=np.uint8), } ref_saliency_vals_det_wo_postprocess = { "MobileNetV2-ATSS": -0.10465062, - "YOLOX": 0.04948914, + "ResNeXt101-ATSS": -0.073549636, + "YOLOX-TINY": 0.04948914, + "YOLOX-S": 0.01133332, + "YOLOX-L": 0.01870133, + "YOLOX-X": 0.0043506604, "SSD": 0.6629989, }