Skip to content

Commit

Permalink
use lite for ddp
Browse files Browse the repository at this point in the history
  • Loading branch information
wangg12 committed Nov 24, 2021
1 parent 6a049b2 commit 94fec43
Show file tree
Hide file tree
Showing 18 changed files with 625 additions and 702 deletions.
70 changes: 70 additions & 0 deletions configs/gdrn/lm/a6_cPnP_lm13_lite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
_base_ = ["../../_base_/gdrn_base.py"]

OUTPUT_DIR = "output/gdrn/lm/a6_cPnP_lm13_lite"
INPUT = dict(
DZI_PAD_SCALE=1.5,
COLOR_AUG_PROB=0.0,
COLOR_AUG_TYPE="code",
COLOR_AUG_CODE=(
"Sequential(["
"Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),"
# "Sometimes(0.5, Affine(scale=(1.0, 1.2))),"
"Sometimes(0.5, GaussianBlur(np.random.rand())),"
"Sometimes(0.5, Add((-20, 20), per_channel=0.3)),"
"Sometimes(0.4, Invert(0.20, per_channel=True)),"
"Sometimes(0.5, Multiply((0.7, 1.4), per_channel=0.8)),"
"Sometimes(0.5, Multiply((0.7, 1.4))),"
"Sometimes(0.5, ContrastNormalization((0.5, 2.0), per_channel=0.3))"
"], random_order=False)"
),
)

SOLVER = dict(
IMS_PER_BATCH=24,
LR_SCHEDULER_NAME="flat_and_anneal",
ANNEAL_METHOD="cosine", # "cosine"
ANNEAL_POINT=0.72,
# REL_STEPS=(0.3125, 0.625, 0.9375),
OPTIMIZER_CFG=dict(_delete_=True, type="Ranger", lr=1e-4, weight_decay=0),
WEIGHT_DECAY=0.0,
WARMUP_FACTOR=0.001,
WARMUP_ITERS=1000,
)

DATASETS = dict(
TRAIN=("lm_13_train", "lm_imgn_13_train_1k_per_obj"),
TEST=("lm_13_test",),
DET_FILES_TEST=("datasets/BOP_DATASETS/lm/test/test_bboxes/bbox_faster_all.json",),
)

MODEL = dict(
LOAD_DETS_TEST=True,
PIXEL_MEAN=[0.0, 0.0, 0.0],
PIXEL_STD=[255.0, 255.0, 255.0],
CDPN=dict(
ROT_HEAD=dict(
FREEZE=False,
ROT_CLASS_AWARE=False,
MASK_CLASS_AWARE=False,
XYZ_LW=1.0,
REGION_CLASS_AWARE=False,
NUM_REGIONS=64,
),
PNP_NET=dict(
R_ONLY=False,
REGION_ATTENTION=True,
WITH_2D_COORD=True,
ROT_TYPE="allo_rot6d",
TRANS_TYPE="centroid_z",
PM_NORM_BY_EXTENT=True,
PM_R_ONLY=True,
CENTROID_LOSS_TYPE="L1",
CENTROID_LW=1.0,
Z_LOSS_TYPE="L1",
Z_LW=1.0,
),
TRANS_HEAD=dict(FREEZE=True),
),
)

TEST = dict(EVAL_PERIOD=0, VIS=False, TEST_BBOX_TYPE="est") # gt | est
70 changes: 70 additions & 0 deletions configs/gdrn/lm/a6_cPnP_lm13_lite_2gpus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
_base_ = ["../../_base_/gdrn_base.py"]

OUTPUT_DIR = "output/gdrn/lm/a6_cPnP_lm13_lite_2gpus"
INPUT = dict(
DZI_PAD_SCALE=1.5,
COLOR_AUG_PROB=0.0,
COLOR_AUG_TYPE="code",
COLOR_AUG_CODE=(
"Sequential(["
"Sometimes(0.4, CoarseDropout( p=0.1, size_percent=0.05) ),"
# "Sometimes(0.5, Affine(scale=(1.0, 1.2))),"
"Sometimes(0.5, GaussianBlur(np.random.rand())),"
"Sometimes(0.5, Add((-20, 20), per_channel=0.3)),"
"Sometimes(0.4, Invert(0.20, per_channel=True)),"
"Sometimes(0.5, Multiply((0.7, 1.4), per_channel=0.8)),"
"Sometimes(0.5, Multiply((0.7, 1.4))),"
"Sometimes(0.5, ContrastNormalization((0.5, 2.0), per_channel=0.3))"
"], random_order=False)"
),
)

