Skip to content

Commit

Permalink
add mobilenetv3 small
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhyadi committed Sep 12, 2022
1 parent 16d49a4 commit 6fbfe38
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 236 deletions.
33 changes: 13 additions & 20 deletions .hydra/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tags:
train: true
test: false
ckpt_path: null
seed: null
seed: 42069
datamodule:
_target_: src.datamodules.kitti_datamodule.KITTIDataModule
dataset_path: ${paths.data_dir}
Expand All @@ -18,9 +18,10 @@ model:
net:
_target_: src.models.components.base.RegressorNet
backbone:
_target_: torchvision.models.resnet18
_target_: torchvision.models.mobilenet_v3_small
pretrained: true
bins: 2
optimizer: adam
lr: 0.001
momentum: 0.9
w: 0.4
Expand Down Expand Up @@ -58,34 +59,23 @@ callbacks:
max_depth: -1
rich_progress_bar:
_target_: pytorch_lightning.callbacks.RichProgressBar
logger:
wandb:
_target_: pytorch_lightning.loggers.wandb.WandbLogger
save_dir: ${paths.output_dir}
offline: false
id: null
anonymous: null
project: yolo3d-regressor
log_model: false
prefix: ''
group: ''
tags: []
job_type: ''
trainer:
_target_: pytorch_lightning.Trainer
default_root_dir: ${paths.output_dir}
min_epochs: 1
max_epochs: 25
max_epochs: 10
accelerator: gpu
devices:
- 0
- 1
- 2
- 3
deterministic: false
strategy: ddp
num_nodes: 1
sync_batchnorm: true
limit_train_batches: 0.1
limit_val_batches: 0.1
gpus:
- 2
- 3
strategy: ddp
paths:
root_dir: ${oc.env:PROJECT_ROOT}
data_dir: ${paths.root_dir}/data/KITTI
Expand All @@ -96,3 +86,6 @@ extras:
ignore_warnings: false
enforce_tags: true
print_config: true
logger:
project: resnet-yolo3d
name: tuning_hyp
15 changes: 6 additions & 9 deletions .hydra/hydra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,13 @@ hydra:
hydra:
- hydra.run.dir="/raid/didir/Repository/yolo3d-lightning"
- hydra.job.name=train_ddp_process_1
- hydra.run.dir="/raid/didir/Repository/yolo3d-lightning"
- hydra.job.name=train_ddp_process_2
- hydra.run.dir="/raid/didir/Repository/yolo3d-lightning"
- hydra.job.name=train_ddp_process_3
- hydra.mode=RUN
task: []
task:
- experiment=tuning
job:
name: train_ddp_process_3
name: train_ddp_process_1
chdir: null
override_dirname: ''
override_dirname: experiment=tuning
id: ???
num: ???
config_name: train.yaml
Expand Down Expand Up @@ -162,12 +159,12 @@ hydra:
debug: null
local: default.yaml
hparams_search: null
experiment: null
experiment: tuning
hydra: default.yaml
extras: default.yaml
paths: default.yaml
trainer: dgx.yaml
logger: wandb.yaml
logger: null
callbacks: default.yaml
model: regressor.yaml
datamodule: kitti_datamodule.yaml
Expand Down
2 changes: 1 addition & 1 deletion .hydra/overrides.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[]
- experiment=tuning
4 changes: 2 additions & 2 deletions configs/experiment/tuning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
- override /datamodule: kitti_datamodule.yaml
- override /model: regressor.yaml
- override /callbacks: default.yaml
- override /logger: wandb.yaml
- override /logger: null
- override /trainer: dgx.yaml

# all parameters below will be merged with parameters from default configurations set above
Expand All @@ -21,7 +21,7 @@ trainer:
limit_train_batches: 0.1
limit_val_batches: 0.1
gpus: [2, 3]
# strategy: ddp
strategy: ddp

datamodule:
train_sets: ${paths.data_dir}/train_80.txt
Expand Down
2 changes: 1 addition & 1 deletion configs/model/regressor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ _target_: src.models.regressor.RegressorModel
net:
_target_: src.models.components.base.RegressorNet
backbone:
_target_: torchvision.models.resnet18 # change model on this
_target_: torchvision.models.mobilenet_v3_small # change model on this
pretrained: True
bins: 2

Expand Down
2 changes: 1 addition & 1 deletion configs/train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
- datamodule: kitti_datamodule.yaml
- model: regressor.yaml
- callbacks: default.yaml
- logger: wandb.yaml # set logger here or use command line (e.g. `python train.py logger=tensorboard`)
- logger: null # set logger here or use command line (e.g. `python train.py logger=tensorboard`)
- trainer: dgx.yaml
- paths: default.yaml
- extras: default.yaml
Expand Down
4 changes: 2 additions & 2 deletions configs/trainer/dgx.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defaults:
- default.yaml

strategy: ddp
# strategy: ddp

accelerator: gpu
devices: [0,1,2,3]
devices: [0]
num_nodes: 1
sync_batchnorm: True
198 changes: 0 additions & 198 deletions notebooks/sample.ipynb

This file was deleted.

6 changes: 4 additions & 2 deletions src/models/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ def _get_in_features(self, net: nn.Module):

# TODO: add more models
in_features = {
'resnet': (lambda: net.fc.in_features * 7 * 7),
'vgg': (lambda: net.classifier[0].in_features)
'resnet': (lambda: net.fc.in_features * 7 * 7), # 512 * 7 * 7 = 25088
'vgg': (lambda: net.classifier[0].in_features), # 512 * 7 * 7 = 25088
# 'mobilenetv3_large': (lambda: (net.classifier[0].in_features) * 7 * 7), # 960 * 7 * 7 = 47040
'mobilenetv3': (lambda: (net.classifier[0].in_features) * 7 * 7), # 576 * 7 * 7 = 28416
}

return in_features[(net.__class__.__name__).lower()]()
Expand Down

0 comments on commit 6fbfe38

Please sign in to comment.