108 Star 867 Fork 1.5K

MindSpore/models

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Contents

Wave-MLP Description

To dynamically aggregate tokens, Wave-MLP proposes to represent each token as a wave function with two parts, amplitude and phase. Amplitude is the original feature and the phase term is a complex value changing according to the semantic contents of input images.

Paper: Yehui Tang, Kai Han, Jianyuan Guo, Chang Xu, Yanxi Li, Chao Xu, Yunhe Wang. An Image Patch is a Wave: Phase-Aware Vision MLP. arxiv 2111.12294.

Model architecture

A block of Wave-MLP is shown below:

image-wavemlp

Dataset

Dataset used: [ImageNet2012]

  • Dataset size 224*224 colorful images in 1000 classes
    • Train:1,281,167 images
    • Test: 50,000 images
  • Data format:jpeg
    • Note:Data will be processed in dataset.py

Environment Requirements

Script description

Script and sample code

WalveMlp
├── eval.py # inference entry
├── fig
│   └── wavemlp.png # the illustration of wave_mlp network
├── readme.md # Readme
└── src
    ├── dataset.py # dataset loader
    └── wave_mlp.py # wave_mlp network

Eval process

Usage

After installing MindSpore via the official website, you can start evaluation as follows:

Launch

# infer example
  # python
  GPU: python eval.py --dataset_path dataset --platform GPU --checkpoint_path [CHECKPOINT_PATH]
  # shell
  bash ./scripts/run_eval.sh [DATA_PATH] [PLATFORM] [CHECKPOINT_PATH]

checkpoint can be downloaded at https://download.mindspore.cn/model_zoo/research/cv/wavemlp/.

Result

result: {'acc': 0.807} ckpt= ./WaveMLP_T.ckpt

Inference Performance

WaveMlp infer on ImageNet2012

Parameters Ascend
Model Version WaveMlp
Resource Ascend 910; OS Euler2.8
Uploaded Date 08/03/2022 (month/day/year)
MindSpore Version 1.6.0
Dataset ImageNet2012
batch_size 1024
outputs probability
Accuracy 1pc: 80.7%
Speed 1pc: 11.72 s/step
Total time 1pc: 562.96 s/step

Description of Random Situation

In dataset.py, we set the seed inside "create_dataset" function. We also use random seed in train.py.

ModelZoo Homepage

Please check the official homepage.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mindspore/models.git
git@gitee.com:mindspore/models.git
mindspore
models
models
master

搜索帮助