Skip to content

Commit

Permalink
update augment, add mobilenet model
Browse files Browse the repository at this point in the history
  • Loading branch information
quangster committed Oct 29, 2024
1 parent dc203b8 commit e043fc0
Show file tree
Hide file tree
Showing 10 changed files with 931 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ configs/local/default.yaml

# Aim logging
.aim

/ckpts
12 changes: 4 additions & 8 deletions configs/data/landmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ train_transform:
width: 256
always_apply: true
- _target_: albumentations.ToFloat
max_value: 255
# - _target_: albumentations.Normalize
# mean: [0.485, 0.456, 0.406]
# std: [0.229, 0.224, 0.225]
max_values: 255.0
always_apply: true
- _target_: albumentations.pytorch.transforms.ToTensorV2

val_transform:
Expand All @@ -39,8 +37,6 @@ val_transform:
width: 256
always_apply: true
- _target_: albumentations.ToFloat
max_value: 255
# - _target_: albumentations.Normalize
# mean: [0.485, 0.456, 0.406]
# std: [0.229, 0.224, 0.225]
max_values: 255.0
always_apply: true
- _target_: albumentations.pytorch.transforms.ToTensorV2
55 changes: 32 additions & 23 deletions configs/experiment/filter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,31 @@ seed: 59
# ------------------override configs/trainer------------------
trainer:
min_epochs: 1 # prevents early stopping
max_epochs: 1
max_epochs: 10


# ------------------override configs/model------------------
model:
net:
_target_: src.models.components.ResNet
model_name: resnet18
weights: DEFAULT
output_shape: [68, 2]
# _target_: src.models.components.ResNet
# model_name: resnet18
# weights: DEFAULT
# output_shape: [68, 2]
# transfer: true

# _target_: src.models.components.CNN
# output_shape: [68, 2]

_target_: src.models.components.MobileNet
model_name: mobilenet_v3_large
weights: MobileNet_V3_Large_Weights.IMAGENET1K_V2
output_shape: [68, 2]
transfer: true

optimizer:
_target_: torch.optim.Adam
_partial_: true
lr: 0.001
lr: 0.01
weight_decay: 0.0

scheduler:
Expand All @@ -56,7 +63,7 @@ model:
# ------------------override configs/data------------------
data:
batch_size: 64
num_workers: 0
num_workers: 8
pin_memory: false

train_transform:
Expand All @@ -66,22 +73,27 @@ data:
width: 256
always_apply: true
- _target_: albumentations.Blur
p: 0.2
p: 0.3
- _target_: albumentations.RGBShift
r_shift_limit: 15
g_shift_limit: 15
b_shift_limit: 15
p: 0.2
r_shift_limit: 30
g_shift_limit: 30
b_shift_limit: 30
p: 0.3
- _target_: albumentations.RandomBrightnessContrast
p: 0.2
p: 0.3
- _target_: albumentations.ToGray
p: 0.2
p: 0.3
- _target_: albumentations.HorizontalFlip
p: 0.5
- _target_: albumentations.CoarseDropout
num_holes_range: [3, 8]
hole_height_range: [10, 30]
hole_width_range: [10, 30]
fill_value: 0
p: 0.4
- _target_: albumentations.ToFloat
max_value: 255
max_values: 255.0
always_apply: true
# - _target_: albumentations.Normalize
# mean: [0.485, 0.456, 0.406]
# std: [0.229, 0.224, 0.225]
- _target_: albumentations.pytorch.transforms.ToTensorV2

val_transform:
Expand All @@ -91,19 +103,16 @@ data:
width: 256
always_apply: true
- _target_: albumentations.ToFloat
max_value: 255
max_values: 255.0
always_apply: true
# - _target_: albumentations.Normalize
# mean: [0.485, 0.456, 0.406]
# std: [0.229, 0.224, 0.225]
- _target_: albumentations.pytorch.transforms.ToTensorV2


# ------------------override configs/logger------------------
logger:
wandb:
_target_: lightning.pytorch.loggers.wandb.WandbLogger
name: "resnet18" # name of the run (normally generated by wandb)
name: "mobilenetv3-transfer" # name of the run (normally generated by wandb)
save_dir: "${paths.output_dir}"
offline: False
id: null # pass correct id to resume experiment!
Expand Down
24 changes: 24 additions & 0 deletions configs/model/mobilenet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
_target_: src.models.LandmarksLitModule

net:
_target_: src.models.components.MobileNet
model_name: mobilenet_v3_large
weights: MobileNet_V3_Large_Weights.IMAGENET1K_V2
output_shape: [68, 2]
transfer: false

optimizer:
_target_: torch.optim.Adam
_partial_: true
lr: 0.01
weight_decay: 0.0

scheduler:
_target_: torch.optim.lr_scheduler.ReduceLROnPlateau
_partial_: true
mode: min
factor: 0.1
patience: 10

# compile model for faster training with pytorch 2.0
compile: false
3 changes: 2 additions & 1 deletion configs/model/resnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ net:
model_name: resnet18
weights: DEFAULT
output_shape: [68, 2]
transfer: false

optimizer:
_target_: torch.optim.Adam
_partial_: true
lr: 0.001
lr: 0.01
weight_decay: 0.0

scheduler:
Expand Down
Loading

0 comments on commit e043fc0

Please sign in to comment.