Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

[ECCV2020] NSGANetV2: Evolutionary Multi-Objective Surrogate-Assisted Neural Architecture Search

License

NotificationsYou must be signed in to change notification settings

mikelzc1990/nsganetv2

Repository files navigation

@inproceedings{  lu2020nsganetv2,title={{NSGANetV2}: Evolutionary Multi-Objective Surrogate-Assisted Neural Architecture Search},author={Zhichao Lu and Kalyanmoy Deb and Erik Goodman and Wolfgang Banzhaf and Vishnu Naresh Boddeti},booktitle={European Conference on Computer Vision (ECCV)},year={2020}}

Overview

NSGANetV2 is an efficient NAS algorithm for generating task-specific models that are competitive under multiple competing objectives. It comprises of two surrogates, one at the architecture level to improve sample efficiency and one at the weights level, through a supernet, to improve gradient descent training efficiency.

Datasets

Download the datasets from the links embedded in the names. Datasets with * can be automatically downloaded.

DatasetTypeTrain SizeTest Size#Classes
ImageNetmulti-class1,281,16750,0001,000
CINIC-10180,0009,00010
CIFAR-10*50,00010,00010
CIFAR-100*50,00010,00010
STL-10*5,0008,00010
FGVC Aircraft*fine-grained6,6673,333100
DTD3,7601,88047
Oxford-IIIT Pets3,6803,36937
Oxford Flowers1022,0406,149102

How to evalute NSGANetV2 models

Download the models (net.config) and weights (net.init) from[Google Drive] or[Baidu Yun](提取码:4isq).

""" NSGANetV2 pretrained modelsSyntax: python validation.py\    --dataset [imagenet/cifar10/...] --data /path/to/data\    --model /path/to/model/config/file --pretrained /path/to/model/weights"""
ImageNetCIFAR-10CINIC10
FLOPs@225:[Google Drive]
FLOPs@312:[Google Drive]
FLOPs@400:[Google Drive]
FLOPs@593:[Google Drive]
FLOPs@232:[Google Drive]
FLOPs@291:[Google Drive]
FLOPs@392:[Google Drive]
FLOPs@468:[Google Drive]
FLOPs@317:[Google Drive]
FLOPs@411:[Google Drive]
FLOPs@501:[Google Drive]
FLOPs@710:[Google Drive]
Flowers102AircraftOxford-IIIT Pets
FLOPs@151:[Google Drive]
FLOPs@218:[Google Drive]
FLOPs@249:[Google Drive]
FLOPs@317:[Google Drive]
FLOPs@176:[Google Drive]
FLOPs@271:[Google Drive]
FLOPs@331:[Google Drive]
FLOPs@502:[Google Drive]
FLOPs@137:[Google Drive]
FLOPs@189:[Google Drive]
FLOPs@284:[Google Drive]
FLOPs@391:[Google Drive]
CIFAR-100DTDSTL-10
FLOPs@261:[Google Drive]
FLOPs@398:[Google Drive]
FLOPs@492:[Google Drive]
FLOPs@796:[Google Drive]
FLOPs@123:[Google Drive]
FLOPs@164:[Google Drive]
FLOPs@202:[Google Drive]
FLOPs@213:[Google Drive]
FLOPs@240:[Google Drive]
FLOPs@303:[Google Drive]
FLOPs@436:[Google Drive]
FLOPs@573:[Google Drive]

How to use MSuNAS to search

