Skip to content
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

[Feature] Add BigNAS algorithm #219

Merged
merged 96 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
7cdf18f
add calibrate-bn-statistics
wutongshenqiu Jul 18, 2022
f3a422e
add test calibrate-bn-statistics
wutongshenqiu Jul 19, 2022
6314dd7
fix mixins
wutongshenqiu Jul 19, 2022
df213c3
fix mixins
wutongshenqiu Jul 19, 2022
5441a3d
fix mixin tests
wutongshenqiu Jul 20, 2022
5df42d8
remove slimmable channel mutable and refactor dynamic op
wutongshenqiu Jul 21, 2022
dfa7e65
refact dynamic batch norm
wutongshenqiu Jul 21, 2022
5b680bc
add progressive dynamic conv2d
wutongshenqiu Jul 21, 2022
723d364
add center crop dynamic conv2d
wutongshenqiu Jul 21, 2022
37877c9
refactor dynamic directory
wutongshenqiu Jul 21, 2022
dfb8560
refactor dynamic sequential
wutongshenqiu Jul 22, 2022
75954bd
rename length to depth in dynamic sequential
wutongshenqiu Jul 22, 2022
424683f
add test for derived mutable
wutongshenqiu Jul 25, 2022
7a00843
refactor dynamic op
wutongshenqiu Jul 26, 2022
f0b908d
refactor api of dynamic op
wutongshenqiu Jul 28, 2022
84ef3b5
add derive mutable mixin
wutongshenqiu Jul 28, 2022
cd56a2b
addbignas algorithm
wutongshenqiu Jul 28, 2022
3039810
refactor bignas structure
wutongshenqiu Jul 29, 2022
fbe9027
add input resizer
wutongshenqiu Aug 1, 2022
687f746
add input resizer to bignas
wutongshenqiu Aug 1, 2022
cd6061b
move input resizer from algorithm into classifier
wutongshenqiu Aug 1, 2022
9a8d22c
remove compnents
wutongshenqiu Aug 1, 2022
b1be2ad
add attentive mobilenet
wutongshenqiu Aug 3, 2022
a43bb6d
delete json file
wutongshenqiu Aug 3, 2022
c0ebf9b
nearly(less 0.2) align inference accuracy with gml
wutongshenqiu Aug 4, 2022
7c2ba5b
move mutate seperated in bignas mobilenet backbone
wutongshenqiu Aug 4, 2022
fb09271
add zero_init_residual
wutongshenqiu Aug 5, 2022
b096d10
add set_dropout
wutongshenqiu Aug 5, 2022
730baa5
set dropout in bignas algorithm
wutongshenqiu Aug 5, 2022
b23c6e7
fix registry
wutongshenqiu Aug 5, 2022
27eacd8
add subnet yaml and nearly align inference accuracy with gml
wutongshenqiu Aug 5, 2022
4df8f41
add rsb config for bignas
wutongshenqiu Aug 6, 2022
091cfd7
remove base in config
wutongshenqiu Aug 6, 2022
c51824c
add gml bignas config
wutongshenqiu Aug 7, 2022
10708c1
convert to iter based
wutongshenqiu Aug 7, 2022
7ad0f32
merge dev-1.x and fix conflicts
sunnyxiaohu Aug 29, 2022
2dd26b1
Merge branch 'dev-1.x' into bignas
sunnyxiaohu Aug 30, 2022
743b1e0
bignas forward and backward fly
sunnyxiaohu Sep 6, 2022
ebabe6a
Merge branch 'dev-1.x' into bignas
sunnyxiaohu Sep 6, 2022
2a67c42
fix merge conflict
sunnyxiaohu Sep 6, 2022
e9425ed
fix dynamicseq bug
sunnyxiaohu Sep 6, 2022
d58dce7
merge 1.0.0rc1 into bignas
Nov 11, 2022
6485a4e
fix bug and refactor bignas
Nov 15, 2022
9015ba8
merge autoformer design & predictor into bignas
Nov 15, 2022
fb3caf6
arrange configs of bignas
Nov 17, 2022
4cff507
fix typo
Nov 17, 2022
01d6bd9
refactor attentive_mobilenet
Nov 17, 2022
a9c4564
fix channel mismatch due to registion of DerivedMutable
Nov 17, 2022
b8d403a
update bignas & fix se channel mismatch
Nov 21, 2022
3465286
add AutoAugmentV2 & remove unness configs
Nov 21, 2022
125b4fd
fix lint
Nov 21, 2022
5b0e782
recover channel assertion in channel unit
Nov 22, 2022
6384fd2
fix a group bug
Nov 22, 2022
cd341e9
merge dev-1.x into bignas
Nov 23, 2022
d7edc2f
fix comments
Nov 23, 2022
ca9b972
add docstring
Nov 23, 2022
748b061
add norm in dynamic_embed
Nov 24, 2022
451d759
fix search loop & other minor changes
Nov 25, 2022
d934f30
fix se expansion
Nov 28, 2022
d72ce79
minor change
Nov 28, 2022
eccbbbb
add ut for bignas & attentive_mobilenet
Nov 28, 2022
eec416c
fix ut
Nov 28, 2022
6280db4
update bignas readme
Nov 29, 2022
ec4ced6
rm unness ut & supplement get_placeholder
Nov 29, 2022
19022d4
fix lint
Nov 29, 2022
fe17686
fix ut
Nov 29, 2022
b079e69
add subnet deployment in downstream tasks.
sunnyxiaohu Nov 29, 2022
4c1e4d1
Merge branch 'bignas' of github.com:wutongshenqiu/mmrazor into bignas
sunnyxiaohu Nov 29, 2022
55173c8
minor change
Nov 29, 2022
b4dd427
update ofa backbone
Dec 1, 2022
6498950
minor fix
Dec 1, 2022
fa91b6c
Continued improvements of searchable backbone
Dec 1, 2022
1075041
fix conflict
Dec 1, 2022
f524b61
minor change
Dec 1, 2022
2b48e8d
drop ratio in backbone
Dec 2, 2022
8758abb
fix comments
Dec 4, 2022
f90ba13
fix ci test
Dec 4, 2022
10da6c3
fix test
Dec 4, 2022
4f63e43
add dynamic shortcut UT
Dec 4, 2022
a18537a
modify strategy to fit bignas
Dec 6, 2022
e4f1e08
fix test
Dec 6, 2022
a4826ad
Merge branch 'dev-1.x' into bignas
Dec 6, 2022
8c92063
fix bug in neck
Dec 6, 2022
8f5c117
fix error
Dec 6, 2022
2855358
fix error
Dec 6, 2022
6ad6584
fix yaml
Dec 6, 2022
fee0502
save subnet ckpt
Dec 6, 2022
a3f78bc
merge autoslim_val/test_loop into subnet_val_loop
Dec 6, 2022
6e5224a
move calibrate_bn_mixin to utils
Dec 6, 2022
f6fa84d
fix bugs and add docstring
Dec 6, 2022
5e942c3
save export subnet ckpt
Dec 6, 2022
eee03bb
fix error
Dec 6, 2022
7a9be87
clean code
Dec 6, 2022
541fbf0
fix register bug
Dec 7, 2022
f86e345
clean code
Dec 7, 2022
8666555
update
Dec 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions configs/_base_/nas_backbones/attentive_mobilenetv3_supernet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# search space
arch_setting = dict(
kernel_size=[ # [min_kernel_size, max_kernel_size, step]
[3, 5, 2],
[3, 5, 2],
[3, 5, 2],
[3, 5, 2],
[3, 5, 2],
[3, 5, 2],
[3, 5, 2],
],
num_blocks=[ # [min_num_blocks, max_num_blocks, step]
[1, 2, 1],
[3, 5, 1],
[3, 6, 1],
[3, 6, 1],
[3, 8, 1],
[3, 8, 1],
[1, 2, 1],
],
expand_ratio=[ # [min_expand_ratio, max_expand_ratio, step]
[1, 1, 1],
[4, 6, 1],
[4, 6, 1],
[4, 6, 1],
[4, 6, 1],
[6, 6, 1],
[6, 6, 1],
[6, 6, 1], # last layer
],
num_out_channels=[ # [min_channel, max_channel, step]
[16, 24, 8], # first layer
[16, 24, 8],
[24, 32, 8],
[32, 40, 8],
[64, 72, 8],
[112, 128, 8],
[192, 216, 8],
[216, 224, 8],
[1792, 1984, 1984 - 1792], # last layer
])

