-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MPA] Enable SSD and YOLOX model template (#1156)
* Changes for SC integration for detection tasks * Add SSD, YOLOX to mpa, and SC integration * Change submodules for YOLOX enable * Change default task op as REPLACE * Change default temlates in mmdetection * Bug fifor YOLOX enable both mpa and ote * Change hyperparams for training small dataset * Rebuildsubmodule * Rebuild submodule * Change learning schedules * Change ote_sdk requirements.txt * Remove template.yaml * Unification of recipe * Change mpa submodule * Modification for flake8 test * Change mpa submodule * Add VfNet * Commit for changed mpa submodule * Change mpa submodule and remove remark
- Loading branch information
1 parent
29ea726
commit ace7a78
Showing
9 changed files
with
222 additions
and
3 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
.../model-preparation-algorithm/configs/detection/cspdarknet_yolox_cls_incr/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,74 @@ | ||
dataset_type = 'CocoDataset' | ||
data_root = 'data/coco/' | ||
samples_per_gpu = 2 | ||
img_norm_cfg = dict( | ||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) | ||
img_scale = (640, 640) | ||
|
||
train_pipeline = [ | ||
dict(type='Mosaic', img_scale=img_scale, pad_val=114.0), | ||
dict( | ||
type='RandomAffine', | ||
scaling_ratio_range=(0.5, 1.5), | ||
border=(-img_scale[0] // 2, -img_scale[1] // 2)), | ||
dict( | ||
type='PhotoMetricDistortion', | ||
brightness_delta=32, | ||
contrast_range=(0.5, 1.5), | ||
saturation_range=(0.5, 1.5), | ||
hue_delta=18), | ||
dict(type='RandomFlip', flip_ratio=0.5), | ||
dict(type='Resize', keep_ratio=True), | ||
dict(type='Pad', pad_to_square=True, pad_val=114.0), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='DefaultFormatBundle'), | ||
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) | ||
] | ||
|
||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='MultiScaleFlipAug', | ||
img_scale=(416, 416), | ||
flip=False, | ||
transforms=[ | ||
dict(type='Resize', keep_ratio=False), | ||
dict(type='RandomFlip'), | ||
dict(type='Pad', size=(416, 416), pad_val=114.0), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='DefaultFormatBundle'), | ||
dict(type='Collect', keys=['img']) | ||
]) | ||
] | ||
|
||
data = dict( | ||
samples_per_gpu=samples_per_gpu, | ||
workers_per_gpu=4, | ||
num_classes=2, | ||
train=dict( | ||
type='MultiImageMixDataset', | ||
dataset=dict( | ||
type=dataset_type, | ||
ann_file=data_root + 'annotations/instances_train2017.json', | ||
img_prefix=data_root + 'train2017/', | ||
pipeline=[ | ||
dict(type='LoadImageFromFile', to_float32=True), | ||
dict(type='LoadAnnotations', with_bbox=True) | ||
], | ||
), | ||
pipeline=train_pipeline, | ||
dynamic_scale=img_scale, | ||
), | ||
val=dict( | ||
type=dataset_type, | ||
ann_file=data_root + 'annotations/instances_val2017.json', | ||
img_prefix=data_root + 'val2017/', | ||
test_mode=True, | ||
pipeline=test_pipeline), | ||
test=dict( | ||
type=dataset_type, | ||
ann_file=data_root + 'annotations/instances_val2017.json', | ||
img_prefix=data_root + 'val2017/', | ||
test_mode=True, | ||
pipeline=test_pipeline) | ||
) |
16 changes: 16 additions & 0 deletions
16
...l/model-preparation-algorithm/configs/detection/cspdarknet_yolox_cls_incr/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: | ||
- 4 | ||
- 8 | ||
- 2 |
3 changes: 3 additions & 0 deletions
3
external/model-preparation-algorithm/configs/detection/cspdarknet_yolox_cls_incr/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,3 @@ | ||
_base_ = [ | ||
'../../../submodule/recipes/stages/_base_/models/detectors/yolox.custom.py' | ||
] |
51 changes: 51 additions & 0 deletions
51
...paration-algorithm/configs/detection/cspdarknet_yolox_cls_incr/template_experimental.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,51 @@ | ||
# Description. | ||
model_template_id: ClassIncremental_Object_Detection_YOLOX | ||
name: YOLOX-ClsIncr | ||
task_type: DETECTION | ||
task_family: VISION | ||
instantiation: "CLASS" | ||
summary: Class-Incremental Object Detection for YOLOX | ||
application: ~ | ||
|
||
# Algo backend. | ||
framework: MPA v1.1.0 | ||
|
||
# Task implementations. | ||
entrypoints: | ||
base: mpa_tasks.apis.detection.DetectionTrainTask | ||
openvino: detection_tasks.apis.detection.OpenVINODetectionTask | ||
|
||
# Capabilities. | ||
capabilities: [] | ||
|
||
# Hyperparameters. | ||
hyper_parameters: | ||
base_path: ../configuration.yaml | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 16 | ||
learning_rate: | ||
default_value: 0.0025 | ||
learning_rate_warmup_iters: | ||
default_value: 500 | ||
num_iters: | ||
default_value: 300 | ||
algo_backend: | ||
train_type: | ||
default_value: Incremental | ||
|
||
# Training resources. | ||
max_nodes: 1 | ||
training_targets: | ||
- GPU | ||
- CPU | ||
|
||
# Stats. | ||
gigaflops: 20.6 | ||
size: 9.1 | ||
# # Inference options. Defined by OpenVINO capabilities, not Algo Backend or Platform. | ||
# inference_targets: | ||
# - CPU | ||
# - GPU | ||
# - VPU |
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
16 changes: 16 additions & 0 deletions
16
...al/model-preparation-algorithm/configs/detection/mobilenetv2_ssd_cls_incr/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: | ||
- 4 | ||
- 8 | ||
- 2 |
8 changes: 8 additions & 0 deletions
8
external/model-preparation-algorithm/configs/detection/mobilenetv2_ssd_cls_incr/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,8 @@ | ||
_base_ = [ | ||
'../../../submodule/samples/cfgs/models/backbones/ote_mobilenet_v2_w1.yaml', | ||
'../../../submodule/recipes/stages/_base_/models/detectors/ssd.custom.py' | ||
] | ||
|
||
model = dict( | ||
backbone=dict(out_indices=(4, 5,)) | ||
) |
51 changes: 51 additions & 0 deletions
51
...eparation-algorithm/configs/detection/mobilenetv2_ssd_cls_incr/template_experimental.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,51 @@ | ||
# Description. | ||
model_template_id: ClassIncremental_Object_Detection_Gen3_SSD | ||
name: SSD-ClsIncr | ||
task_type: DETECTION | ||
task_family: VISION | ||
instantiation: "CLASS" | ||
summary: Class-Incremental Object Detection for SSD | ||
application: ~ | ||
|
||
# Algo backend. | ||
framework: MPA v1.1.0 | ||
|
||
# Task implementations. | ||
entrypoints: | ||
base: mpa_tasks.apis.detection.DetectionTrainTask | ||
openvino: detection_tasks.apis.detection.OpenVINODetectionTask | ||
|
||
# Capabilities. | ||
capabilities: [] | ||
|
||
# Hyperparameters. | ||
hyper_parameters: | ||
base_path: ../configuration.yaml | ||
parameter_overrides: | ||
learning_parameters: | ||
batch_size: | ||
default_value: 4 | ||
learning_rate: | ||
default_value: 0.001 | ||
learning_rate_warmup_iters: | ||
default_value: 200 | ||
num_iters: | ||
default_value: 30 | ||
algo_backend: | ||
train_type: | ||
default_value: Incremental | ||
|
||
# Training resources. | ||
max_nodes: 1 | ||
training_targets: | ||
- GPU | ||
- CPU | ||
|
||
# Stats. | ||
gigaflops: 20.6 | ||
size: 9.1 | ||
# # Inference options. Defined by OpenVINO capabilities, not Algo Backend or Platform. | ||
# inference_targets: | ||
# - CPU | ||
# - GPU | ||
# - VPU |
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