Skip to content

Commit bc29584

Browse files
authored
[Docs] Update Config Doc to Add WandB Hook (#8663)
* logger hooks samples updated * [Docs] MMDetWandB LoggerHook Details Added * [Docs] lint test passed
1 parent df0694c commit bc29584

File tree

2 files changed

+161
-150
lines changed

2 files changed

+161
-150
lines changed

Diff for: docs/en/tutorials/config.md

+81-75
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ The `train_cfg` and `test_cfg` are deprecated in config file, please specify the
7171
```python
7272
# deprecated
7373
model = dict(
74-
type=...,
75-
...
74+
type=...,
75+
...
7676
)
7777
train_cfg=dict(...)
7878
test_cfg=dict(...)
@@ -83,10 +83,10 @@ The migration example is as below.
8383
```python
8484
# recommended
8585
model = dict(
86-
type=...,
87-
...
88-
train_cfg=dict(...),
89-
test_cfg=dict(...),
86+
type=...,
87+
...
88+
train_cfg=dict(...),
89+
test_cfg=dict(...),
9090
)
9191
```
9292

@@ -109,8 +109,8 @@ model = dict(
109109
type='BN', # Type of norm layer, usually it is BN or GN
110110
requires_grad=True), # Whether to train the gamma and beta in BN
111111
norm_eval=True, # Whether to freeze the statistics in BN
112-
style='pytorch' # The style of backbone, 'pytorch' means that stride 2 layers are in 3x3 conv, 'caffe' means stride 2 layers are in 1x1 convs.
113-
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), # The ImageNet pretrained backbone to be loaded
112+
style='pytorch', # The style of backbone, 'pytorch' means that stride 2 layers are in 3x3 conv, 'caffe' means stride 2 layers are in 1x1 convs.
113+
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), # The ImageNet pretrained backbone to be loaded
114114
neck=dict(
115115
type='FPN', # The neck of detector is FPN. We also support 'NASFPN', 'PAFPN', etc. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/models/necks/fpn.py#L10 for more details.
116116
in_channels=[256, 512, 1024, 2048], # The input channels, this is consistent with the output channels of backbone
@@ -182,70 +182,70 @@ model = dict(
182182
type='CrossEntropyLoss', # Type of loss used for segmentation
183183
use_mask=True, # Whether to only train the mask in the correct class.
184184
loss_weight=1.0)))) # Loss weight of mask branch.
185-
train_cfg = dict( # Config of training hyperparameters for rpn and rcnn
186-
rpn=dict( # Training config of rpn
187-
assigner=dict( # Config of assigner
188-
type='MaxIoUAssigner', # Type of assigner, MaxIoUAssigner is used for many common detectors. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/assigners/max_iou_assigner.py#L10 for more details.
189-
pos_iou_thr=0.7, # IoU >= threshold 0.7 will be taken as positive samples
190-
neg_iou_thr=0.3, # IoU < threshold 0.3 will be taken as negative samples
191-
min_pos_iou=0.3, # The minimal IoU threshold to take boxes as positive samples
192-
match_low_quality=True, # Whether to match the boxes under low quality (see API doc for more details).
193-
ignore_iof_thr=-1), # IoF threshold for ignoring bboxes
194-
sampler=dict( # Config of positive/negative sampler
195-
type='RandomSampler', # Type of sampler, PseudoSampler and other samplers are also supported. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/samplers/random_sampler.py#L8 for implementation details.
196-
num=256, # Number of samples
197-
pos_fraction=0.5, # The ratio of positive samples in the total samples.
198-
neg_pos_ub=-1, # The upper bound of negative samples based on the number of positive samples.
199-
add_gt_as_proposals=False), # Whether add GT as proposals after sampling.
200-
allowed_border=-1, # The border allowed after padding for valid anchors.
201-
pos_weight=-1, # The weight of positive samples during training.
202-
debug=False), # Whether to set the debug mode
203-
rpn_proposal=dict( # The config to generate proposals during training
204-
nms_across_levels=False, # Whether to do NMS for boxes across levels. Only work in `GARPNHead`, naive rpn does not support do nms cross levels.
205-
nms_pre=2000, # The number of boxes before NMS
206-
nms_post=1000, # The number of boxes to be kept by NMS, Only work in `GARPNHead`.
207-
max_per_img=1000, # The number of boxes to be kept after NMS.
208-
nms=dict( # Config of NMS
209-
type='nms', # Type of NMS
210-
iou_threshold=0.7 # NMS threshold
211-
),
212-
min_bbox_size=0), # The allowed minimal box size
213-
rcnn=dict( # The config for the roi heads.
214-
assigner=dict( # Config of assigner for second stage, this is different for that in rpn
215-
type='MaxIoUAssigner', # Type of assigner, MaxIoUAssigner is used for all roi_heads for now. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/assigners/max_iou_assigner.py#L10 for more details.
216-
pos_iou_thr=0.5, # IoU >= threshold 0.5 will be taken as positive samples
217-
neg_iou_thr=0.5, # IoU < threshold 0.5 will be taken as negative samples
218-
min_pos_iou=0.5, # The minimal IoU threshold to take boxes as positive samples
219-
match_low_quality=False, # Whether to match the boxes under low quality (see API doc for more details).
220-
ignore_iof_thr=-1), # IoF threshold for ignoring bboxes
221-
sampler=dict(
222-
type='RandomSampler', # Type of sampler, PseudoSampler and other samplers are also supported. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/samplers/random_sampler.py#L8 for implementation details.
223-
num=512, # Number of samples
224-
pos_fraction=0.25, # The ratio of positive samples in the total samples.
225-
neg_pos_ub=-1, # The upper bound of negative samples based on the number of positive samples.
226-
add_gt_as_proposals=True
227-
), # Whether add GT as proposals after sampling.
228-
mask_size=28, # Size of mask
229-
pos_weight=-1, # The weight of positive samples during training.
230-
debug=False)) # Whether to set the debug mode
231-
test_cfg = dict( # Config for testing hyperparameters for rpn and rcnn
232-
rpn=dict( # The config to generate proposals during testing
233-
nms_across_levels=False, # Whether to do NMS for boxes across levels. Only work in `GARPNHead`, naive rpn does not support do nms cross levels.
234-
nms_pre=1000, # The number of boxes before NMS
235-
nms_post=1000, # The number of boxes to be kept by NMS, Only work in `GARPNHead`.
236-
max_per_img=1000, # The number of boxes to be kept after NMS.
237-
nms=dict( # Config of NMS
238-
type='nms', #Type of NMS
239-
iou_threshold=0.7 # NMS threshold
240-
),
241-
min_bbox_size=0), # The allowed minimal box size
242-
rcnn=dict( # The config for the roi heads.
243-
score_thr=0.05, # Threshold to filter out boxes
244-
nms=dict( # Config of NMS in the second stage
245-
type='nms', # Type of NMS
246-
iou_thr=0.5), # NMS threshold
247-
max_per_img=100, # Max number of detections of each image
248-
mask_thr_binary=0.5)) # Threshold of mask prediction
185+
train_cfg = dict( # Config of training hyperparameters for rpn and rcnn
186+
rpn=dict( # Training config of rpn
187+
assigner=dict( # Config of assigner
188+
type='MaxIoUAssigner', # Type of assigner, MaxIoUAssigner is used for many common detectors. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/assigners/max_iou_assigner.py#L10 for more details.
189+
pos_iou_thr=0.7, # IoU >= threshold 0.7 will be taken as positive samples
190+
neg_iou_thr=0.3, # IoU < threshold 0.3 will be taken as negative samples
191+
min_pos_iou=0.3, # The minimal IoU threshold to take boxes as positive samples
192+
match_low_quality=True, # Whether to match the boxes under low quality (see API doc for more details).
193+
ignore_iof_thr=-1), # IoF threshold for ignoring bboxes
194+
sampler=dict( # Config of positive/negative sampler
195+
type='RandomSampler', # Type of sampler, PseudoSampler and other samplers are also supported. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/samplers/random_sampler.py#L8 for implementation details.
196+
num=256, # Number of samples
197+
pos_fraction=0.5, # The ratio of positive samples in the total samples.
198+
neg_pos_ub=-1, # The upper bound of negative samples based on the number of positive samples.
199+
add_gt_as_proposals=False), # Whether add GT as proposals after sampling.
200+
allowed_border=-1, # The border allowed after padding for valid anchors.
201+
pos_weight=-1, # The weight of positive samples during training.
202+
debug=False), # Whether to set the debug mode
203+
rpn_proposal=dict( # The config to generate proposals during training
204+
nms_across_levels=False, # Whether to do NMS for boxes across levels. Only work in `GARPNHead`, naive rpn does not support do nms cross levels.
205+
nms_pre=2000, # The number of boxes before NMS
206+
nms_post=1000, # The number of boxes to be kept by NMS, Only work in `GARPNHead`.
207+
max_per_img=1000, # The number of boxes to be kept after NMS.
208+
nms=dict( # Config of NMS
209+
type='nms', # Type of NMS
210+
iou_threshold=0.7 # NMS threshold
211+
),
212+
min_bbox_size=0), # The allowed minimal box size
213+
rcnn=dict( # The config for the roi heads.
214+
assigner=dict( # Config of assigner for second stage, this is different for that in rpn
215+
type='MaxIoUAssigner', # Type of assigner, MaxIoUAssigner is used for all roi_heads for now. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/assigners/max_iou_assigner.py#L10 for more details.
216+
pos_iou_thr=0.5, # IoU >= threshold 0.5 will be taken as positive samples
217+
neg_iou_thr=0.5, # IoU < threshold 0.5 will be taken as negative samples
218+
min_pos_iou=0.5, # The minimal IoU threshold to take boxes as positive samples
219+
match_low_quality=False, # Whether to match the boxes under low quality (see API doc for more details).
220+
ignore_iof_thr=-1), # IoF threshold for ignoring bboxes
221+
sampler=dict(
222+
type='RandomSampler', # Type of sampler, PseudoSampler and other samplers are also supported. Refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/bbox/samplers/random_sampler.py#L8 for implementation details.
223+
num=512, # Number of samples
224+
pos_fraction=0.25, # The ratio of positive samples in the total samples.
225+
neg_pos_ub=-1, # The upper bound of negative samples based on the number of positive samples.
226+
add_gt_as_proposals=True
227+
), # Whether add GT as proposals after sampling.
228+
mask_size=28, # Size of mask
229+
pos_weight=-1, # The weight of positive samples during training.
230+
debug=False)) # Whether to set the debug mode
231+
test_cfg = dict( # Config for testing hyperparameters for rpn and rcnn
232+
rpn=dict( # The config to generate proposals during testing
233+
nms_across_levels=False, # Whether to do NMS for boxes across levels. Only work in `GARPNHead`, naive rpn does not support do nms cross levels.
234+
nms_pre=1000, # The number of boxes before NMS
235+
nms_post=1000, # The number of boxes to be kept by NMS, Only work in `GARPNHead`.
236+
max_per_img=1000, # The number of boxes to be kept after NMS.
237+
nms=dict( # Config of NMS
238+
type='nms', #Type of NMS
239+
iou_threshold=0.7 # NMS threshold
240+
),
241+
min_bbox_size=0), # The allowed minimal box size
242+
rcnn=dict( # The config for the roi heads.
243+
score_thr=0.05, # Threshold to filter out boxes
244+
nms=dict( # Config of NMS in the second stage
245+
type='nms', # Type of NMS
246+
iou_thr=0.5), # NMS threshold
247+
max_per_img=100, # Max number of detections of each image
248+
mask_thr_binary=0.5)) # Threshold of mask prediction
249249
dataset_type = 'CocoDataset' # Dataset type, this will be used to define the dataset
250250
data_root = 'data/coco/' # Root path of data
251251
img_norm_cfg = dict( # Image normalization config to normalize the input images
@@ -381,7 +381,7 @@ data = dict(
381381
])
382382
],
383383
samples_per_gpu=2 # Batch size of a single GPU used in testing
384-
))
384+
))
385385
evaluation = dict( # The config to build the evaluation hook, refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/evaluation/eval_hooks.py#L7 for more details.
386386
interval=1, # Evaluation interval
387387
metric=['bbox', 'segm']) # Metrics used during evaluation
@@ -407,9 +407,15 @@ checkpoint_config = dict( # Config to set the checkpoint hook, Refer to https:/
407407
log_config = dict( # config to register logger hook
408408
interval=50, # Interval to print the log
409409
hooks=[
410-
# dict(type='TensorboardLoggerHook') # The Tensorboard logger is also supported
411-
dict(type='TextLoggerHook')
410+
dict(type='TextLoggerHook', by_epoch=False),
411+
dict(type='TensorboardLoggerHook', by_epoch=False),
412+
dict(type='MMDetWandbHook', by_epoch=False, # The Wandb logger is also supported, It requires `wandb` to be installed.
413+
init_kwargs={'entity': "OpenMMLab", # The entity used to log on Wandb
414+
'project': "MMDet", # Project name in WandB
415+
'config': cfg_dict}), # Check https://docs.wandb.ai/ref/python/init for more init arguments.
416+
# MMDetWandbHook is mmdet implementation of WandbLoggerHook. ClearMLLoggerHook, DvcliveLoggerHook, MlflowLoggerHook, NeptuneLoggerHook, PaviLoggerHook, SegmindLoggerHook are also supported based on MMCV implementation.
412417
]) # The logger used to record the training process.
418+
413419
dist_params = dict(backend='nccl') # Parameters to setup distributed training, the port can also be set.
414420
log_level = 'INFO' # The level of logging.
415421
load_from = None # load models as a pre-trained model from a given path. This will not resume training.

0 commit comments

Comments
 (0)