SOLVER = dict(
IMS_PER_BATCH=48,
LR_SCHEDULER_NAME="flat_and_anneal",
ANNEAL_METHOD="cosine", # "cosine"
ANNEAL_POINT=0.72,
# REL_STEPS=(0.3125, 0.625, 0.9375),
OPTIMIZER_CFG=dict(_delete_=True, type="Ranger", lr=1e-4, weight_decay=0),
WEIGHT_DECAY=0.0,
WARMUP_FACTOR=0.001,
WARMUP_ITERS=1000,
)

DATASETS = dict(
TRAIN=("lm_13_train", "lm_imgn_13_train_1k_per_obj"),
TEST=("lm_13_test",),
DET_FILES_TEST=("datasets/BOP_DATASETS/lm/test/test_bboxes/bbox_faster_all.json",),
)

MODEL = dict(
LOAD_DETS_TEST=True,
PIXEL_MEAN=[0.0, 0.0, 0.0],
PIXEL_STD=[255.0, 255.0, 255.0],
CDPN=dict(
ROT_HEAD=dict(
FREEZE=False,
ROT_CLASS_AWARE=False,
MASK_CLASS_AWARE=False,
XYZ_LW=1.0,
REGION_CLASS_AWARE=False,
NUM_REGIONS=64,
),
PNP_NET=dict(
R_ONLY=False,
REGION_ATTENTION=True,
WITH_2D_COORD=True,
ROT_TYPE="allo_rot6d",
TRANS_TYPE="centroid_z",
PM_NORM_BY_EXTENT=True,
PM_R_ONLY=True,
CENTROID_LOSS_TYPE="L1",
CENTROID_LW=1.0,
Z_LOSS_TYPE="L1",
Z_LW=1.0,
),
TRANS_HEAD=dict(FREEZE=True),
),
)

TEST = dict(EVAL_PERIOD=0, VIS=False, TEST_BBOX_TYPE="est") # gt | est
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/lm_blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,15 @@ def test_vis():
python -m core.datasets.lm_blender dataset_name
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())
test_vis()
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/lm_dataset_d2.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,15 @@ def test_vis():
python this_file.py dataset_name
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())

Expand Down
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/lm_pbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,15 @@ def test_vis():
python -m core.datasets.lm_pbr dataset_name
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())

Expand Down
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/lm_syn_imgn.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,15 @@ def test_vis():
python -m core.datasets.lm_syn_imgn dataset_name
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())
test_vis()
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/ycbv_bop_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,14 @@ def test_vis():
python -m core.datasets.ycbv_bop_test dataset_name
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from core.utils.data_utils import read_image_cv2
from lib.vis_utils.image import vis_image_mask_bbox_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())

Expand Down
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/ycbv_d2.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,15 @@ def test_vis():
"dataset_name" can be any pre-registered ones
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())

Expand Down
4 changes: 2 additions & 2 deletions core/gdrn_modeling/datasets/ycbv_pbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@ def test_vis():
python -m core/datasets/ycbv_pbr.py ycbv_pbr_train
"""
from lib.vis_utils.image import grid_show
from lib.utils.setup_logger import setup_my_logger
from lib.utils.setup_logger import setup_logger

import detectron2.data.datasets # noqa # add pre-defined metadata
from lib.vis_utils.image import vis_image_mask_bbox_cv2
from core.utils.utils import get_emb_show
from core.utils.data_utils import read_image_cv2

print("sys.argv:", sys.argv)
logger = setup_my_logger(name="core")
setup_logger()
register_with_name_cfg(sys.argv[1])
print("dataset catalog: ", DatasetCatalog.list())

Expand Down
Loading

0 comments on commit 94fec43

Please sign in to comment.