diff --git a/src/otx/recipe/detection/atss_resnext101_tile.yaml b/src/otx/recipe/detection/atss_resnext101_tile.yaml new file mode 100644 index 00000000000..0815453c46b --- /dev/null +++ b/src/otx/recipe/detection/atss_resnext101_tile.yaml @@ -0,0 +1,55 @@ +model: + class_path: otx.algo.detection.atss.ResNeXt101ATSS + init_args: + label_info: 80 + + optimizer: + class_path: torch.optim.SGD + init_args: + lr: 0.004 + momentum: 0.9 + weight_decay: 0.0001 + + scheduler: + class_path: otx.core.schedulers.LinearWarmupSchedulerCallable + init_args: + num_warmup_steps: 3 + main_scheduler_callable: + class_path: lightning.pytorch.cli.ReduceLROnPlateau + init_args: + mode: max + factor: 0.1 + patience: 4 + monitor: val/map_50 + +engine: + task: DETECTION + device: auto + +callback_monitor: val/map_50 + +data: ../_base_/data/detection.yaml +overrides: + gradient_clip_val: 35.0 + callbacks: + - class_path: otx.algo.callbacks.adaptive_train_scheduling.AdaptiveTrainScheduling + init_args: + max_interval: 5 + decay: -0.025 + min_lrschedule_patience: 3 + + data: + tile_config: + enable_tiler: true + enable_adaptive_tiling: true + + train_subset: + batch_size: 4 + sampler: + class_path: otx.algo.samplers.balanced_sampler.BalancedSampler + + val_subset: + batch_size: 4 + + test_subset: + batch_size: 4 diff --git a/src/otx/recipe/detection/rtdetr_101_tile.yaml b/src/otx/recipe/detection/rtdetr_101_tile.yaml new file mode 100644 index 00000000000..affbd103fbe --- /dev/null +++ b/src/otx/recipe/detection/rtdetr_101_tile.yaml @@ -0,0 +1,114 @@ +model: + class_path: otx.algo.detection.rtdetr.RTDETR101 + init_args: + label_info: 80 + + optimizer: + class_path: torch.optim.AdamW + init_args: + lr: 0.0001 + betas: [0.9, 0.999] + weight_decay: 0.0001 + + scheduler: + class_path: otx.core.schedulers.LinearWarmupSchedulerCallable + init_args: + num_warmup_steps: 5 + main_scheduler_callable: + class_path: lightning.pytorch.cli.ReduceLROnPlateau + init_args: + mode: max + factor: 0.1 + patience: 6 + monitor: val/map_50 + +engine: + task: DETECTION + device: auto + +callback_monitor: val/map_50 + +data: ../_base_/data/torchvision_base.yaml +overrides: + callbacks: + - class_path: otx.algo.callbacks.adaptive_train_scheduling.AdaptiveTrainScheduling + init_args: + max_interval: 1 + decay: -0.025 + min_lrschedule_patience: 3 + - class_path: otx.algo.callbacks.adaptive_early_stopping.EarlyStoppingWithWarmup + init_args: + monitor: null + mode: max + patience: 10 + check_on_train_epoch_end: false + min_delta: 0.001 + warmup_iters: 100 + warmup_epochs: 7 + + data: + tile_config: + enable_tiler: true + enable_adaptive_tiling: true + input_size: + - 640 + - 640 + task: DETECTION + stack_images: true + data_format: coco_instances + train_subset: + batch_size: 4 + to_tv_image: true + transforms: + - class_path: torchvision.transforms.v2.RandomPhotometricDistort + init_args: + p: 0.5 + - class_path: torchvision.transforms.v2.RandomZoomOut + init_args: + fill: 0 + - class_path: otx.core.data.transform_libs.torchvision.RandomFlip + init_args: + prob: 0.5 + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + - class_path: torchvision.transforms.v2.SanitizeBoundingBoxes + sampler: + class_path: otx.algo.samplers.balanced_sampler.BalancedSampler + + val_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + + test_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true diff --git a/src/otx/recipe/detection/rtdetr_18_tile.yaml b/src/otx/recipe/detection/rtdetr_18_tile.yaml new file mode 100644 index 00000000000..71c2b3a715c --- /dev/null +++ b/src/otx/recipe/detection/rtdetr_18_tile.yaml @@ -0,0 +1,113 @@ +model: + class_path: otx.algo.detection.rtdetr.RTDETR18 + init_args: + label_info: 80 + + optimizer: + class_path: torch.optim.AdamW + init_args: + lr: 0.0001 + betas: [0.9, 0.999] + weight_decay: 0.0001 + + scheduler: + class_path: otx.core.schedulers.LinearWarmupSchedulerCallable + init_args: + num_warmup_steps: 5 + main_scheduler_callable: + class_path: lightning.pytorch.cli.ReduceLROnPlateau + init_args: + mode: max + factor: 0.1 + patience: 6 + monitor: val/map_50 +engine: + task: DETECTION + device: auto + +callback_monitor: val/map_50 + +data: ../_base_/data/torchvision_base.yaml +overrides: + callbacks: + - class_path: otx.algo.callbacks.adaptive_train_scheduling.AdaptiveTrainScheduling + init_args: + max_interval: 1 + decay: -0.025 + min_lrschedule_patience: 3 + - class_path: otx.algo.callbacks.adaptive_early_stopping.EarlyStoppingWithWarmup + init_args: + monitor: null + mode: max + patience: 10 + check_on_train_epoch_end: false + min_delta: 0.001 + warmup_iters: 100 + warmup_epochs: 7 + + data: + tile_config: + enable_tiler: true + enable_adaptive_tiling: true + input_size: + - 640 + - 640 + task: DETECTION + stack_images: true + data_format: coco_instances + train_subset: + batch_size: 4 + to_tv_image: true + transforms: + - class_path: torchvision.transforms.v2.RandomPhotometricDistort + init_args: + p: 0.5 + - class_path: torchvision.transforms.v2.RandomZoomOut + init_args: + fill: 0 + - class_path: otx.core.data.transform_libs.torchvision.RandomFlip + init_args: + prob: 0.5 + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + - class_path: torchvision.transforms.v2.SanitizeBoundingBoxes + sampler: + class_path: otx.algo.samplers.balanced_sampler.BalancedSampler + + val_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + + test_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true diff --git a/src/otx/recipe/detection/rtdetr_50_tile.yaml b/src/otx/recipe/detection/rtdetr_50_tile.yaml new file mode 100644 index 00000000000..b9a96155a54 --- /dev/null +++ b/src/otx/recipe/detection/rtdetr_50_tile.yaml @@ -0,0 +1,114 @@ +model: + class_path: otx.algo.detection.rtdetr.RTDETR50 + init_args: + label_info: 80 + + optimizer: + class_path: torch.optim.AdamW + init_args: + lr: 0.0001 + betas: [0.9, 0.999] + weight_decay: 0.0001 + + scheduler: + class_path: otx.core.schedulers.LinearWarmupSchedulerCallable + init_args: + num_warmup_steps: 5 + main_scheduler_callable: + class_path: lightning.pytorch.cli.ReduceLROnPlateau + init_args: + mode: max + factor: 0.1 + patience: 6 + monitor: val/map_50 + +engine: + task: DETECTION + device: auto + +callback_monitor: val/map_50 + +data: ../_base_/data/torchvision_base.yaml +overrides: + callbacks: + - class_path: otx.algo.callbacks.adaptive_train_scheduling.AdaptiveTrainScheduling + init_args: + max_interval: 1 + decay: -0.025 + min_lrschedule_patience: 3 + - class_path: otx.algo.callbacks.adaptive_early_stopping.EarlyStoppingWithWarmup + init_args: + monitor: null + mode: max + patience: 10 + check_on_train_epoch_end: false + min_delta: 0.001 + warmup_iters: 100 + warmup_epochs: 7 + + data: + tile_config: + enable_tiler: true + enable_adaptive_tiling: true + input_size: + - 640 + - 640 + task: DETECTION + stack_images: true + data_format: coco_instances + train_subset: + batch_size: 4 + to_tv_image: true + transforms: + - class_path: torchvision.transforms.v2.RandomPhotometricDistort + init_args: + p: 0.5 + - class_path: torchvision.transforms.v2.RandomZoomOut + init_args: + fill: 0 + - class_path: otx.core.data.transform_libs.torchvision.RandomFlip + init_args: + prob: 0.5 + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + - class_path: torchvision.transforms.v2.SanitizeBoundingBoxes + sampler: + class_path: otx.algo.samplers.balanced_sampler.BalancedSampler + + val_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true + + test_subset: + batch_size: 8 + to_tv_image: true + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: false + transform_bbox: true + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + scale: true diff --git a/src/otx/recipe/detection/rtmdet_tiny_tile.yaml b/src/otx/recipe/detection/rtmdet_tiny_tile.yaml new file mode 100644 index 00000000000..5417b86c683 --- /dev/null +++ b/src/otx/recipe/detection/rtmdet_tiny_tile.yaml @@ -0,0 +1,129 @@ +model: + class_path: otx.algo.detection.rtmdet.RTMDetTiny + init_args: + label_info: 80 + + optimizer: + class_path: torch.optim.AdamW + init_args: + lr: 0.0007 + weight_decay: 0.05 + + scheduler: + class_path: otx.core.schedulers.LinearWarmupSchedulerCallable + init_args: + num_warmup_steps: 3 + main_scheduler_callable: + class_path: lightning.pytorch.cli.ReduceLROnPlateau + init_args: + mode: max + factor: 0.1 + patience: 4 + monitor: val/map_50 + +engine: + task: DETECTION + device: auto + +callback_monitor: val/map_50 + +data: ../_base_/data/detection.yaml +overrides: + reset: + - data.train_subset.transforms + - data.val_subset.transforms + - data.test_subset.transforms + + gradient_clip_val: 35.0 + data: + tile_config: + enable_tiler: true + enable_adaptive_tiling: true + input_size: + - 640 + - 640 + image_color_channel: BGR + train_subset: + batch_size: 8 + transforms: + - class_path: otx.core.data.transform_libs.torchvision.CachedMosaic + init_args: + img_scale: $(input_size) + max_cached_images: 20 + random_pop: false + - class_path: otx.core.data.transform_libs.torchvision.RandomResize + init_args: + scale: $(input_size) * 2 + ratio_range: + - 0.5 + - 2.0 + keep_ratio: true + transform_bbox: true + - class_path: otx.core.data.transform_libs.torchvision.RandomCrop + init_args: + crop_size: $(input_size) + - class_path: otx.core.data.transform_libs.torchvision.YOLOXHSVRandomAug + - class_path: otx.core.data.transform_libs.torchvision.RandomFlip + init_args: + prob: 0.5 + - class_path: otx.core.data.transform_libs.torchvision.Pad + init_args: + size: $(input_size) + pad_val: 114 + - class_path: otx.core.data.transform_libs.torchvision.CachedMixUp + init_args: + img_scale: $(input_size) + ratio_range: + - 1.0 + - 1.0 + max_cached_images: 10 + random_pop: false + prob: 0.5 + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + - class_path: torchvision.transforms.v2.Normalize + init_args: + mean: [103.53, 116.28, 123.675] + std: [57.375, 57.12, 58.395] + + val_subset: + batch_size: 8 + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: true + - class_path: otx.core.data.transform_libs.torchvision.Pad + init_args: + size: $(input_size) + pad_val: 114 + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + - class_path: torchvision.transforms.v2.Normalize + init_args: + mean: [103.53, 116.28, 123.675] + std: [57.375, 57.12, 58.395] + + test_subset: + batch_size: 8 + transforms: + - class_path: otx.core.data.transform_libs.torchvision.Resize + init_args: + scale: $(input_size) + keep_ratio: true + - class_path: otx.core.data.transform_libs.torchvision.Pad + init_args: + size: $(input_size) + pad_val: 114 + is_numpy_to_tvtensor: true + - class_path: torchvision.transforms.v2.ToDtype + init_args: + dtype: ${as_torch_dtype:torch.float32} + - class_path: torchvision.transforms.v2.Normalize + init_args: + mean: [103.53, 116.28, 123.675] + std: [57.375, 57.12, 58.395]