-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Self-SL configs for SegNext (#2215)
* add fit selfsl configs to segnext * Move selfsl recipes into src * Remove unused parameters * Update batch & lr * Remove skip for segnext * Update CHANGELOG * Update licenses * Update docstring
- Loading branch information
Showing
16 changed files
with
237 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/otx/algorithms/segmentation/configs/ham_segnext_b/selfsl/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Initialization of SegNext-B model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 |
7 changes: 7 additions & 0 deletions
7
src/otx/algorithms/segmentation/configs/ham_segnext_b/selfsl/data_pipeline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Data Pipeline of SegNext model for Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
_base_ = ["../../base/data/selfsl/data_pipeline.py"] |
17 changes: 17 additions & 0 deletions
17
src/otx/algorithms/segmentation/configs/ham_segnext_b/selfsl/hparam.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Hyperparameters. | ||
hyper_parameters: | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 32 | ||
learning_rate: | ||
default_value: 0.0001 | ||
learning_rate_warmup_iters: | ||
default_value: 0 | ||
num_iters: | ||
default_value: 10 | ||
enable_early_stopping: | ||
default_value: false | ||
algo_backend: | ||
train_type: | ||
default_value: Selfsupervised |
53 changes: 53 additions & 0 deletions
53
src/otx/algorithms/segmentation/configs/ham_segnext_b/selfsl/model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""Model configuration of SegNext-B model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
|
||
_base_ = [ | ||
"../../../../../recipes/stages/segmentation/selfsl.py", | ||
"../../../../common/adapters/mmcv/configs/backbones/segnext.py", | ||
] | ||
|
||
|
||
model = dict( | ||
type="DetConB", | ||
pretrained="https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segnext/mscan_b_20230227-3ab7d230.pth", | ||
num_classes=256, | ||
num_samples=16, | ||
downsample=8, | ||
input_transform="resize_concat", | ||
in_index=[1, 2, 3], | ||
backbone=dict( | ||
embed_dims=[64, 128, 320, 512], | ||
depths=[3, 3, 12, 3], | ||
drop_path_rate=0.1, | ||
norm_cfg=dict(type="BN", requires_grad=True), | ||
), | ||
neck=dict( | ||
type="SelfSLMLP", | ||
in_channels=960, | ||
hid_channels=1920, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
head=dict( | ||
type="DetConHead", | ||
predictor=dict( | ||
type="SelfSLMLP", | ||
in_channels=256, | ||
hid_channels=1920, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
loss_cfg=dict(type="DetConLoss", temperature=0.1), | ||
), | ||
) | ||
|
||
optimizer = dict(paramwise_cfg=dict(custom_keys={"pos_block": dict(decay_mult=0.0), "norm": dict(decay_mult=0.0)})) | ||
load_from = None | ||
resume_from = None | ||
fp16 = None |
4 changes: 4 additions & 0 deletions
4
src/otx/algorithms/segmentation/configs/ham_segnext_s/selfsl/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Initialization of SegNext-S model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 |
7 changes: 7 additions & 0 deletions
7
src/otx/algorithms/segmentation/configs/ham_segnext_s/selfsl/data_pipeline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Data Pipeline of SegNext model for Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
_base_ = ["../../base/data/selfsl/data_pipeline.py"] |
17 changes: 17 additions & 0 deletions
17
src/otx/algorithms/segmentation/configs/ham_segnext_s/selfsl/hparam.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Hyperparameters. | ||
hyper_parameters: | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 32 | ||
learning_rate: | ||
default_value: 0.0001 | ||
learning_rate_warmup_iters: | ||
default_value: 0 | ||
num_iters: | ||
default_value: 10 | ||
enable_early_stopping: | ||
default_value: false | ||
algo_backend: | ||
train_type: | ||
default_value: Selfsupervised |
52 changes: 52 additions & 0 deletions
52
src/otx/algorithms/segmentation/configs/ham_segnext_s/selfsl/model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Model configuration of SegNext-S model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
|
||
_base_ = [ | ||
"../../../../../recipes/stages/segmentation/selfsl.py", | ||
"../../../../common/adapters/mmcv/configs/backbones/segnext.py", | ||
] | ||
|
||
|
||
model = dict( | ||
type="DetConB", | ||
pretrained="https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segnext/mscan_s_20230227-f33ccdf2.pth", | ||
num_classes=256, | ||
num_samples=16, | ||
downsample=8, | ||
input_transform="resize_concat", | ||
in_index=[1, 2, 3], | ||
backbone=dict( | ||
embed_dims=[64, 128, 320, 512], | ||
depths=[2, 2, 4, 2], | ||
norm_cfg=dict(type="BN", requires_grad=True), | ||
), | ||
neck=dict( | ||
type="SelfSLMLP", | ||
in_channels=960, | ||
hid_channels=1920, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
head=dict( | ||
type="DetConHead", | ||
predictor=dict( | ||
type="SelfSLMLP", | ||
in_channels=256, | ||
hid_channels=1920, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
loss_cfg=dict(type="DetConLoss", temperature=0.1), | ||
), | ||
) | ||
|
||
optimizer = dict(paramwise_cfg=dict(custom_keys={"pos_block": dict(decay_mult=0.0), "norm": dict(decay_mult=0.0)})) | ||
load_from = None | ||
resume_from = None | ||
fp16 = None |
4 changes: 4 additions & 0 deletions
4
src/otx/algorithms/segmentation/configs/ham_segnext_t/selfsl/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Initialization of SegNext-T model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 |
7 changes: 7 additions & 0 deletions
7
src/otx/algorithms/segmentation/configs/ham_segnext_t/selfsl/data_pipeline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Data Pipeline of SegNext model for Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
_base_ = ["../../base/data/selfsl/data_pipeline.py"] |
17 changes: 17 additions & 0 deletions
17
src/otx/algorithms/segmentation/configs/ham_segnext_t/selfsl/hparam.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Hyperparameters. | ||
hyper_parameters: | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 32 | ||
learning_rate: | ||
default_value: 0.0001 | ||
learning_rate_warmup_iters: | ||
default_value: 0 | ||
num_iters: | ||
default_value: 10 | ||
enable_early_stopping: | ||
default_value: false | ||
algo_backend: | ||
train_type: | ||
default_value: Selfsupervised |
47 changes: 47 additions & 0 deletions
47
src/otx/algorithms/segmentation/configs/ham_segnext_t/selfsl/model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Model configuration of SegNext-T model for Self-SL Segmentation Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# pylint: disable=invalid-name | ||
|
||
_base_ = [ | ||
"../../../../../recipes/stages/segmentation/selfsl.py", | ||
"../../../../common/adapters/mmcv/configs/backbones/segnext.py", | ||
] | ||
|
||
|
||
model = dict( | ||
type="DetConB", | ||
pretrained="https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segnext/mscan_t_20230227-119e8c9f.pth", | ||
num_classes=256, | ||
num_samples=16, | ||
downsample=8, | ||
input_transform="resize_concat", | ||
in_index=[1, 2, 3], | ||
neck=dict( | ||
type="SelfSLMLP", | ||
in_channels=480, | ||
hid_channels=960, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
head=dict( | ||
type="DetConHead", | ||
predictor=dict( | ||
type="SelfSLMLP", | ||
in_channels=256, | ||
hid_channels=960, | ||
out_channels=256, | ||
norm_cfg=dict(type="BN1d", requires_grad=True), | ||
with_avg_pool=False, | ||
), | ||
loss_cfg=dict(type="DetConLoss", temperature=0.1), | ||
), | ||
) | ||
|
||
optimizer = dict(paramwise_cfg=dict(custom_keys={"pos_block": dict(decay_mult=0.0), "norm": dict(decay_mult=0.0)})) | ||
load_from = None | ||
resume_from = None | ||
fp16 = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters