# Alias-Free-Torch
Simple *torch* module implementation of [Alias-Free GAN](https://nvlabs.github.io/alias-free-gan/).
This repository including
- Alias-Free GAN style lowpass sinc filter @[filter.py](/src/alias_free_torch/filter.py)
- Alias-Free GAN style up/downsample @[resample.py](/src/alias_free_torch/resample.py)
- Alias-Free activation @[act.py](/src/alias_free_torch/act.py)
- and test codes @[./test](/src/alias_free_torch/test)
**Note: Since this repository is unofficial, filter and upsample could be different with [official implementation](https://github.com/NVlabs/stylegan3).**
**Still working! If you notice some error or typo, please open new issue!**
**v0.0.8 is TESTED**
**UPDATE: You can download alias-free-torch from [pip](https://pypi.org/project/alias-free-torch/)**
```shell
python -m pip install alias-free-torch
```
## Requirements
Due to `torch.kaiser_window` and `torch.i0` are implemeted after `1.7.0`, our repository need `torch>=1.7.0`.
- Pytorch>=1.7.0
For custom torch users, `pip` will not check torch version.
## TODO
- [x] 2d sinc filter
- [x] 2d resample
- [x] devide 1d and 2d modules
- [x] pip packaging
- [x] rewrite upsample
- [x] Upsample pad size issue
- [x] \(Upsample\) support calculation for \[B,C,T/(H,W)\] (now only supports \[B,T/(H,W)\] or \[B,1,T/(H,W)\])
- [x] set filter as register buffer
- [x] \(Downsample & Filter\) support calculation for \[B,C,T/(H,W)\] (now only supports \[B,T/(H,W)\] or \[B,1,T/(H,W)\])
- [ ] provide loadable ckpt for lower version of torch
- [ ] documentation
## Test results 1d
| Filter sine | Filter noise |
| --------------------- | --------------------------- |
| ![filtersin](asset/filtersin.png) | ![filternoise](asset/filternoise.png) |
| upsample | downsample |
| --------------------- | --------------------------- |
| ![up2](asset/up2.png) | ![down10](asset/down10.png) |
| ![up256](asset/up256.png) | ![down100](asset/down100.png) |
## Test results 2d
| Filter L1 norm sine | Filter noise |
| --------------------- | --------------------------- |
| ![filter2dsin](asset/filter2dsin.png) | ![filter2dnoise](asset/filter2dnoise.png) |
| upsample | downsample |
| --------------------- | --------------------------- |
| ![up2d2](asset/up2d2.png) | ![downsample2d2](asset/downsample2d2.png) |
| ![up2d8](asset/up2d8.png) | ![downsample2d4](asset/downsample2d4.png) |
## References
- [Alias-Free GAN](https://nvlabs-fi-cdn.nvidia.com/alias-free-gan/alias-free-gan-paper.pdf)
- [adefossez](https://github.com/adefossez)/[julius](https://github.com/adefossez/julius)
- A. V. Oppenheim and R. W. Schafer. *Discrete-Time Signal Processing*. Pearson, International Edition, 3rd edition, 2010
## Acknowledgement
This work is done at [MINDsLab Inc](https://github.com/mindslab-ai).
Thanks to teammates at MINDsLab Inc.
- [Hyoungkyu Song](https://github.com/deepkyu)
- [Kang-wook Kim](https://github.com/wookladin)
- [Dongho Choi](https://github.com/dhchoi99)
- [Sang Hoon Woo](https://github.com/tonyswoo)
Raw data
{
"_id": null,
"home_page": "https://github.com/junjun3518/alias-free-torch",
"name": "alias-free-torch",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "alias,torch,pytorch,filter",
"author": "junjun3518",
"author_email": "junjun3518@gmail.com",
"download_url": "",
"platform": null,
"description": "# Alias-Free-Torch\n\nSimple *torch* module implementation of [Alias-Free GAN](https://nvlabs.github.io/alias-free-gan/).\n\nThis repository including\n- Alias-Free GAN style lowpass sinc filter @[filter.py](/src/alias_free_torch/filter.py)\n\n- Alias-Free GAN style up/downsample @[resample.py](/src/alias_free_torch/resample.py)\n\n- Alias-Free activation @[act.py](/src/alias_free_torch/act.py)\n\n- and test codes @[./test](/src/alias_free_torch/test)\n\n**Note: Since this repository is unofficial, filter and upsample could be different with [official implementation](https://github.com/NVlabs/stylegan3).**\n\n**Still working! If you notice some error or typo, please open new issue!**\n**v0.0.8 is TESTED**\n\n**UPDATE: You can download alias-free-torch from [pip](https://pypi.org/project/alias-free-torch/)** \n```shell\npython -m pip install alias-free-torch\n```\n\n\n## Requirements\nDue to `torch.kaiser_window` and `torch.i0` are implemeted after `1.7.0`, our repository need `torch>=1.7.0`.\n- Pytorch>=1.7.0\n\nFor custom torch users, `pip` will not check torch version.\n\n## TODO\n- [x] 2d sinc filter\n- [x] 2d resample\n- [x] devide 1d and 2d modules\n- [x] pip packaging\n- [x] rewrite upsample\n- [x] Upsample pad size issue\n- [x] \\(Upsample\\) support calculation for \\[B,C,T/(H,W)\\] (now only supports \\[B,T/(H,W)\\] or \\[B,1,T/(H,W)\\])\n- [x] set filter as register buffer\n- [x] \\(Downsample & Filter\\) support calculation for \\[B,C,T/(H,W)\\] (now only supports \\[B,T/(H,W)\\] or \\[B,1,T/(H,W)\\])\n- [ ] provide loadable ckpt for lower version of torch\n- [ ] documentation\n\n## Test results 1d\n| Filter sine | Filter noise |\n| --------------------- | --------------------------- |\n| ![filtersin](asset/filtersin.png) | ![filternoise](asset/filternoise.png) |\n\n| upsample | downsample |\n| --------------------- | --------------------------- |\n| ![up2](asset/up2.png) | ![down10](asset/down10.png) |\n| ![up256](asset/up256.png) | ![down100](asset/down100.png) |\n\n## Test results 2d\n| Filter L1 norm sine | Filter noise |\n| --------------------- | --------------------------- |\n| ![filter2dsin](asset/filter2dsin.png) | ![filter2dnoise](asset/filter2dnoise.png) |\n\n| upsample | downsample |\n| --------------------- | --------------------------- |\n| ![up2d2](asset/up2d2.png) | ![downsample2d2](asset/downsample2d2.png) |\n| ![up2d8](asset/up2d8.png) | ![downsample2d4](asset/downsample2d4.png) |\n\n## References\n\n- [Alias-Free GAN](https://nvlabs-fi-cdn.nvidia.com/alias-free-gan/alias-free-gan-paper.pdf)\n- [adefossez](https://github.com/adefossez)/[julius](https://github.com/adefossez/julius)\n- A. V. Oppenheim and R. W. Schafer. *Discrete-Time Signal Processing*. Pearson, International Edition, 3rd edition, 2010\n\n## Acknowledgement\n\nThis work is done at [MINDsLab Inc](https://github.com/mindslab-ai).\n\nThanks to teammates at MINDsLab Inc.\n- [Hyoungkyu Song](https://github.com/deepkyu)\n- [Kang-wook Kim](https://github.com/wookladin)\n- [Dongho Choi](https://github.com/dhchoi99)\n- [Sang Hoon Woo](https://github.com/tonyswoo)\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "alias free torch",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/junjun3518/alias-free-torch"
},
"split_keywords": [
"alias",
"torch",
"pytorch",
"filter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b88e8dd4d6de0fbba9d8f10d7b655be0578d5bda6e4db425210c265b0ea6c804",
"md5": "196d5334ee4138bf7195435bf37df173",
"sha256": "3a77e81147caf00f0b05483498e672ad3623b05800b82ace163d7adecac8b033"
},
"downloads": -1,
"filename": "alias_free_torch-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "196d5334ee4138bf7195435bf37df173",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 9659,
"upload_time": "2022-07-26T01:29:40",
"upload_time_iso_8601": "2022-07-26T01:29:40.719724Z",
"url": "https://files.pythonhosted.org/packages/b8/8e/8dd4d6de0fbba9d8f10d7b655be0578d5bda6e4db425210c265b0ea6c804/alias_free_torch-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-07-26 01:29:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "junjun3518",
"github_project": "alias-free-torch",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "alias-free-torch"
}