{"id":23280816,"url":"https://github.com/jloveric/high-order-implicit-representation","last_synced_at":"2025-10-15T13:14:01.377Z","repository":{"id":37477629,"uuid":"321862714","full_name":"jloveric/high-order-implicit-representation","owner":"jloveric","description":"Implicit representation of various things using PyTorch and high order layers","archived":false,"fork":false,"pushed_at":"2024-05-29T00:36:30.000Z","size":5328,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T13:39:41.404Z","etag":null,"topics":["coordinate-mlp","discontinuous-polynomial-network","fourier-series-network","high-order-methods","implicit-representions","kan","lagrange-interpolation","neural-network","piecewise-polynomial","piecewise-polynomial-network","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jloveric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-12-16T03:59:10.000Z","updated_at":"2025-03-06T14:19:38.000Z","dependencies_parsed_at":"2024-05-06T01:28:35.536Z","dependency_job_id":"efdac3df-bf5d-4aff-ab86-9a809ff0d4ff","html_url":"https://github.com/jloveric/high-order-implicit-representation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jloveric/high-order-implicit-representation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jloveric%2Fhigh-order-implicit-representation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jloveric%2Fhigh-order-implicit-representation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jloveric%2Fhigh-order-implicit-representation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jloveric%2Fhigh-order-implicit-representation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jloveric","download_url":"https://codeload.github.com/jloveric/high-order-implicit-representation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jloveric%2Fhigh-order-implicit-representation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279081713,"owners_count":26099266,"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-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["coordinate-mlp","discontinuous-polynomial-network","fourier-series-network","high-order-methods","implicit-representions","kan","lagrange-interpolation","neural-network","piecewise-polynomial","piecewise-polynomial-network","pytorch"],"created_at":"2024-12-19T23:39:03.960Z","updated_at":"2025-10-15T13:14:01.310Z","avatar_url":"https://github.com/jloveric.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/jloveric/high-order-implicit-representation/actions/workflows/python-app.yml/badge.svg)](https://github.com/jloveric/high-order-implicit-representation/actions/workflows/python-app.yml)\n\n# Implicit Representation with High Order Layers\nImplicit representation of various things using PyTorch and high order layers.  The network uses high order layers as implemented [here](https://github.com/jloveric/high-order-layers-torch).  Implicit representation is creating a function that approximates your data (cuve fitting).  The function can be a compact representation of the original data and also provides an interpolation of that data.  Below we show example functions for images.\n\n# PIP install of library functions\n```\npip install high-order-implicit-representation\n```\nand\n```\npoetry add high-order-implicit-representation\n```\nif you run into problems installing triton with poetry, this is a hack I've had to\ndo for certain packages\n```\npoetry shell\npip install triton\n```\n# Implicit Representation of Images\n\nTrain a model\n```\npython examples/implicit_images.py mlp.hidden.width=10 mlp.hidden.layers=2 lr=1e-3 mlp.n=3 mlp.periodicity=2.0 mlp.layer_type=continuous mlp.hidden.segments=2 mlp.input.segments=100 mlp.output.segments=2 batch_size=256\n```\n\nEvaluate a model example\n```\npython example/implicit_images.py train=False checkpoint=\\\"multirun/2021-01-10/18-31-32/0/lightning_logs/version_0/checkpoints/epoch=49-step=145349.ckpt\\\" rotations=2\n```\nAlternatively, model results are also plotted for each result in tensorboard\n## Examples\n### Piecewise Continuous\nThe example below uses piecewise quadratic polynomials.  The input layer is the x, y position where there are 100 segments\nfor each input connection.  There is 1 hidden layers with 40 units each and 2 segments.  There are 3 outputs representing the RGB colors, where each output has 2 segment.  In total there are 40.8k parameters,\nThe raw image can be represented by 2.232e6 8bit parameters.\n```python\npython examples/implicit_images.py -m mlp.hidden.width=40 mlp.hidden.layers=1 lr=1e-3 mlp.n=3 mlp.periodicity=2.0 mlp.layer_type=continuous mlp.hidden.segments=2 mlp.input.segments=100 mlp.output.segments=2 batch_size=256 mlp.input.width=4 rotations=2\n```\n![Piecewise continuous polynomial network.](results/100x40x1hidden.png)\n### Fourier Series\nsimilarly with a fourier series network\n```python\npython examples/implicit_images.py -m mlp.hidden.width=40 mlp.hidden.layers=1 lr=1e-3 mlp.n=3 mlp.n_in=31 mlp.layer_type=fourier batch_size=256 mlp.input.width=4 rotations=2\n```\n![Fourier series network.](results/100x40x1hidden.fourier.png)\n### Piecewise Discontinuous\nand discontinuous polynomial\n```python\npython examples/implicit_images.py -m mlp.hidden.width=40 mlp.hidden.layers=1 lr=1e-3 mlp.n=3 mlp.periodicity=2.0 mlp.layer_type=discontinuous mlp.hidden.segments=2 mlp.input.segments=100 mlp.output.segments=2 batch_size=256 mlp.input.width=4 rotations=2\n```\n![Piecewise discontinuous network.](results/100x40x1hidden.discontinuous.png)\n\n# Implicit Neighborhoods\nTrain interpolator / extrapolator\n```\npython examples/implicit_neighborhood.py mlp.hidden.width=50 mlp.hidden.layers=2 lr=1e-3 mlp.n=2 mlp.periodicity=2.0 mlp.layer_type=continuous mlp.hidden.segments=2 mlp.input.segments=50 mlp.output.segments=2 batch_size=256\n```\ncreate output with trained filter\n```\npython examples/implicit_neighborhood.py train=False checkpoint=\\\"outputs/2022-06-29/15-22-09/lightning_logs/version_0/checkpoints/'epoch=23-step=68448.ckpt'\\\" images=[\"images/jupiter.jpg\"]\n```\nTraining on the image of the newt and applying the filter repeatedly to the image of jupiter gives\nthe following results.\n\n![Piecewise Polynomial Newt to Jupiter.](results/salamander_to_jupiter_sequence.png)\n\nApplying to random noise produces\n\n![Random Noise]()\n\n# Associative Dictionary\nThis approach currently does not work so I'll need to think about it for a while, but it\ndoes run!\nThis is an attempt to store more than one image in a network based on text embedding and associated image. In principle it could also be a generative model if you ask for something not in the dictionary, but we'll see what happens. I'm using the [Pick-a-Pic](https://stability.ai/research/pick-a-pic) so you'll need to download those parquet files - the idea here is not (yet) to train on an enormous dataset but maybe use 10s to 100s of images.\n```\npython3 examples/text_to_image.py batch_size=2000 optimizer=sparse_lion max_epochs=10\n```\n\n# Random Interpolation (A Generative Model)\nThis model picks random pixels and also the pixels locations relative to a target pixel as the training set.  The random pixels also have location information while the target pixel is always at (0,0) as all other pixels are measured relative.  The model learns to predict the\npixel value from these random samples.\n```\npython examples/random_interpolation.py mlp.hidden.width=10 mlp.hidden.layers=2 mlp.n=3 mlp.periodicity=2.0 mlp.hidden.segments=2 mlp.input.segments=100 mlp.output.segments=2 batch_size=1\n```\nand with an image folder\n```\npython examples/random_interpolation.py mlp.hidden.width=10 mlp.hidden.layers=2 mlp.n=3 mlp.periodicity=2.0 mlp.hidden.segments=2 mlp.input.segments=100 mlp.output.segments=2 batch_size=256 folder=/mnt/1000gb/celeba/img_align_celeba\n```\nand run evaluation\n```\npython examples/random_interpolation.py train=false checkpoint=\\\"outputs/2022-06-21/08-39-19/lightning_logs/version_0/checkpoints/epoch=49-step=19800.ckpt\\\"\n```\nExample generated image from celeba dataset.  This is a WIP as I try and figure out the right parameters to get this working - currently suffering some mode collapse.\n\n![Random interpolations for image generation](results/random_interpolation.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjloveric%2Fhigh-order-implicit-representation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjloveric%2Fhigh-order-implicit-representation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjloveric%2Fhigh-order-implicit-representation/lists"}