Skip to content

sacred config for faster rcnn #1358

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

Merged
merged 25 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
sacred config for faster rcnn
  • Loading branch information
Jerryzcn committed Jul 8, 2020
commit 3bc987fbf8fce11d72b16b8b0b41fcdbdd4edada
4 changes: 2 additions & 2 deletions gluoncv/pipelines/estimators/base_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __getitem__(self, key):

class BaseEstimator:
def __init__(self, config, logger=None):
self._log = logger if logger is not None else logging.getLogger(__name__)
self._logger = logger if logger is not None else logging.getLogger(__name__)

# finalize the config
r = self._ex.run('_get_config', config_updates=config, options={'--loglevel': 50})
Expand All @@ -105,7 +105,7 @@ def __init__(self, config, logger=None):
logdir = r.config.get('logdir', None)
self._logdir = os.path.abspath(logdir) if logdir else os.getcwd()
config_file = os.path.join(self._logdir, config_fn)
save_config(r.config, self._log, config_file)
save_config(r.config, self._logger, config_file)
self._cfg = DotDict(r.config)
self._cfg.freeze()
_random.seed(self._cfg.seed)
Expand Down
1 change: 1 addition & 0 deletions gluoncv/pipelines/estimators/rcnn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""R-CNN Estimator implementations"""

from .faster_rcnn import FasterRCNNEstimator
from .default import ex
92 changes: 92 additions & 0 deletions gluoncv/pipelines/estimators/rcnn/default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
from sacred import Experiment, Ingredient

faster_rcnn = Ingredient('faster_rcnn')
train_hp = Ingredient('train_hp')
valid_hp = Ingredient('valid_hp')


@faster_rcnn.config
def faster_rcnn_default():
network = 'resnet50_v1b' # base feature network
dataset = 'voc' # dataset
nms_thresh = 0.5
nms_topk = -1
post_nms = -1
roi_mode = 'align'
roi_size = (7, 7)
strides = (4, 8, 16, 32, 64)
clip = 4.14
rpn_channel = 256
anchor_base_size = 16
anchor_aspect_ratio = (0.5, 1, 2)
anchor_scales = (2, 4, 8, 16, 32)
anchor_alloc_size = (384, 384)
rpn_nms_thresh = 0.7
max_num_gt = 100
gpus = (0, 1, 2, 3, 4, 5, 6, 7)
norm_layer = None
use_fpn = True
custom_model = True
num_fpn_filters = 256
num_box_head_conv = 4
num_box_head_conv_filters = 256
num_box_head_dense_filters = 1024
image_short = 800
image_max_size = 1333
amp = False
static_alloc = False


@train_hp.config
def train_cfg():
pretrained_base = True # whether load the imagenet pre-trained base
batch_size = 16
start_epoch = 0
epochs = 26
lr = 0.01 # learning rate
lr_decay = 0.1 # decay rate of learning rate.
lr_decay_epoch = (20, 24) # epochs at which learning rate decays
lr_mode = 'step' # learning rate scheduler mode. options are step, poly and cosine
lr_warmup = 500 # number of iterations for warmup.
lr_warmup_factor = 1. / 3. # starging lr warmup factor.
momentum = 0.9 # momentum
wd = 1e-4 # weight decay
log_interval = 100 # log interval
seed = 233
verbose = False
mixup = False
no_mixup_epochs = 20
rpn_smoothl1_rho = 0.001
rcnn_smoothl1_rho = 0.001
horovod = False
no_pretrained_base = False
rpn_train_pre_nms = 12000
rpn_train_post_nms = 2000
rpn_min_size = 1
rcnn_num_samples = 512
rcnn_pos_iou_thresh = 0.5
rcnn_pos_ratio = 0.25
executor_threads = 4


@valid_hp.config
def valid_cfg():
rpn_test_pre_nms = 6000
rpn_test_post_nms = 1000
val_interval = 1 # Epoch interval for validation


ex = Experiment('faster_rcnn_default', ingredients=[train_hp, valid_hp, faster_rcnn])


@ex.config
def default_configs():
dataset = 'coco'
resume = ''
save_prefix = ''
save_interval = 1 # save interval in epoch
horovod = False
num_workers = 16
kv_store = 'nccl'
disable_hybridization = False

Loading