_INPUT_MUTABLE = dict(
input_resizer=dict(type='DynamicInputResizer'),
mutable_shape=dict(
type='OneShotMutableValue',
value_list=[[192, 192], [224, 224], [256, 256], [288, 288]],
default_value=[224, 224]))

nas_backbone = dict(
type='AttentiveMobileNetV3',
arch_setting=arch_setting,
norm_cfg=dict(type='DynamicBatchNorm2d', momentum=0.0))
48 changes: 48 additions & 0 deletions configs/_base_/nas_backbones/ofa_mobilenetv3_supernet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# search space
arch_setting = dict(
kernel_size=[ # [min_kernel_size, max_kernel_size, step]
[3, 3, 1],
[3, 7, 2],
[3, 7, 2],
[3, 7, 2],
[3, 7, 2],
[3, 7, 2],
],
num_blocks=[ # [min_num_blocks, max_num_blocks, step]
[1, 1, 1],
[2, 4, 1],
[2, 4, 1],
[2, 4, 1],
[2, 4, 1],
[2, 4, 1],
],
expand_ratio=[ # [min_expand_ratio, max_expand_ratio, step]
[1, 1, 1],
[3, 6, 1],
[3, 6, 1],
[3, 6, 1],
[3, 6, 1],
[3, 6, 1],
[6, 6, 1], # last layer
],
# [16, 16, 24, 40, 80, 112, 160, 960, 1280]
num_out_channels=[ # [min_channel, max_channel, step]
[16, 16, 8], # first layer
[16, 16, 8],
[16, 24, 8],
[24, 40, 8],
[40, 80, 8],
[80, 112, 8],
[112, 160, 8],
[1024, 1280, 1280 - 1024], # last layer
])

nas_backbone = dict(
type='mmrazor.AttentiveMobileNetV3',
arch_setting=arch_setting,
out_indices=(6, ),
stride_list=[1, 2, 2, 2, 1, 2],
with_se_list=[False, False, True, False, True, True],
conv_cfg=dict(type='OFAConv2d'),
norm_cfg=dict(type='mmrazor.DynamicBatchNorm2d', momentum=0.0),
with_attentive_shortcut=False)
4 changes: 2 additions & 2 deletions configs/_base_/nas_backbones/spos_mobilenet_supernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

arch_setting = [
# Parameters to build layers. 3 parameters are needed to construct a
# layer, from left to right: channel, num_blocks, mutable_cfg.
# layer, from left to right: channel, num_blocks, stride, mutable_cfg.
[24, 1, 1, _FIRST_MUTABLE],
[32, 4, 2, _STAGE_MUTABLE],
[56, 4, 2, _STAGE_MUTABLE],
Expand All @@ -58,7 +58,7 @@

nas_backbone = dict(
_scope_='mmrazor',
type='SearchableMobileNet',
type='SearchableMobileNetV2',
first_channels=40,
last_channels=1728,
widen_factor=1.0,
Expand Down
4 changes: 2 additions & 2 deletions configs/_base_/settings/imagenet_bs1024_spos.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
bias_decay_mult=0.0, norm_decay_mult=0.0, dwconv_decay_mult=0.0)

optim_wrapper = dict(
optimizer=dict(type='mmcls.SGD', lr=0.5, momentum=0.9, weight_decay=4e-5),
optimizer=dict(type='SGD', lr=0.5, momentum=0.9, weight_decay=4e-5),
paramwise_cfg=paramwise_cfg,
clip_grad=None)

# leanring policy
param_scheduler = dict(
type='mmcls.PolyLR',
type='PolyLR',
power=1.0,
eta_min=0.0,
by_epoch=True,
Expand Down
Loading