-
Notifications
You must be signed in to change notification settings - Fork 239
[Feature] Add NSGANetV2 Algorithm #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gaoyang07
wants to merge
15
commits into
open-mmlab:main
Choose a base branch
from
gaoyang07:gy/nsga
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b3a0069
update nsga2 search with pymoo_v0.50
a70309a
merge dev-1.x into nsga2
3d76a72
fix bugs
4584c07
merge branch dev-1.x into gy/nsga
1733aff
unify search_groups by alias
83da867
update algorithm & imagenet cfgs
2ae2175
update configs
25e05d8
update finetune step
dd6fc32
update search configs
46473c4
merge dev-1.x into gy/nsga
4cc2603
update search loops
95d8087
fix finetune_step model bug
b04f8f2
update nsga2 search with pymoo_v0.60
2e7ce1e
bump nsga2 search into pymoo_v0.41 due to stability
bd9384c
fix lr during finetune step
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update configs
- Loading branch information
There are no files selected for viewing
This file contains hidden or 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,49 @@ | ||
| # dataset settings | ||
| dataset_type = 'mmcls.CIFAR10' | ||
| data_preprocessor = dict( | ||
| type='mmcls.ClsDataPreprocessor', | ||
| num_classes=10, | ||
| # RGB format normalization parameters | ||
| mean=[125.307, 122.961, 113.8575], | ||
| std=[51.5865, 50.847, 51.255], | ||
| # loaded images are already RGB format | ||
| to_rgb=False) | ||
|
|
||
| train_pipeline = [ | ||
| dict(type='mmcls.RandomCrop', crop_size=32, padding=4), | ||
| dict(type='mmcls.RandomFlip', prob=0.5, direction='horizontal'), | ||
| dict(type='mmcls.Cutout', shape=16, pad_val=0, prob=1.0), | ||
| dict(type='mmcls.PackClsInputs'), | ||
| ] | ||
|
|
||
| test_pipeline = [ | ||
| dict(type='mmcls.PackClsInputs'), | ||
| ] | ||
|
|
||
| train_dataloader = dict( | ||
| batch_size=96, | ||
| num_workers=5, | ||
| dataset=dict( | ||
| type=dataset_type, | ||
| data_prefix='data/cifar10', | ||
| test_mode=False, | ||
| pipeline=train_pipeline), | ||
| sampler=dict(type='mmcls.DefaultSampler', shuffle=True), | ||
| persistent_workers=True, | ||
| ) | ||
|
|
||
| val_dataloader = dict( | ||
| batch_size=96, | ||
| num_workers=5, | ||
| dataset=dict( | ||
| type=dataset_type, | ||
| data_prefix='data/cifar10/', | ||
| test_mode=True, | ||
| pipeline=test_pipeline), | ||
| sampler=dict(type='mmcls.DefaultSampler', shuffle=False), | ||
| persistent_workers=True, | ||
| ) | ||
| val_evaluator = dict(type='mmcls.Accuracy', topk=(1, )) | ||
|
|
||
| test_dataloader = val_dataloader | ||
| test_evaluator = val_evaluator |
49 changes: 49 additions & 0 deletions
49
configs/nas/mmcls/nsganetv2/nsganetv2_mobilenet_supernet_1xb96_cifar10.py
This file contains hidden or 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,49 @@ | ||
| _base_ = [ | ||
| 'mmcls::_base_/default_runtime.py', | ||
| 'mmcls::_base_/schedules/imagenet_bs2048.py', | ||
| 'mmrazor::_base_/settings/cifar10_bs96_nsga.py', | ||
| 'mmrazor::_base_/nas_backbones/nsga_mobilenetv3_supernet.py', | ||
| ] | ||
|
|
||
| supernet = dict( | ||
| _scope_='mmrazor', | ||
| type='SearchableImageClassifier', | ||
| backbone=_base_.nas_backbone, | ||
| neck=dict(type='SqueezeMeanPoolingWithDropout', drop_ratio=0.2), | ||
| head=dict( | ||
| type='DynamicLinearClsHead', | ||
| num_classes=1000, | ||
| in_channels=1280, | ||
| loss=dict( | ||
| type='mmcls.LabelSmoothLoss', | ||
| num_classes=1000, | ||
| label_smooth_val=0.1, | ||
| mode='original', | ||
| loss_weight=1.0), | ||
| topk=(1, 5)), | ||
| input_resizer_cfg=_base_.input_resizer_cfg, | ||
| connect_head=dict(connect_with_backbone='backbone.last_mutable_channels'), | ||
| ) | ||
|
|
||
| model = dict( | ||
| _scope_='mmrazor', | ||
| type='NSGANetV2', | ||
| architecture=supernet, | ||
| data_preprocessor=_base_.data_preprocessor, | ||
| mutators=dict( | ||
| channel_mutator=dict( | ||
| type='mmrazor.OneShotChannelMutator', | ||
| channel_unit_cfg={ | ||
| 'type': 'OneShotMutableChannelUnit', | ||
| 'default_args': { | ||
| 'unit_predefined': True | ||
| } | ||
| }, | ||
| parse_cfg={'type': 'Predefined'}), | ||
| value_mutator=dict(type='DynamicValueMutator'))) | ||
|
|
||
| find_unused_parameters = True | ||
|
|
||
| default_hooks = dict( | ||
| checkpoint=dict( | ||
| type='CheckpointHook', interval=1, max_keep_ckpts=1, save_best='auto')) |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix_subnet is no needed.