Coder Social home page Coder Social logo

alibaba / lightweight-neural-architecture-search Goto Github PK

View Code? Open in Web Editor NEW
344.0 12.0 43.0 3.1 MB

This is a collection of our zero-cost NAS and efficient vision applications.

License: Apache License 2.0

Python 99.69% Shell 0.31%
maedet zennas zero-cost-nas automl nas object-detection training-free-nas deepmad classfication pytorch

lightweight-neural-architecture-search's Introduction

TinyNAS

  • This repository is a collection of training-free neural architecture search methods developed by TinyML team, Data Analytics and Intelligence Lab, Alibaba DAMO Academy. Researchers and developers can use this toolbox to design their neural architectures with different budgets on CPU devices within 30 minutes.

News

Features

It manages these modules with the help of ModelScope Registry and Configuration mechanism.

  • The Searcher is defined to be responsible for building and completing the entire search process. Through the combination of these modules and the corresponding configuration files, we can complete backbone search for different tasks (such as classification, detection, etc.) under different budget constraints (such as the number of parameters, FLOPs, delay, etc.).

  • Currently supported tasks: For each task, we provide several sample configurations and scripts as follows to help you get started quickly.


Installation


How to Use


Results

Results for Classification(Details

Backbone Param (MB) FLOPs (G) ImageNet TOP1 Structure Download
DeepMAD-R18 11.69 1.82 77.7% txt model
DeepMAD-R34 21.80 3.68 79.7% txt model
DeepMAD-R50 25.55 4.13 80.6% txt model
DeepMAD-29M-224 29 4.5 82.5% txt model
DeepMAD-29M-288 29 4.5 82.8% txt model
DeepMAD-50M 50 8.7 83.9% txt model
DeepMAD-89M 89 15.4 84.0% txt model
Zen-NAS-R18-like 10.8 1.7 78.44 txt model
Zen-NAS-R50-like 21.3 3.6 80.04 txt model
Zen-NAS-R152-like 53.5 10.5 81.59 txt model

The official code for Zen-NAS was originally released at https://github.com/idstcv/ZenNAS.


Results for low-precision backbones(Details

Backbone Param (MB) BitOps (G) ImageNet TOP1 Structure Download
MBV2-8bit 3.4 19.2 71.90% - -
MBV2-4bit 2.3 7 68.90% - -
Mixed19d2G 3.2 18.8 74.80% txt model
Mixed7d0G 2.2 6.9 70.80% txt model

Results for Object Detection(Details

Backbone Param (M) FLOPs (G) box APval box APS box APM box APL Structure Download
ResNet-50 23.5 83.6 44.7 29.1 48.1 56.6 - -
ResNet-101 42.4 159.5 46.3 29.9 50.1 58.7 - -
MAE-DET-S 21.2 48.7 45.1 27.9 49.1 58.0 txt model
MAE-DET-M 25.8 89.9 46.9 30.1 50.9 59.9 txt model
MAE-DET-L 43.9 152.9 47.8 30.3 51.9 61.1 txt model

Results for Action Recognition (Details

Backbone size FLOPs (G) SSV1 Top-1 SSV1 Top-5 Structure
X3D-S 160 1.9 44.6 74.4 -
X3D-S 224 1.9 47.3 76.6 -
E3D-S 160 1.9 47.1 75.6 txt
E3D-M 224 4.7 49.4 78.1 txt
E3D-L 312 18.3 51.1 78.7 txt

Note: If you find this useful, please support us by citing them.

@inproceedings{cvpr2023deepmad,
	title = {DeepMAD: Mathematical Architecture Design for Deep Convolutional Neural Network},
	author = {Xuan Shen and Yaohua Wang and Ming Lin and Yilun Huang and Hao Tang and Xiuyu Sun and Yanzhi Wang},
	booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
	year = {2023},
	url = {https://arxiv.org/abs/2303.02165}
}

@inproceedings{icml23prenas,
	title={PreNAS: Preferred One-Shot Learning Towards Efficient Neural Architecture Search},
	author={Haibin Wang and Ce Ge and Hesen Chen and Xiuyu Sun},
	booktitle={International Conference on Machine Learning},
	year={2023},
	organization={PMLR}
}

@inproceedings{iclr23maxste,
	title     = {Maximizing Spatio-Temporal Entropy of Deep 3D CNNs for Efficient Video Recognition},
	author    = {Junyan Wang and Zhenhong Sun and Yichen Qian and Dong Gong and Xiuyu Sun and Ming Lin and Maurice Pagnucco and Yang Song },
	journal   = {International Conference on Learning Representations},
	year      = {2023},
}

@inproceedings{neurips23qescore,
	title     = {Entropy-Driven Mixed-Precision Quantization for Deep Network Design},
	author    = {Zhenhong Sun and Ce Ge and Junyan Wang and Ming Lin and Hesen Chen and Hao Li and Xiuyu Sun},
	journal   = {Advances in Neural Information Processing Systems},
	year      = {2022},
}

@inproceedings{icml22maedet,
	title={MAE-DET: Revisiting Maximum Entropy Principle in Zero-Shot NAS for Efficient Object Detection},
	author={Zhenhong Sun and Ming Lin and Xiuyu Sun and Zhiyu Tan and Hao Li and Rong Jin},
	booktitle={International Conference on Machine Learning},
	year={2022},
	organization={PMLR}
}

@inproceedings{iccv21zennas,
	title     = {Zen-NAS: A Zero-Shot NAS for High-Performance Deep Image Recognition},
	author    = {Ming Lin and Pichao Wang and Zhenhong Sun and Hesen Chen and Xiuyu Sun and Qi Qian and Hao Li and Rong Jin},
	booktitle = {2021 IEEE/CVF International Conference on Computer Vision},
	year      = {2021},
}

License

This project is developed by Alibaba and licensed under the Apache 2.0 license.

This product contains third-party components under other open source licenses.

See the NOTICE file for more information.

lightweight-neural-architecture-search's People

Contributors

alibaba-oss avatar andrewjywang avatar drcege avatar hylcool avatar slacklife avatar vericoware avatar xiuyu-sxy avatar zhijianma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightweight-neural-architecture-search's Issues

the limit of btn

The constraint limit the btn in

new_btn = min(new_out, structure_info_next['btn'])


but this
https://github.com/tinyvision/DAMO-YOLO/blob/master/damo/base_models/backbones/nas_backbones/tinynas_nano_middle.txt
seems to have broken the limit
May I ask why? thanks

For Linux 64, Open MPI is built with CUDA awareness but this support is disabled by default.

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: /
For Linux 64, Open MPI is built with CUDA awareness but this support is disabled by default.
To enable it, please set the environment variable OMPI_MCA_opal_cuda_support=true before
launching your MPI processes. Equivalently, you can set the MCA parameter in the command line:
mpiexec --mca opal_cuda_support 1 ...

In addition, the UCX support is also built but disabled by default.
To enable it, first install UCX (conda install -c conda-forge ucx). Then, set the environment
variables OMPI_MCA_pml="ucx" OMPI_MCA_osc="ucx" before launching your MPI processes.
Equivalently, you can set the MCA parameters in the command line:
mpiexec --mca pml ucx --mca osc ucx ...
Note that you might also need to set UCX_MEMTYPE_CACHE=n for CUDA awareness via UCX.
Please consult UCX's documentation for detail.

                                                                               done

Employ 3D CNN

I'm wondering how to use the 3D CNN you provided in the project, when we modify the parameters in config files, it will always raise some surprising errors. Could you please give us some instructions about the usage of 3D CNN

how much memory was used

in paper said that we can use cpu with small memory source ,but when i run sh tools/dist_search.sh configs/classification/deepmad_29M_224.py 32G memory was used in 10 sec and the job has been aborted.

关于MAE-DET

mae-det计算特征图方差是对应着代码里的那一部分?是将其转化为计算通道数的方式了吗?与deepmad类似,socre里的madnas?

KeyError: 'MadNas is not in the backbone registry'

File "/data/syj/miniconda3/envs/train2.6/lib/python3.7/site-packages/mmcv/utils/registry.py", line 164, in build_from_cfg
f'{obj_type} is not in the {registry.name} registry')
KeyError: 'MadNas is not in the backbone registry'
detection的训练,在根据readme.md进行操作后出现KeyError,但看起来应该注册过了啊?请问有人能够提供帮助吗

How to use the para "max_feature"?

I got error when i use it like this: dict(type = "max_feature", budget = 0.5e6),

for MBV2 the error is Searcher: 'ResK1DWK1' object has no attribute 'nbitsA'
for R50 the error is get_max_feature_num() got an unexpected keyword argument 'nbitsA_out'

关于compute_madnas

image
图中1,是对应文中的最后一层特征图的计算吗?
image
图中2,为啥要相加,看的不是很懂,作者能否详细解答下

Supported device?

As shown in the config file config_nas.py, is it only the V100 or t40 are supported here?
If i want to use 2 * 2080Ti, how can i change that?

btn

May I ask deepmad_ R18_ Structure in FLOPs.py_ What is btn in info?
How to write a configuration script for a specific network model?

can't train it well

Thanks for giving me a new insight of MAD method of NAS. But after training it in my pipeline, the result is still not good. Can you give me a training pipeline? I really can't think of any other issues.
Thanks a lot!

Whether the formula to calculate the entropy of mlp is universal?

image

I went over how you derived the entropy of the MLP. I found that the final formula needed to be based on the standard normal distribution assumption in box 1, which also resulted in the entropy of the MLP being dependent only on the model structure of the MLP itself (the width of each layer and the depth of the network), not on the weight and input of the network.

So when I use this formula based on the standard normal distribution hypothesis to design the MLP network, can I really not care about the weight of the network and the input distribution?

请问这个怎么用于mlp的网络结构搜索?

image
这个关于CNN网络的规划问题似乎不能很好套用在mlp上。

image
image
我没理解错的话,根据论文表达的最大熵原理以及上面两个公式,似乎mlp的层数越多,并且宽度合适的时候,网络的表达能力就越强?
那这样如果算力很多甚至无限的情况下网络可以无限深。这个最大熵原理好像对实际情况下的mlp模型结构搜索的指导意义不是很强?因为实际情况下样本量有限(尤其工业界的样本往往很难获取),很明显网络深到一定程度再深下去可训练参数量对于这个样本来说太多了。

The calculation of FLOPs seems to be wrong

The FLOPs calculation during the search is missing the multiplication by 2.

def get_flops(self, resolution):
        # return self.flops * resolution**2
        return self.flops * resolution ** 2 * 2

Questions about reproducing results

Thanks for sharing the code of such an interesting work! Just got a few questions when reproducing the code:

  1. The links to the pre-trained image classification models (RXX-like.pth) seem like broken. Do you have any backup links for them?

  2. Will you plan to release the code for training these image classification models (RXX-like.pth) by any chance?

  3. I followed the instructions to deploy the pre-trained object detection models on GFL-V2; I was able to reproduce the similar results for maedet-s (box_mAP: 0.451) and maedet-l (box_mAP: 0.478) as reported. However, the results of maedet-m were quite unusual:

{‘box_mAP’: 0.039, ‘box_mAP_50’: 0.067, ‘box_mAP_75’: 0.039, ‘box_mAP_s’: 0.019, ‘box_mAP_m’: 0.048, ‘box_mAP_i’: 0.057, ‘box_mAP_copypast’: '0.039 0.067 0.039 0.019 0.048 0.057'}

When you get a chance, could you please help verify if you get the same outputs for maedet-m?

  1. If I understood correctly, the maedet models are searched based on this score function, which includes the variance of output feature map (as presented in Equation (4) of the MAEDET paper). However, I am sure if I understand the part regarding the stage channels - which seems not included in the original paper. Could you please provide some insights into it? Or were the pre-trained maedet models searched based on a different score function?

Thank you very much!

Converting a mixed-precision quantization model for deployment on MCU

Thanks for this amazing repo. I'm currently working on training an efficient low-precision backbone and deploying it on an ARM Cortex-M7 MCU device with limited resources (512kB RAM, 2MB Flash). I believe I need to convert the mixed-precision quantization model to a tflite model to achieve this.

Could you please guide how to perform this conversion and deployment? Thanks.

如何获取其他设备的推理延迟

希望能够在一个移动设备上实现目标检测算法,因此需要构建移动设备的延迟推理库。根据tinynas/latency/op_profiler/README.md中所述,可以通过tinynas/latency/op_profiler/python/下的一系列模块实现。但是在执行

sh sample.sh

的时候,我发现需要一个名为venus_eval_test_uclibc的文件。经过搜索并未查找到所需要的文件。我想请问我该如何解决这个问题。

(backbone of damoyolo) image_size and input channel

May I ask how to choose the image_size? Because the image_size seems to be different between https://github.com/tinyvision/DAMO-YOLO/blob/49dd0dbdcbf9ec67cb9c7b1ae2b571f71449b9db/configs/damoyolo_tinynasL20_T.py#L26 and

image_size = 320 # 224 for Imagenet, 160 for mcu

Besides, I would like to ask why the input channel is 12 instead of 3 in

{'class': 'ConvKXBNRELU', 'in': 12, 'out': 32, 's': 1, 'k': 3},

For DIY use

If I want to use the Deepmap method to create a specific parameter quantity resnet or create my own resnet101, how should I call the script? Is this open source

The results are different after two searches

Hello, thanks for your great work. I run scripts/damo-yolo/example_k1kx_small.sh twice, two best_structure.txt results are different, and is different from your damo-yolo-s structure。 I wonder if it is normal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.