""" Bi-objective searchSyntax: python msunas.py\    --dataset [imagenet/cifar10/...] --data /path/to/dataset/images\    --save search-xxx \ # dir to save search results    --sec_obj [params/flops/cpu] \ # objective (in addition to top-1 acc)    --n_gpus 8 \ # number of available gpus    --supernet_path /path/to/supernet/weights\    --vld_size [10000/5000/...] \ # number of subset images from training set to guide search    --n_epochs [0/5]"""
  • Download the pre-trained (on ImageNet) supernet fromhere.
  • It supports searching forFLOPs,Params, andLatency as the second objective.
    • To optimize latency on your own device, you need to first construct alook-up-table for your own device, likethis.
  • Choose an appropriate--vld_size to guide the search, e.g. 10,000 for ImageNet, 5,000 for CIFAR-10/100.
  • Set--n_epochs to0 for ImageNet and5 for all other datasets.
  • Seehere for some examples.
  • Output file structure:
    • Every architecture sampled during search hasnet_x.subnet andnet_x.stats stored in the corresponding iteration dir.
    • A stats file is generated by the end of each iteration,iter_x.stats; it stores every architectures evaluated so far in["archive"], and iteration-wise statistics, e.g. hypervolume in["hv"], accuracy predictor related in["surrogate"].
    • In case any architectures failed to evaluate during search, you may re-visit them infailed sub-dir under experiment dir.
ImageNetCIFAR-10

How to choose architectures

Once the search is completed, you can choose suitable architectures by:

  • You have preferences, e.g. architectures with xx.x% top-1 acc. and xxxM FLOPs, etc.
""" Find architectures with objectives close to your preferencesSyntax: python post_search.py\    -n 3 \ # number of desired architectures you want, the most accurate archecture will always be selected    --save search-imagenet/final \ # path to the dir to store the selected architectures    --expr search-imagenet/iter_30.stats \ # path to last iteration stats file in experiment dir    --prefer top1#80+flops#150 \ # your preferences, i.e. you want an architecture with 80% top-1 acc. and 150M FLOPs    --supernet_path /path/to/imagenet/supernet/weights\"""
  • If you do not have preferences, passNone to argument--prefer, architectures will then be selected based on trade-offs.
  • All selected architectures should have three files created:
    • net.subnet: use to sample the architecture from the supernet
    • net.config: configuration file that defines the full architectural components
    • net.inherited: the inherited weights from supernet

How to validate architectures

To realize the full potential of the searched architectures, we further fine-tune from the inherited weights. Assuming that you have bothnet.config andnet.inherited files.

""" Fine-tune on ImageNet from inherited weightsSyntax: sh scripts/distributed_train.sh 8 \ # of available gpus    /path/to/imagenet/data/\    --model [nsganetv2_s/nsganetv2_m/...] \ # just for naming the output dir    --model-config /path/to/model/.config/file\    --initial-checkpoint /path/to/model/.inherited/file\    --img-size [192, ..., 224, ..., 256] \ # image resolution, check "r" in net.subnet    -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97\    --opt rmsproptf --opt-eps .001 -j 6 --warmup-lr 1e-6\    --weight-decay 1e-5 --drop 0.2 --drop-path 0.2 --model-ema --model-ema-decay 0.9999\    --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .024\    --teacher /path/to/supernet/weights\"""
  • Adjust learning rate as(batch_size_per_gpu * #GPUs / 256) * 0.006 depending on your system config.
""" Fine-tune on CIFAR-10 from inherited weightsSyntax: python train_cifar.py\    --data /path/to/CIFAR-10/data/\    --model [nsganetv2_s/nsganetv2_m/...] \ # just for naming the output dir    --model-config /path/to/model/.config/file\    --img-size [192, ..., 224, ..., 256] \ # image resolution, check "r" in net.subnet    --drop 0.2 --drop-path 0.2\    --cutout --autoaugment --save"""

More Use Cases (coming soon)

  • With a different supernet (search space).
  • NASBench 101/201.
  • Architecture visualization.

Requirements

  • Python 3.7
  • Cython 0.29 (optional; makesnon_dominated_sorting faster in pymoo)
  • PyTorch 1.5.1
  • pymoo 0.4.1
  • torchprofile 0.0.1 (for FLOPs calculation)
  • OnceForAll 0.0.4 (lower level supernet)
  • timm 0.1.30
  • pySOT 0.2.3 (RBF surrogate model)
  • pydacefit 1.0.1 (GP surrogate model)

About

[ECCV2020] NSGANetV2: Evolutionary Multi-Objective Surrogate-Assisted Neural Architecture Search

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp