Skip to content

Commit d148120

Browse files
authored
sacred config for faster rcnn (#1358)
* move rcnn forward backward task to model zoo * revert #1249 * fix * fix * docstring * fix style * add docs * faster rcnn estimator * refactor * move dataset to init * lint * merge * disable sacred config for now * logger fix * fix fit * autogluon integration * fix small bug. training working * lint * sacred config for faster rcnn
1 parent 3816689 commit d148120

File tree

5 files changed

+198
-365
lines changed

5 files changed

+198
-365
lines changed

gluoncv/pipelines/estimators/base_estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __getitem__(self, key):
9595

9696
class BaseEstimator:
9797
def __init__(self, config, logger=None):
98-
self._log = logger if logger is not None else logging.getLogger(__name__)
98+
self._logger = logger if logger is not None else logging.getLogger(__name__)
9999

100100
# finalize the config
101101
r = self._ex.run('_get_config', config_updates=config, options={'--loglevel': 50})
@@ -105,7 +105,7 @@ def __init__(self, config, logger=None):
105105
logdir = r.config.get('logdir', None)
106106
self._logdir = os.path.abspath(logdir) if logdir else os.getcwd()
107107
config_file = os.path.join(self._logdir, config_fn)
108-
save_config(r.config, self._log, config_file)
108+
save_config(r.config, self._logger, config_file)
109109
self._cfg = DotDict(r.config)
110110
self._cfg.freeze()
111111
_random.seed(self._cfg.seed)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
"""R-CNN Estimator implementations"""
22

33
from .faster_rcnn import FasterRCNNEstimator
4+
from .default import ex
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
from sacred import Experiment, Ingredient
2+
3+
faster_rcnn = Ingredient('faster_rcnn')
4+
train_hp = Ingredient('train_hp')
5+
valid_hp = Ingredient('valid_hp')
6+
7+
8+
@faster_rcnn.config
9+
def faster_rcnn_default():
10+
network = 'resnet50_v1b' # base feature network
11+
dataset = 'voc' # dataset
12+
nms_thresh = 0.5
13+
nms_topk = -1
14+
post_nms = -1
15+
roi_mode = 'align'
16+
roi_size = (7, 7)
17+
strides = (4, 8, 16, 32, 64)
18+
clip = 4.14
19+
rpn_channel = 256
20+
anchor_base_size = 16
21+
anchor_aspect_ratio = (0.5, 1, 2)
22+
anchor_scales = (2, 4, 8, 16, 32)
23+
anchor_alloc_size = (384, 384)
24+
rpn_nms_thresh = 0.7
25+
max_num_gt = 100
26+
gpus = (0, 1, 2, 3, 4, 5, 6, 7)
27+
norm_layer = None
28+
use_fpn = True
29+
custom_model = True
30+
num_fpn_filters = 256
31+
num_box_head_conv = 4
32+
num_box_head_conv_filters = 256
33+
num_box_head_dense_filters = 1024
34+
image_short = 800
35+
image_max_size = 1333
36+
amp = False
37+
static_alloc = False
38+
39+
40+
@train_hp.config
41+
def train_cfg():
42+
pretrained_base = True # whether load the imagenet pre-trained base
43+
batch_size = 16
44+
start_epoch = 0
45+
epochs = 26
46+
lr = 0.01 # learning rate
47+
lr_decay = 0.1 # decay rate of learning rate.
48+
lr_decay_epoch = (20, 24) # epochs at which learning rate decays
49+
lr_mode = 'step' # learning rate scheduler mode. options are step, poly and cosine
50+
lr_warmup = 500 # number of iterations for warmup.
51+
lr_warmup_factor = 1. / 3. # starging lr warmup factor.
52+
momentum = 0.9 # momentum
53+
wd = 1e-4 # weight decay
54+
log_interval = 100 # log interval
55+
seed = 233
56+
verbose = False
57+
mixup = False
58+
no_mixup_epochs = 20
59+
rpn_smoothl1_rho = 0.001
60+
rcnn_smoothl1_rho = 0.001
61+
horovod = False
62+
no_pretrained_base = False
63+
rpn_train_pre_nms = 12000
64+
rpn_train_post_nms = 2000
65+
rpn_min_size = 1
66+
rcnn_num_samples = 512
67+
rcnn_pos_iou_thresh = 0.5
68+
rcnn_pos_ratio = 0.25
69+
executor_threads = 4
70+
71+
72+
@valid_hp.config
73+
def valid_cfg():
74+
rpn_test_pre_nms = 6000
75+
rpn_test_post_nms = 1000
76+
val_interval = 1 # Epoch interval for validation
77+
78+
79+
ex = Experiment('faster_rcnn_default', ingredients=[train_hp, valid_hp, faster_rcnn])
80+
81+
82+
@ex.config
83+
def default_configs():
84+
dataset = 'coco'
85+
resume = ''
86+
save_prefix = ''
87+
save_interval = 1 # save interval in epoch
88+
horovod = False
89+
num_workers = 16
90+
kv_store = 'nccl'
91+
disable_hybridization = False
92+

0 commit comments

Comments
 (0)