NASBench101-安装及简单样例使用指南
github地址:https://github.com/google-research/nasbench paper原文地址:https://arxiv.org/abs/1902.09635文章目录
1. 什么是NASBench101?
NASBench101用一句话概括就是:涵盖了 423,624个神经网络的性能速查表。
其中每个网络都在CIFAR10数据集上训练和评价多次。
1.1 NASBench101中网络的设计
具体而言,所有网络共享相同的网络“骨架(skeleton)”,可以在下图左中看到。 不同模型之间的变化是“模块(module)”,它是连接在任意图样结构中的神经网络操作的集合。
其中每个模块的设计要求:这里模块用一个有向无环图表示(如上图右上角的Inception-like模块),图中最多包含9个顶点和7条边。顶点指有效操作,包含:33卷积,11卷积,3*3的最大池化。
1.2 NASBench101中指标
- training accuracy
- validation accuracy
- testing accuracy
- number of parameters
- training time
2. NASBench101的安装
2.1 安装环境
我是在Ubuntu20.04上安装的,所以下面图中的界面都是基于Ubuntu的显示。在windows上的操作大同小异。从github上clone该项目
git clone https://github.com/google-research/nasbench
若速度过慢,可尝试以下语句
git clone https://github.com.cnpmjs.org/google-research/nasbench
进入该项目文件夹
cd nasbench
安装(若当前环境中无tensorflow cpu版本,该步会安装Tensorflow)
pip install -e .
2.2 下载nasbench数据集
只有下载了该数据集后,才能进行查询。
官方提供了2种数据集。
- 有4种epochs训练的结果 (1.95 GB)
下载链接: https://storage.googleapis.com/nasbench/nasbench_full.tfrecord - 只有训练108 epochs的结果 (499G)
下载链接:https://storage.googleapis.com/nasbench/nasbench_only108.tfrecord
3. NASBench101的简单样例
(以nasbench_full.tfrecord为例)
在pycharm IDE中打开刚刚git clone的nasbench项目
将2.2中下载的nasbench_full.tfrecord文件放置于该文件夹内
打开example.py文件
根据需求安装absl库,pip install absl-py
运行example.py文件
【注】该过程需要加载nasbench_full.tfrecord数据集,会等待一段时间(我用了124秒)
然后就可以的得到example.py中示例的网络(以邻接矩阵表示)的各项性能指标了。
结果如下图所示。
example.py中示例的网络:
运行结果截图:
友情提示
如果使用了该数据集,请引用
@InProceedings{pmlr-v97-ying19a,
title = {{NAS}-Bench-101: Towards Reproducible Neural Architecture Search},
author = {Ying, Chris and Klein, Aaron and Christiansen, Eric and Real, Esteban and Murphy, Kevin and Hutter, Frank},
booktitle = {Proceedings of the 36th International Conference on Machine Learning},
pages = {7105--7114},
year = {2019},
editor = {Chaudhuri, Kamalika and Salakhutdinov, Ruslan},
volume = {97},
series = {Proceedings of Machine Learning Research},
address = {Long Beach, California, USA},
month = {09--15 Jun},
publisher = {PMLR},
url = {http://proceedings.mlr.press/v97/ying19a.html},