Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeCamp2023-511] Add new configuration files for FCOS3D #2679

Open
wants to merge 7 commits into
base: dev-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mmdet3d/configs/fcos3d/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Copyright (c) OpenMMLab. All rights reserved.
ZwwWayne marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright (c) OpenMMLab. All rights reserved.
from mmengine.config import read_base

with read_base():
from .._base_.datasets.nus_mono3d import *
from .._base_.models.fcos3d import *
from .._base_.schedules.mmdet_schedule_1x import *
from .._base_.default_runtime import *

from mmcv.ops.modulated_deform_conv import ModulatedDeformConv2dPack as DCNv2
from mmcv.transforms.processing import Resize
from mmengine.optim.scheduler.lr_scheduler import LinearLR, MultiStepLR

from mmdet3d.datasets.transforms.formating import Pack3DDetInputs
from mmdet3d.datasets.transforms.loading import (LoadAnnotations3D,
LoadImageFromFileMono3D)
from mmdet3d.datasets.transforms.transforms_3d import RandomFlip3D
from mmdet3d.models.data_preprocessors import Det3DDataPreprocessor

# model settings
model.update(
dict(
data_preprocessor=dict(
type=Det3DDataPreprocessor,
mean=[103.530, 116.280, 123.675],
std=[1.0, 1.0, 1.0],
bgr_to_rgb=False,
pad_size_divisor=32),
backbone=dict(
dcn=dict(type=DCNv2, deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, False, True, True))))

backend_args = None

train_pipeline = [
dict(type=LoadImageFromFileMono3D, backend_args=backend_args),
dict(
type=LoadAnnotations3D,
with_bbox=True,
with_label=True,
with_attr_label=True,
with_bbox_3d=True,
with_label_3d=True,
with_bbox_depth=True),
dict(type=Resize, scale=(1600, 900), keep_ratio=True),
dict(type=RandomFlip3D, flip_ratio_bev_horizontal=0.5),
dict(
type=Pack3DDetInputs,
keys=[
'img', 'gt_bboxes', 'gt_bboxes_labels', 'attr_labels',
'gt_bboxes_3d', 'gt_labels_3d', 'centers_2d', 'depths'
]),
]

test_pipeline = [
dict(type=LoadImageFromFileMono3D, backend_args=backend_args),
dict(type=Resize, scale_factor=1.0),
dict(type=Pack3DDetInputs, keys=['img'])
]

train_dataloader.update(
dict(batch_size=2, num_workers=2, dataset=dict(pipeline=train_pipeline)))
test_dataloader.update(dict(dataset=dict(pipeline=test_pipeline)))
val_dataloader.update(dict(dataset=dict(pipeline=test_pipeline)))

# optimizer
optim_wrapper.update(
dict(
optimizer=dict(lr=0.002),
paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.),
clip_grad=dict(max_norm=35, norm_type=2)))

# learning rate
param_scheduler = [
dict(
type=LinearLR, start_factor=1.0 / 3, by_epoch=False, begin=0, end=500),
dict(
type=MultiStepLR,
begin=0,
end=12,
by_epoch=True,
milestones=[8, 11],
gamma=0.1)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) OpenMMLab. All rights reserved.
from mmengine.config import read_base

with read_base():
from .fcos3d_r101_caffe_dcn_fpn_head_gn_8xb2_1x_nus_mono3d import *

# model settings
model.update(
dict(
train_cfg=dict(
code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.05, 0.05])))

# optimizer
optim_wrapper.update(dict(optimizer=dict(lr=0.001)))
load_from = 'work_dirs/fcos3d_nus/latest.pth'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this path should be set as None. If user need to modify it, then should add comments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. This path is because the old config file has this line. I will delete it.