Released code for ECCV 2024 paper: Attention Beats Linear for Fast Implicit Neural Representation Generation. Arxiv paper link: https://arxiv.org/abs/2407.15355
- Python version 3.8+
- Operating System: Windows/Linux/macOS
- Clone or download the project to your local machine.
- Navigate to the project directory:
cd path/to/your/project
- Install the dependencies:
pip install -r requirements.txt
- download datasets
Download any image dataset or nerf dataset you want, for example:
- CelebA: https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html
- ShapeNet: https://paperswithcode.com/paper/shapenet-an-information-rich-3d-model
If you want to use nerf dataset, we expect the folder structure is like:
|--dataset_root
| |--subset_1.json
| |--subset_1
| | |--id_of_item1
| | | |--transforms.json
| | | |--r_0.png
| | | |--r_1.png
| | | |-- ...
| | | |--r_n1.png
| | |--id_of_item2
| | |--transforms.json
| | |--r_0.png
| | |--r_1.png
| | |-- ...
| | |--r_n2.png
| |--subset_2.json
| |--subset_2
| |--id_of_item1
| | |--transforms.json
| | |--r_0.png
| | |-- ...
| | |--r_m1.png
| |--id_of_item2
| ...
|
We give the example configs in ./configs
, and here's some important parameters:
milestone
: The path to an trained model, set to empty if it's a new experiment.model_comment
: The training outputs will be saved at./output/{model_comment}
.image_shape
: An int or list of int. The size of target reconstruction resolution, all target images will be reshape toimage_shape
.hypo_hiddim
: Neural representation's hidden dim size.hypo_depth
: Depth of MLP in Representation.train_target
: Must be one ofimage
ornerf
, for different dataset setting.hyper_network
,model_framework
: Model parameter setting.dataset_kwargs
: Dataset setting.
-
make sure that your installation is correct
-
modify the configuration file
You can choose those in ./configs/test
to test whether your setup is correct.
- run script
The scripts for training/testing/evaling an model are present in ./script
. If you want to train a model, just modify the first few rows in the main function to choose the correspoding config file.
for example:
if __name__ == "__main__":
global config_file
config_file = "./configs/Celeba128_anr_d5.yaml"
and then, run the following command in terminal:
python ./script/train_inr.py
@article{zhang2024attention,
title={Attention Beats Linear for Fast Implicit Neural Representation Generation},
author={Zhang, Shuyi and Liu, Ke and Gu, Jingjun and Cai, Xiaoxu and Wang, Zhihua and Bu, Jiajun and Wang, Haishuai},
journal={arXiv preprint arXiv:2407.15355},
year={2024}
}
If you have any questions, you can reach me via the following:
Email: [email protected]