File size: 2,141 Bytes
0ffe638 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # GmNet: Revisiting Gating Mechanisms From A Frequency View
<p align="center"> <b>ICLR 2026</b> </p> <p align="center"> <a href="https://arxiv.org/abs/2503.22841">π arxiv</a> | <a href="https://github.com/YFWang1999/GmNet">π» Code</a> </p>
### Install requirements
Run the following command to install the dependences:
```bash
pip install -r requirements.txt
```
### Data preparation
We need to prepare ImageNet-1k dataset from [`http://www.image-net.org/`](http://www.image-net.org/).
- ImageNet-1k
ImageNet-1k contains 1.28 M images for training and 50 K images for validation.
The images shall be stored as individual files:
```
ImageNet/
βββ train
β βββ n01440764
β β βββ n01440764_10026.JPEG
β β βββ n01440764_10027.JPEG
...
βββ val
β βββ n01440764
β β βββ ILSVRC2012_val_00000293.JPEG
...
```
Our code also supports storing the train set and validation set as the `*.tar` archives:
```
ImageNet/
βββ train.tar
β βββ n01440764
β β βββ n01440764_10026.JPEG
...
βββ val.tar
β βββ n01440764
β β βββ ILSVRC2012_val_00000293.JPEG
...
```
## Training
To train the model on a single node with 8 GPUs for 300 epochs and distributed evaluation, run:
```bash
python3 -m torch.distributed.launch --nproc_per_node=8 train_imagenet.py --data {path to dataset} --model gmnet_s3 -b 256 --lr 3e-3 --weight-decay 0.05 --aa rand-m1-mstd0.5-inc1 --cutmix 0.2 --color-jitter 0. --drop-path 0. --log-wandb
```
## Speed test
Run the following command to compare the throughputs on GPU/CPU:
```bash
python benchmark_onnx.py.py
```
## BibTeX
@inproceedings{ma2024rewrite,
title={GMNET: REVISITING GATING MECHANISMS FROM A
FREQUENCY VIEW},
author={Xu Ma and Xiyang Dai and Yue Bai and Yizhou Wang and Yun Fu},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
year={2024}
}
## License
The majority of GmNet is licensed under an [Apache License 2.0](https://github.com/ma-xu/Rewrite-the-Stars/blob/main/LICENSE)
|