Spaces:
Running
on
Zero
Running
on
Zero
File size: 4,495 Bytes
9b33fca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
"""3D-MOOD with Swin-B."""
from __future__ import annotations
from vis4d.config import class_config
from vis4d.config.typing import ExperimentConfig
from vis4d.data.io.hdf5 import HDF5Backend
from vis4d.zoo.base import get_default_cfg
from opendet3d.zoo.gdino3d.base.callback import (
get_callback_cfg,
get_omni3d_evaluator_cfg,
)
from opendet3d.zoo.gdino3d.base.connector import get_data_connector_cfg
from opendet3d.zoo.gdino3d.base.data import get_data_cfg
from opendet3d.zoo.gdino3d.base.dataset.omni3d import (
get_omni3d_test_cfg,
get_omni3d_train_cfg,
)
from opendet3d.zoo.gdino3d.base.dataset.open import (
get_av2_data_cfg,
get_scannet_data_cfg,
)
from opendet3d.zoo.gdino3d.base.loss import get_loss_cfg
from opendet3d.zoo.gdino3d.base.model import (
get_gdino3d_hyperparams_cfg,
get_gdino3d_swin_base_cfg,
)
from opendet3d.zoo.gdino3d.base.optim import get_optim_cfg
from opendet3d.zoo.gdino3d.base.pl import get_pl_cfg
def get_config() -> ExperimentConfig:
"""Returns the 3D-MOOD with Swin-B."""
######################################################
## General Config ##
######################################################
config = get_default_cfg(exp_name="gdino3d_swin-b_omni3d")
config.use_checkpoint = True
# High level hyper parameters
params = get_gdino3d_hyperparams_cfg()
config.params = params
######################################################
## Datasets with augmentations ##
######################################################
data_backend = class_config(HDF5Backend)
test_datasets_cfg = []
# Omni3D
omni3d_data_root = "data/omni3d"
omni3d_test_datasets = (
"KITTI_test",
"nuScenes_test",
"SUNRGBD_test",
"Hypersim_test",
"ARKitScenes_test",
"Objectron_test",
)
omni3d_train_data_cfg = get_omni3d_train_cfg(
data_root=omni3d_data_root, data_backend=data_backend
)
omni3d_test_data_cfg = get_omni3d_test_cfg(
data_root=omni3d_data_root,
test_datasets=omni3d_test_datasets,
data_backend=data_backend,
)
test_datasets_cfg.append(omni3d_test_data_cfg)
# Open Datasets
test_datasets_cfg += [
get_av2_data_cfg(data_backend=data_backend),
get_scannet_data_cfg(data_backend=data_backend),
]
config.data = get_data_cfg(
train_datasets=omni3d_train_data_cfg,
test_datasets=test_datasets_cfg,
samples_per_gpu=params.samples_per_gpu,
workers_per_gpu=params.workers_per_gpu,
)
######################################################
## MODEL & LOSS ##
######################################################
config.model, box_coder = get_gdino3d_swin_base_cfg(
params=params,
pretrained="mm_gdino_swin_base_all",
use_checkpoint=config.use_checkpoint,
)
config.loss = get_loss_cfg(params, box_coder, aux_depth_loss=True)
######################################################
## OPTIMIZERS ##
######################################################
config.optimizers = get_optim_cfg(params)
######################################################
## DATA CONNECTOR ##
######################################################
config.train_data_connector, config.test_data_connector = (
get_data_connector_cfg()
)
######################################################
## CALLBACKS ##
######################################################
# Omni3D Evaluator
omni3d_evaluator_cfg = get_omni3d_evaluator_cfg(
data_root=omni3d_data_root,
omni3d50=True,
test_datasets=omni3d_test_datasets,
)
# Open Detect3D Evaluator
open_test_datasets = ["Argoverse_val", "ScanNet_val"]
callbacks = get_callback_cfg(
output_dir=config.output_dir,
omni3d_evaluator=omni3d_evaluator_cfg,
open_test_datasets=open_test_datasets,
)
config.callbacks = callbacks
######################################################
## PL CLI ##
######################################################
config.pl_trainer = get_pl_cfg(config, params)
return config.value_mode()
|