This repository contains an experimental framework for Implicit Neural Representations (INRs): coordinate-based MLPs that represent signals as continuous functions rather than discrete grids.
It supports two pipelines:
- Part 1 — Image Super-Resolution: learn a continuous image function from a low-resolution image and query it at arbitrary resolution.
- Part 2 — 3D Occupancy Reconstruction: learn a continuous occupancy function
f(x, y, z) -> {0, 1}from sampled 3D points.
Top-level entry points:
main.py— 2D Super-Resolution experimentsdownload_div2k.py— helper to download/prepare DIV2K (if you use DIV2K)generate_data.py— generate a 3D occupancy dataset (.npz) from an.objmeshtrain_3d.py,train_3dv2.py— 3D occupancy training scripts
Core code:
src/models.py— INR architectures (SIREN / WIRE / Fourier features / MFN / etc.)src/config.py— model-specific hyperparameterssrc/trainer.py— training loop, scheduling, batchingsrc/utils.py— I/O and visualization utilities
Included sample assets:
0788.png— sample image for quick SR sanity-checkdragon.obj,nefertiti.obj— sample meshesdragon_dataset.npz,nefertiti_dataset.npz— pre-generated occupancy datasets
git clone https://github.com/AhmedKElshahed/INR.git
cd INRpython -m venv .venv
source .venv/bin/activate # Linux / macOS
# .venv\Scripts\activate # Windows PowerShellpip install -r requirements.txtYou can specify the input image, number of training epochs, and multiple upscale factors:
python main.py --image 0788.png --epochs 100 --scales 2 4 8 16To generate a training dataset from a mesh (e.g., nefertiti.obj), run:
python generate_data.py --mesh nefertiti.objOnce the dataset is generated, you can train the 3D INR model using:
python train_3dv2.py --mesh nefertiti.obj --epochs 50