Skip to content

Commit

Permalink
Add light models to guarantee the backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sungmanc committed Dec 11, 2023
1 parent c021f18 commit 985fca2
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 4 deletions.
77 changes: 77 additions & 0 deletions src/otx/recipe/classification/efficientnet_b0_light.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# @package _global_
defaults:
- override /base: classification
- override /callbacks: classification
- override /data: mmpretrain
- override /model: mmpretrain
data:
train_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
scale: 224
type: RandomResizedCrop
- type: PackInputs
val_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
test_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
model:
otx_model:
config:
backbone:
version: b0
pretrained: true
type: OTXEfficientNet
head:
in_channels: 1280
loss:
loss_weight: 1.0
type: CrossEntropyLoss
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
mean:
- 123.675
- 116.28
- 103.53
std:
- 58.395
- 57.12
- 57.375
to_rgb: True
type: ClsDataPreprocessor
type: ImageClassifier
optimizer:
_target_: torch.optim.SGD
_partial_: true
lr: 0.0049
momentum: 0.9
weight_decay: 0.0001
scheduler:
factor: 0.5
patience: 1
79 changes: 79 additions & 0 deletions src/otx/recipe/classification/efficientnet_v2_light.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# @package _global_
defaults:
- override /base: classification
- override /callbacks: classification
- override /data: mmpretrain
- override /model: mmpretrain
data:
train_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
scale: 224
type: RandomResizedCrop
- direction: horizontal
prob: 0.5
type: RandomFlip
- type: PackInputs
val_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
test_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
model:
otx_model:
config:
backbone:
pretrained: true
type: OTXEfficientNetV2
head:
in_channels: 1280
loss:
loss_weight: 1.0
type: CrossEntropyLoss
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
mean:
- 123.675
- 116.28
- 103.53
std:
- 58.395
- 57.12
- 57.375
to_rgb: True
type: ClsDataPreprocessor
type: ImageClassifier
optimizer:
_target_: torch.optim.SGD
_partial_: true
lr: 0.0071
momentum: 0.9
weight_decay: 0.0001
scheduler:
factor: 0.5
patience: 1
78 changes: 78 additions & 0 deletions src/otx/recipe/classification/mobilenet_v3_large_light.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# @package _global_
defaults:
- override /base: classification
- override /callbacks: classification
- override /data: mmpretrain
- override /model: mmpretrain
data:
train_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
scale: 224
type: RandomResizedCrop
- direction: horizontal
prob: 0.5
type: RandomFlip
- type: PackInputs
val_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
test_subset:
batch_size: 64
transforms:
- type: LoadImageFromFile
- backend: cv2
edge: short
scale: 256
type: ResizeEdge
- crop_size: 224
type: CenterCrop
- type: PackInputs
model:
otx_model:
config:
backbone:
type: OTXMobileNetV3
head:
in_channels: 960
loss:
loss_weight: 1.0
type: CrossEntropyLoss
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
mean:
- 123.675
- 116.28
- 103.53
std:
- 58.395
- 57.12
- 57.375
to_rgb: True
type: ClsDataPreprocessor
type: ImageClassifier
optimizer:
_target_: torch.optim.SGD
_partial_: true
lr: 0.0058
momentum: 0.9
weight_decay: 0.0001
scheduler:
factor: 0.5
patience: 1
13 changes: 12 additions & 1 deletion src/otx/recipe/classification/otx_efficientnet_b0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,26 @@ model:
pretrained: true
type: OTXEfficientNet
head:
act_cfg:
type: HSwish
dropout_rate: 0.2
in_channels: 1280
init_cfg:
bias: 0.0
layer: Linear
mean: 0.0
std: 0.01
type: Normal
loss:
loss_weight: 1.0
type: CrossEntropyLoss
mid_channels:
- 1280
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
type: StackedLinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
Expand Down
13 changes: 12 additions & 1 deletion src/otx/recipe/classification/otx_efficientnet_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,26 @@ model:
pretrained: true
type: OTXEfficientNetV2
head:
act_cfg:
type: HSwish
dropout_rate: 0.2
in_channels: 1280
init_cfg:
bias: 0.0
layer: Linear
mean: 0.0
std: 0.01
type: Normal
loss:
loss_weight: 1.0
type: CrossEntropyLoss
mid_channels:
- 1280
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
type: StackedLinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
Expand Down
15 changes: 13 additions & 2 deletions src/otx/recipe/classification/otx_mobilenet_v3_large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,26 @@ model:
backbone:
type: OTXMobileNetV3
head:
in_channels: 960
act_cfg:
type: HSwish
dropout_rate: 0.2
in_channels: 1280
init_cfg:
bias: 0.0
layer: Linear
mean: 0.0
std: 0.01
type: Normal
loss:
loss_weight: 1.0
type: CrossEntropyLoss
mid_channels:
- 1280
num_classes: 1000
topk:
- 1
- 5
type: LinearClsHead
type: StackedLinearClsHead
neck:
type: GlobalAveragePooling
data_preprocessor:
Expand Down

0 comments on commit 985fca2

Please sign in to comment.