Skip to content

Commit

Permalink
[MPA] Enable SSD and YOLOX model template (#1156)
Browse files Browse the repository at this point in the history
* 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
jaegukhyun authored Jul 12, 2022
1 parent 29ea726 commit ace7a78
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 3 deletions.
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)
)
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_base_ = [
'../../../submodule/recipes/stages/_base_/models/detectors/yolox.custom.py'
]
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ hyper_parameters:
learning_rate:
default_value: 0.001
learning_rate_warmup_iters:
default_value: 200
default_value: 10
num_iters:
default_value: 30
default_value: 100
algo_backend:
train_type:
default_value: Incremental
Expand Down
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
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,))
)
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
2 changes: 1 addition & 1 deletion ote_sdk/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ numpy>=1.16.4
scikit-learn==0.24.*
Shapely>=1.7.1,<=1.8.0
networkx>=2.5,<2.8.1rc1
opencv-python==4.5.5.*
opencv-python==4.5.*
pymongo==3.12.0
omegaconf==2.1.*
natsort>=6.0.0
Expand Down

0 comments on commit ace7a78

Please sign in to comment.