{"id":29708826,"url":"https://github.com/plugyawn/no-imagegen","last_synced_at":"2025-07-23T19:07:24.160Z","repository":{"id":301663911,"uuid":"1009958599","full_name":"plugyawn/no-imagegen","owner":"plugyawn","description":"Recursive Denoising Neural Operators for superfast image-generation.","archived":false,"fork":false,"pushed_at":"2025-06-28T04:00:06.000Z","size":0,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-28T04:29:36.295Z","etag":null,"topics":["efficient","image-generation","image-processing","neural","neural-operator","transformer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plugyawn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-28T03:44:52.000Z","updated_at":"2025-06-28T04:03:52.000Z","dependencies_parsed_at":"2025-06-28T04:39:42.066Z","dependency_job_id":null,"html_url":"https://github.com/plugyawn/no-imagegen","commit_stats":null,"previous_names":["plugyawn/no-imagegen"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plugyawn/no-imagegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plugyawn%2Fno-imagegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plugyawn%2Fno-imagegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plugyawn%2Fno-imagegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plugyawn%2Fno-imagegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plugyawn","download_url":"https://codeload.github.com/plugyawn/no-imagegen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plugyawn%2Fno-imagegen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266737780,"owners_count":23976394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["efficient","image-generation","image-processing","neural","neural-operator","transformer"],"created_at":"2025-07-23T19:07:20.437Z","updated_at":"2025-07-23T19:07:24.150Z","avatar_url":"https://github.com/plugyawn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scale-Recursive Wavelet Neural Operator for Image Generation\n\n## Overview\n\nThis repository contains an *autoregressive coarse-to-fine* generator that\npredicts an image one scale at a time using a **weight–tied Wavelet Neural\nOperator (W-NO)**.  The generator starts from a $4\\times4$ noise canvas and\nrepeatedly doubles the resolution until a $64\\times64$ RGB image is reached.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"outputs/epoch_20/cf_samples.png\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n## Motivation\n\nImage generation often stores the entire spatial activation stack during a\nsingle forward pass (e.g. UNet diffusion), pushing memory beyond commodity\nGPUs.  A *recursive* formulation keeps only one scale in memory at a time –\n$\\mathcal{O}(H\\,W)$ → $\\mathcal{O}(H\\,W/4)$ at 64×64 – while re-using the same\noperator at every level.\n\nFourier Neural Operators (FNOs) are compelling for global, translation-\nperiodic physics, but raw FFTs introduce ringing and checkerboards in natural\nimages.  We therefore replace the Fourier transform with a **1-level Haar\nDiscrete Wavelet Transform (DWT)** – preserving locality while still offering\nmulti-resolution coupling.\n\n## Algorithmic Core\n\n### Notation\n\n* $x\\_r \\in [0,1]^{3\\times r\\times r}$ – current resolution canvas.\n* $\\epsilon\\_r \\sim \\mathcal{N}(0,\\sigma\\_r^2)$ – Gaussian noise injected at\n  every level.\n* $\\mathcal{T}$ – weight-tied Wavelet Neural Operator.\n\nAt each scale we perform\n\n\n$x\\_r^{\\uparrow 2} = \\text{NearestUpsample}(x\\_r)$\n\n$\\hat{x}\\_{2r} = \\mathcal{T}\\bigl(\\;x\\_r^{\\uparrow 2},\\;\\epsilon\\_r,\\;\\text{coords}\\;\\bigr)$\n\n$x\\_{2r} = \\mathrm{clip}(x\\_r^{\\uparrow 2}+\\hat{x}\\_{2r},\\, 0,1).$\n\n### Wavelet Neural Operator\n\n1. Forward **Haar DWT** splits the feature map into one low-pass block $L$ and\n   three high-pass blocks $H^{(o)}\\_{o\\in\\{\\text{LH,HL,HH}\\}}$.\n2. A $1\\times1$ convolution is applied to $L$; another $1\\times1$ convolution\n   is applied jointly to the concatenated $H^{(o)}$.\n3. Inverse DWT reconstructs the spatial residual at the same resolution.\n\nThis $\\mathcal{T}$ is embedded in a residual stack and shared across all\ncoarse→fine transitions.\n\n## Training Objective\n\nFor each mini-batch and every scale\n\n\n$\\mathcal{L}=\\sum\\_{\\ell=0}^{3}\\;w\\_{\\ell}\\Bigl[\\;\\|x\\_{gt}^{(\\ell)}-x\\_{pred}^{(\\ell)}\\|\\_1 +$\n\n$\\lambda\\_{v}\\,\\|\\phi(x\\_{gt}^{(\\ell)})-\\phi(x\\_{pred}^{(\\ell)})\\|\\_1 +$\n\n$\\lambda\\_{s}\\,(1-\\text{SSIM}) + \\lambda\\_{g}\\,\\|\\nabla x\\_{gt}^{(\\ell)}-\\nabla x\\_{pred}^{(\\ell)}\\|\\_1\\Bigr]$\n\n\nplus a hinge **PatchGAN** loss (weight $\\lambda\\_{\\text{adv}}$) acting only on\nthe finest scale.\n\n## Memory Footprint\n\nOnly the tensors of the *current* resolution are kept in GPU memory: roughly\n`batch × channels × H × W`.  With batch = 128 and width = 192 the peak VRAM is\n\u003c 4 GB for 64×64 training.\n\n## Results (CIFAR-10, 64×64)\n\n| Epoch | PSNR (dB) | FID ↓ | Comments                  |\n|------:|---------:|------:|---------------------------|\n|  10   | 23.8     | -  | Coarse colour blobs       |\n|  20   | **25.9** | -  | Edges sharpen; see above  |\n|  30   | 26.5     | -  | Texture appears           |\n\n*Evaluation uses 10 k validation images, no classifier guidance.*\n\n## How to Run\n\n```bash\npip install -r requirements.txt\npython main.py            # trains 25 epochs and writes samples / curves\n```\n\nIntermediate predictions for every scale can be dumped by uncommenting the\nlines in `generate_samples()`. Load pretrained checkpoints from `ckpt` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugyawn%2Fno-imagegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplugyawn%2Fno-imagegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugyawn%2Fno-imagegen/lists"}