-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #985 from openvinotoolkit/ik/move_mmdet_templates
move mmdet templates
- Loading branch information
Showing
171 changed files
with
17,119 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule mmdetection
deleted from
6024bb
57 changes: 57 additions & 0 deletions
57
...ction/configs/custom-counting-instance-seg/efficientnetb2b_maskrcnn/coco_data_pipeline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
dataset_type = 'CocoDataset' | ||
img_size = (1024, 1024) | ||
|
||
img_norm_cfg = dict( | ||
mean=(103.53, 116.28, 123.675), std=(1.0, 1.0, 1.0), to_rgb=False) | ||
|
||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='LoadAnnotations', with_bbox=True, | ||
with_mask=True, poly2mask=False), | ||
dict(type='Resize', img_scale=img_size, keep_ratio=False), | ||
dict(type='RandomFlip', flip_ratio=0.5), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='Pad', size_divisor=32), | ||
dict(type='DefaultFormatBundle'), | ||
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']) | ||
] | ||
|
||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='MultiScaleFlipAug', | ||
img_scale=img_size, | ||
flip=False, | ||
transforms=[ | ||
dict(type='Resize', keep_ratio=False), | ||
dict(type='RandomFlip'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='Pad', size_divisor=32), | ||
dict(type='ImageToTensor', keys=['img']), | ||
dict(type='Collect', keys=['img']) | ||
]) | ||
] | ||
|
||
data = dict(samples_per_gpu=4, | ||
workers_per_gpu=2, | ||
train=dict( | ||
type='RepeatDataset', | ||
adaptive_repeat_times=True, | ||
times=1, | ||
dataset=dict( | ||
type=dataset_type, | ||
ann_file='data/coco/annotations/instances_train2017.json', | ||
img_prefix='data/coco/train2017', | ||
pipeline=train_pipeline)), | ||
val=dict( | ||
type=dataset_type, | ||
test_mode=True, | ||
ann_file='data/coco/annotations/instances_val2017.json', | ||
img_prefix='data/coco/val2017', | ||
pipeline=test_pipeline), | ||
test=dict( | ||
type=dataset_type, | ||
test_mode=True, | ||
ann_file='data/coco/annotations/instances_val2017.json', | ||
img_prefix='data/coco/val2017', | ||
pipeline=test_pipeline)) |
43 changes: 43 additions & 0 deletions
43
...ion/configs/custom-counting-instance-seg/efficientnetb2b_maskrcnn/compression_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"base": { | ||
"find_unused_parameters": true, | ||
"nncf_config": { | ||
"target_metric_name": "mAP", | ||
"input_info": { | ||
"sample_size": [1, 3, 1024, 1024] | ||
}, | ||
"compression": [], | ||
"log_dir": "." | ||
} | ||
}, | ||
"nncf_quantization": { | ||
"optimizer": { | ||
"lr": 0.0005 | ||
}, | ||
"nncf_config": { | ||
"compression": [ | ||
{ | ||
"algorithm": "quantization", | ||
"initializer": { | ||
"range": { | ||
"num_init_samples": 1000 | ||
}, | ||
"batchnorm_adaptation": { | ||
"num_bn_adaptation_samples": 1000 | ||
} | ||
} | ||
} | ||
], | ||
"accuracy_aware_training": { | ||
"mode": "early_exit", | ||
"params": { | ||
"maximal_absolute_accuracy_degradation": 0.01, | ||
"maximal_total_epochs": 20 | ||
} | ||
} | ||
} | ||
}, | ||
"order_of_parts": [ | ||
"nncf_quantization" | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
...mmdetection/configs/custom-counting-instance-seg/efficientnetb2b_maskrcnn/hpo_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
metric: mAP | ||
search_algorithm: smbo | ||
early_stop: None | ||
hp_space: | ||
learning_parameters.learning_rate: | ||
param_type: quniform | ||
range: | ||
- 0.001 | ||
- 0.1 | ||
- 0.001 | ||
learning_parameters.batch_size: | ||
param_type: qloguniform | ||
range: | ||
- 2 | ||
- 4 | ||
- 2 |
160 changes: 160 additions & 0 deletions
160
external/mmdetection/configs/custom-counting-instance-seg/efficientnetb2b_maskrcnn/model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
_base_ = [ | ||
'./coco_data_pipeline.py' | ||
] | ||
|
||
model = dict( | ||
type='MaskRCNN', | ||
backbone=dict( | ||
type='efficientnet_b2b', | ||
out_indices=(2, 3, 4, 5), | ||
frozen_stages=-1, | ||
pretrained=True, | ||
activation_cfg=dict(type='torch_swish'), | ||
norm_cfg=dict(type='BN', requires_grad=True)), | ||
neck=dict( | ||
type='FPN', | ||
in_channels=[24, 48, 120, 352], | ||
out_channels=80, | ||
num_outs=5), | ||
rpn_head=dict( | ||
type='RPNHead', | ||
in_channels=80, | ||
feat_channels=80, | ||
anchor_generator=dict( | ||
type='AnchorGenerator', | ||
scales=[8], | ||
ratios=[0.5, 1.0, 2.0], | ||
strides=[4, 8, 16, 32, 64]), | ||
bbox_coder=dict( | ||
type='DeltaXYWHBBoxCoder', | ||
target_means=[0.0, 0.0, 0.0, 0.0], | ||
target_stds=[1.0, 1.0, 1.0, 1.0]), | ||
loss_cls=dict( | ||
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), | ||
loss_bbox=dict(type='L1Loss', loss_weight=1.0)), | ||
roi_head=dict( | ||
type='StandardRoIHead', | ||
bbox_roi_extractor=dict( | ||
type='SingleRoIExtractor', | ||
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), | ||
out_channels=80, | ||
featmap_strides=[4, 8, 16, 32]), | ||
bbox_head=dict( | ||
type='Shared2FCBBoxHead', | ||
in_channels=80, | ||
fc_out_channels=1024, | ||
roi_feat_size=7, | ||
num_classes=80, | ||
bbox_coder=dict( | ||
type='DeltaXYWHBBoxCoder', | ||
target_means=[0.0, 0.0, 0.0, 0.0], | ||
target_stds=[0.1, 0.1, 0.2, 0.2]), | ||
reg_class_agnostic=False, | ||
loss_cls=dict( | ||
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), | ||
loss_bbox=dict(type='L1Loss', loss_weight=1.0)), | ||
mask_roi_extractor=dict( | ||
type='SingleRoIExtractor', | ||
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0), | ||
out_channels=80, | ||
featmap_strides=[4, 8, 16, 32]), | ||
mask_head=dict( | ||
type='FCNMaskHead', | ||
num_convs=4, | ||
in_channels=80, | ||
conv_out_channels=80, | ||
num_classes=80, | ||
loss_mask=dict( | ||
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))), | ||
train_cfg=dict( | ||
rpn=dict( | ||
assigner=dict( | ||
type='MaxIoUAssigner', | ||
pos_iou_thr=0.7, | ||
neg_iou_thr=0.3, | ||
min_pos_iou=0.3, | ||
match_low_quality=True, | ||
ignore_iof_thr=-1, | ||
gpu_assign_thr=300), | ||
sampler=dict( | ||
type='RandomSampler', | ||
num=256, | ||
pos_fraction=0.5, | ||
neg_pos_ub=-1, | ||
add_gt_as_proposals=False), | ||
allowed_border=-1, | ||
pos_weight=-1, | ||
debug=False), | ||
rpn_proposal=dict( | ||
nms_across_levels=False, | ||
nms_pre=2000, | ||
nms_post=1000, | ||
max_num=1000, | ||
nms_thr=0.8, | ||
min_bbox_size=0), | ||
rcnn=dict( | ||
assigner=dict( | ||
type='MaxIoUAssigner', | ||
pos_iou_thr=0.5, | ||
neg_iou_thr=0.5, | ||
min_pos_iou=0.5, | ||
match_low_quality=True, | ||
ignore_iof_thr=-1, | ||
gpu_assign_thr=300), | ||
sampler=dict( | ||
type='RandomSampler', | ||
num=256, | ||
pos_fraction=0.25, | ||
neg_pos_ub=-1, | ||
add_gt_as_proposals=True), | ||
mask_size=28, | ||
pos_weight=-1, | ||
debug=False)), | ||
test_cfg=dict( | ||
rpn=dict( | ||
nms_across_levels=False, | ||
nms_pre=800, | ||
nms_post=500, | ||
max_num=500, | ||
nms_thr=0.8, | ||
min_bbox_size=0), | ||
rcnn=dict( | ||
score_thr=0.05, | ||
nms=dict(type='nms', iou_threshold=0.7), | ||
max_per_img=500, | ||
mask_thr_binary=0.5))) | ||
|
||
cudnn_benchmark = True | ||
evaluation = dict(interval=1, metric='mAP', save_best='mAP', iou_thr=[0.5 , 0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.9, 0.95]) | ||
optimizer = dict(type='SGD', lr=0.015, momentum=0.9, weight_decay=0.0001) | ||
optimizer_config = dict(grad_clip=None) | ||
lr_config = dict( | ||
policy='ReduceLROnPlateau', | ||
metric='mAP', | ||
patience=5, | ||
iteration_patience=300, | ||
interval=1, | ||
min_lr=0.000001, | ||
warmup='linear', | ||
warmup_iters=200, | ||
warmup_ratio=0.3333333333333333 | ||
) | ||
runner = dict(type='EpochRunnerWithCancel', max_epochs=300) | ||
checkpoint_config = dict(interval=5) | ||
log_config = dict( | ||
interval=1, | ||
hooks=[ | ||
dict(type='TextLoggerHook'), | ||
# dict(type='TensorboardLoggerHook'), | ||
]) | ||
dist_params = dict(backend='nccl') | ||
log_level = 'INFO' | ||
load_from = 'https://storage.openvinotoolkit.org/repositories/openvino_training_extensions/models/instance_segmentation/v2/efficientnet_b2b-mask_rcnn-576x576.pth' | ||
resume_from = None | ||
workflow = [('train', 1)] | ||
work_dir = 'output' | ||
custom_hooks = [ | ||
dict(type='EarlyStoppingHook', patience=10, metric='mAP', | ||
interval=1, priority=75, iteration_patience=0), | ||
] | ||
fp16 = dict(loss_scale=512.) |
52 changes: 52 additions & 0 deletions
52
...l/mmdetection/configs/custom-counting-instance-seg/efficientnetb2b_maskrcnn/template.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Description. | ||
model_template_id: Custom_Counting_Instance_Segmentation_MaskRCNN_EfficientNetB2B | ||
name: MaskRCNN-EfficientNetB2B | ||
task_type: INSTANCE_SEGMENTATION | ||
task_family: VISION | ||
instantiation: "CLASS" | ||
summary: Counting algorithm provides counting of objects and object instance masks. This model is based on MaskRCNN-EfficientNetB2B which is faster in training and inference but less accurate. | ||
application: ~ | ||
|
||
# Algo backend. | ||
framework: OTEDetection v2.9.1 | ||
|
||
# Task implementations. | ||
entrypoints: | ||
base: detection_tasks.apis.detection.OTEDetectionTrainingTask | ||
openvino: detection_tasks.apis.detection.OpenVINODetectionTask | ||
nncf: detection_tasks.apis.detection.OTEDetectionNNCFTask | ||
|
||
# Capabilities. | ||
capabilities: | ||
- compute_representations | ||
|
||
# Hyperparameters. | ||
hyper_parameters: | ||
base_path: ../../../../mmdetection/detection_tasks/apis/detection/configuration.yaml | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 4 | ||
learning_rate: | ||
default_value: 0.015 | ||
learning_rate_warmup_iters: | ||
default_value: 200 | ||
num_iters: | ||
default_value: 300 | ||
nncf_optimization: | ||
enable_quantization: | ||
default_value: true | ||
enable_pruning: | ||
default_value: false | ||
maximal_accuracy_degradation: | ||
default_value: 1.0 | ||
|
||
# Training resources. | ||
max_nodes: 1 | ||
training_targets: | ||
- GPU | ||
- CPU | ||
|
||
# Stats. | ||
gigaflops: 68.48 | ||
size: 13.27 |
Oops, something went wrong.