Vega provides guidance on how to use algorithms and tasks, and provides guidance on algorithm development for developers, such as expanding the search space and search algorithm and building datasets applicable to Vega.
In the following example, the following directory is generated after the package is decompressed:
Contents | Description |
---|---|
compression | compression algorithm usage example, including Quant-EA、 Prune-EA. |
data augmentation | Example of using the data augmentation algorithm, including the PBA, CycleSR |
hpo | hyperparameter optimization algorithm use examples, including ASHA, BO, TPE, BOHB, BOSS, Random, Random Pareto. |
nas | Examples of network architecture search, including CARS, SP-NAS, auto-lane, SR-EA, ESR-EA, Adelaide-EA, NAGO, BackboneNas, DartsCNN, FIS, GDAS, MFKD, SegmentationEA, SGAS, ModuleNas, DNet-NAS |
fully train | Samples related to fully train, including the EfficientNet B0/B4 model training example and FMD operator example. |
classification | An example of using NAS + HPO + FullyTrain to complete an image classification task |
features | Cluster, custom dataset, model evaluation, quota samples. |
Generally, an algorithm example contains a configuration file, some algorithms, and some matching code.
You can execute the following commands in the examples
directory:
vega <algorithm config file>
For example, the command of CARS example is as follows:
vega ./nas/cars/cars.yml
All information is stored in configuration files. Configuration items are classified into public configuration items and algorithm configuration items. For details about public configuration items, see the configuration reference. For details about algorithm configuration, see the reference documents of each algorithm.Error! Hyperlink reference not valid.
Before running an example, you need to configure the directory where the dataset is located in the algorithm configuration file. The root directory of the default dataset is /cache/datasets/
, for example, the directory of the Cifar10
is /cache/datasets/cifar10/
.
Before running the example, you need to download the dataset to the default data configuration directory. Before running the example, you need to create the directory /cache/datasets/
, then download each dataset to the directory and unzip it. The default directory configuration of each dataset is as follows:
example | Pre-trained Model | Default Path | Model Source |
---|---|---|---|
adelaide_ea | mobilenet_v2-b0353104.pth | /cache/models/mobilenet_v2-b0353104.pth | download |
BackboneNas (mindspore) | resnet50-19c8e357.pth | /cache/models/resnet50-19c8e357.pth | download |
BackboneNas (tensorflow), classification, prune_ea(tensorflow) | resnet_imagenet_v1_fp32_20181001 | /cache/models/resnet_imagenet_v1_fp32_20181001/ keep only these files: checkpoint, graph.pbtxt, model.ckpt-225207.data-00000-of-00002, model.ckpt-225207.data-00001-of-00002, model.ckpt-225207.index, model.ckpt-225207.meta |
download |
dnet_nas | 031-_64_12-1111-11211112-2.pth | /cache/models/031-_64_12-1111-11211112-2.pth | download |
prune_ea(pytorch) | resnet20.pth | /cache/models/resnet20.pth | download |
prune_ea(mindspore) | resnet20.ckpt | /cache/models/resnet20.ckpt | download |
sp_nas | fasterrcnn_resnet50_fpn_coco-258fb6c6.pth | /cache/models/fasterrcnn_resnet50_fpn_coco-258fb6c6.pth | download |
In the configuration file of each example, the platform description (PyTorch, TensorFlow, and MindSpore) applicable to the example is provided in general/backend
.
For example, the following configuration indicates that the sample can run on three platforms:
general:
backend: pytorch # pytorch | tensorflow | mindspore
The following configurations can run only in TensorFlow:
general:
backend: tensorflow
-
Command line (GPU):
vega <algorithm config file> -b t
for example:
vega ./nas/backbone_nas/backbone_nas.yml -b t
-
Command line (Atlas 900):
vega <algorithm config file> -b t -d NPU
for example:
vega ./nas/backbone_nas/backbone_nas.yml -b t -d NPU
Command line (Atlas 900):
vega <algorithm config file> -b m -d NPU
for example:
vega ./nas/backbone_nas/backbone_nas.yml -b m -d NPU
-
Prune-EA
Stage Option Content nas Input Config File: compression/prune-ea/prune.yml
Pre-Trained Model: /cache/models/resnet20.pth
Dataset: /cache/datasets/cifar10nas Output Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json nas approximate running time (random_samples + num_generation * num_individual) * epochs / Number of GPUs * Training time per epoch fully train Input Config File: compression/prune-ea/prune.yml
Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json
Dataset: /cache/datasets/cifar10fully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
Quant-EA
Stage Option Content nas Input Config File: compression/quant-ea/quant.yml
Dataset: /cache/datasets/cifar10nas Output Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json nas approximate running time (random_samples + num_generation * num_individual) * epochs / Number of GPUs * Training time per epoch fully train Input Config File: compression/quant-ea/quant.yml
Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json
Dataset: /cache/datasets/cifar10fully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch
-
CARS
Stage Option Content nas Input Config File: nas/cars/cars.yml
Dataset: /cache/datasets/cifar10nas Output Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json nas approximate running time epochs * Training time per epoch (The training time is affected by num_individual) fully train Input Config File: nas/cars/cars.yml
Network Description File: tasks/<task id>/output/nas/model_desc_<id>.json
Dataset: /cache/datasets/cifar10fully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
Adelaide-EA
Stage Option Content random Input Config File: nas/adelaide_ea/adelaide_ea.yml
Dataset: /cache/datasets/cityscapesrandom Output Network Description File: tasks/<task id>/output/random/model_desc_<id>.json random approximate running time max_sample * epochs / Number of GPUs * Training time per epoch mutate Input Config File: nas/adelaide_ea/adelaide_ea.yml
Dataset: /cache/datasets/cityscapes
Network Description File: tasks/<task id>/output/random/model_desc_<id>.jsonmutate Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json mutate approximate running time max_sample * epochs / Number of GPUs * Training time per epoch fully train Input Config File: nas/adelaide_ea/adelaide_ea.yml
Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Dataset: /cache/datasets/cityscapesfully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
ESR-EA
Stage Option Content nas Input Config File: nas/esr_ea/esr_ea.yml
Dataset: /cache/datasets/DIV2Knas Output Network Description File: tasks/<task id>/output/nas/selected_arch.npy nas approximate running time num_generation * num_individual * epochs / Number of GPUs * Training time per epoch fully train Input Config File: nas/esr_ea/esr_ea.yml
Network Description File: tasks/<task id>/output/nas/selected_arch.npy
Dataset: /cache/datasets/DIV2Kfully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
SR-EA
Stage Option Content random Input Config File: nas/sr_ea/sr_ea.yml
Dataset: /cache/datasets/DIV2Krandom Output Network Description File: tasks/<task id>/output/random/model_desc_<id>.json random approximate running time num_sample * epochs / Number of GPUs * Training time per epoch mutate Input Config File: nas/sr_ea/sr_ea.yml
Dataset: /cache/datasets/DIV2K
Network Description File: tasks/<task id>/output/random/model_desc_<id>.jsonmutate Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json mutate approximate running time num_sample * epochs / Number of GPUs * Training time per epoch fully train Input Config File: nas/sr_ea/sr_ea.yml
Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Dataset: /cache/datasets/DIV2Kfully train Output Model: tasks/<task id>/output/fully_train/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
SP-NAS
Stage Option Content nas1 Input Config File: nas/sp_nas/spnas.yml
Dataset: /cache/datasets/COCO2017
Pre-Trained Model: /cache/models/resnet50-19c8e357.pth
Config File: nas/sp_nas/faster_rcnn_r50_fpn_1x.pynas1 Output Network Description File: tasks/<task id>/output/nas1/model_desc_<id>.json
Model List: tasks/<task id>/output/total_list_p.csvnas1 approximate running time max_sample * epochs / Number of GPUs * Training time per epoch nas2 Input Config File: nas/sp_nas/spnas.yml
Dataset: /cache/datasets/COCO2017
Network Description File: tasks/<task id>/output/nas1/model_desc_<id>.json
Model List: tasks/<task id>/output/total_list_p.csv
Config File: nas/sp_nas/faster_rcnn_r50_fpn_1x.pynas2 Output Network Description File: tasks/<task id>/output/nas2/model_desc_<id>.json
Model List: tasks/<task id>/output/total_list_s.csvnas2 approximate running time max_sample * epochs / Number of GPUs * Training time per epoch fully train Input Config File: nas/sp_nas/spnas.yml
Dataset: /cache/datasets/COCO2017
Network Description File: tasks/<task id>/output/nas2/model_desc_<id>.json
Model List: tasks/<task id>/output/total_list_s.csv
Config File: nas/sp_nas/faster_rcnn_r50_fpn_1x.pyfully train Output Model: tasks/<task id>/output/fullytrain/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
Auto_Lane
Stage Option Content nas Input Config File:nas/auto_lane/auto_lane.yml
Dataset:/cache/datasets/CULane OR /cache/datasets/CurveLanenas Output Network Description File:tasks/<task id>/output/nas/model_desc_<id>.json nas approximate running time max_sample * epoch / Numbers of GPUs * Training time per epoch fully train Input Config File:nas/sp_nas/auto_lane.yml
Dataset:/cache/datasets/CULane OR /cache/datasets/CurveLane
Network Description File:tasks/<task id>/output/nas/model_desc_<id>.jsonfully train Output Model:tasks/<task id>/output/fullytrain/model_<id>.pth fully train approximate running time epochs * Training time per epoch -
AutoGroup
Stage Option Content fully train Input Config File nas/fis/autogroup.yml
Dataset: /cache/datasets/avazufully train Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Model: tasks/<task id>/output/fully_train/model_0.pthfully train approximate running time epochs * Training time per epoch -
AutoFis
Stage Option Content search Input Config File nas/fis/autogate_grda.yml
Dataset: /cache/datasets/avazusearch Output Model: tasks/<task id>/output/search/0/model.pth search approximate running time epochs * Training time per epoch retrain Input Config File nas/fis/autogate_grda.yml
Dataset: /cache/datasets/avazuretrain Output Model: tasks/<task id>/output/retrain/0/model.pth retrain approximate running time epochs * Training time per epoch
-
PBA
Stage Option Content pba Input Config File: data_augmentation/pba/pba.yml
Dataset: /cache/datasets/cifar10pba Output Transformer List: tasks/<task id>/output/pba/best_hps.json pba approximate running time total_rungs * each_epochs * config_count / Number of GPUs * Training time per epoch -
CycleSR
Stage Option Content fully train Input Config File: data_augmentation/cyclesr/cyclesr.yml
Dataset: /cache/datasets/DIV2K_unpairfully train Output Model: tasks/<task id>/output/fully_train/model_0.pth fully train approximate running time n_epoch * Training time per epoch
-
ASHA、BOHB、BOSS
Stage Option Content hpo Input Config File: hpo/asha|bohb|boss/hpo/asha|bohb|boss.yml
Dataset: /cache/datasets/cifar10hpo Output Hyperparameter file: tasks/<task id>/output/hpo/best_hps.json
-
EfficientNet
Stage Option Content fully train Input Config File: fully_train/efficientnet/efficientnet_b0.yml
Dataset: /cache/datasets/ILSVRCfully train Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Model: tasks/<task id>/output/fully_train/model_<id>.pthfully train approximate running time epochs * Training time per epoch -
FMD
Stage Option Content fully train Input Config File: fully_train/fmd/fmd.yml
Dataset: /cache/datasets/cifar10fully train Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Model: tasks/<task id>/output/fully_train/model_0.pthfully train approximate running time epochs * Training time per epoch -
ResNet
Stage Option Content fully train Input Config File fully_train/trainer/resnet.yml
Dataset: /cache/datasets/ILSVRCfully train Output Network Description File: tasks/<task id>/output/mutate/model_desc_<id>.json
Model: tasks/<task id>/output/fully_train/model_0.pthfully train approximate running time epochs * Training time per epoch