{"id":19959015,"url":"https://github.com/lunaluxie/interpolated-kernels","last_synced_at":"2026-05-16T18:36:59.141Z","repository":{"id":159358255,"uuid":"159039888","full_name":"lunaluxie/interpolated-kernels","owner":"lunaluxie","description":"Efficient kernels for high-res convolutional networks 🔄🔧⚡📈","archived":false,"fork":false,"pushed_at":"2019-07-09T23:21:12.000Z","size":41903,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T07:30:33.164Z","etag":null,"topics":["cnn","tensorflow"],"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/lunaluxie.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}},"created_at":"2018-11-25T14:24:51.000Z","updated_at":"2024-05-24T07:46:56.000Z","dependencies_parsed_at":"2023-05-26T23:15:40.531Z","dependency_job_id":null,"html_url":"https://github.com/lunaluxie/interpolated-kernels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunaluxie%2Finterpolated-kernels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunaluxie%2Finterpolated-kernels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunaluxie%2Finterpolated-kernels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunaluxie%2Finterpolated-kernels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lunaluxie","download_url":"https://codeload.github.com/lunaluxie/interpolated-kernels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241389166,"owners_count":19955107,"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","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":["cnn","tensorflow"],"created_at":"2024-11-13T01:45:48.061Z","updated_at":"2026-05-16T18:36:54.099Z","avatar_url":"https://github.com/lunaluxie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interpolated Kernels\n\n\u003e NOTE: This project is work in progress.\n\u003e Progress is currently limited due to upcoming exam season. \n\nThis project is an attempt to create an efficient convolutional kernel with a large dense window size for very high resolution inputs.\n\nIt achieves this by using sparse kernels similar to [dilated kernels by Y Li et. al.](https://arxiv.org/abs/1802.10062), but offers more flexibility for the weight positions.\n\nThe remaining positions are then interpolated using an interpolation strategy which adds a relatively small amount of extra computation during the forward propagation phase which is offset by heavily reducing the number of parameters required to optimize during backpropagation. \n\n![explanitory image](./imgs/explanitory_image.PNG)\n\nThis method is desirable over dilated kernels whenever \n1. You require dense kernels. \n2. Your input distribution is regular and you want to heavily reduce the number of parameters, or higher accuracy.\n3. You need more flexibility of the positions of the kernel weights. \n\nCurrently, this implementation is especially suitable for:\n- High resolution 1 channel (black and white) images\n- 2d energy landscapes\n- 3d energy landscapes\n\n\n## Feature Comparison\n\n| |Our solution|Dilated Kernels|Conventional Kernels\n-----|-----|-----|-----\nSpeed|Fast -\u003e Faster [1]|Faster|Slow\n\\# Parameters|Fewest|Few|Many\nWindow size|Large|Large|Small\nEffective Density|Dense|Sparse|Dense\nA priori knowledge| Flexible | Some | Limited\n\n[1]: Depending on the regularity of the data, our solution can be just as fast if not faster than dilated kernels. \n\n## Installation\nTK\n\n## Usage\nThis [Tensorflow](tensorflow.org) implementation offers a Keras compatible layer which you can plug into your model to replace `conv2d` layers. \n\nSimple usage:\n```Python\nimport tensorflow as tf\n\nfrom interpolated_kernels.layers import InterpolatedConv2d\nfrom interpolated_kernels.utils import symmetric_filters\n\nn_filters = 5\nkernel_coordinates = [\n    [0,0,1], # [height, width, channel] coordinates\n    [1,1,1],\n    [2,2,1],\n]\n\n# we use the `symmetric_filtes` helper function\n# to replicate the same known positions across \n# all filters.\nfilters = symmetric_filters(kernel_coordinates, n_filters)\n\n\nkernel_size = 4 # the size of the interpolated kernel\n\n# a standard callable keras layer. \nlayer = InterpolatedConv2d(filters, kernel_size)\n\n# the input to the layer \n# a rank 4 tensor with size: \n# [batch, height, width, channels]\nimg_tensor = tf.ones([5, 11, 11, 3])\n\n# compute the output volume\nv = layer(img_tensor)\n```\n\nIf `channels == 1`, then omit the channels dimension\n```\nkernel_coordinates = [\n    [0,0], # [height, width] coordinates\n    [1,1],\n    [2,2],\n]\n```\n\n\nTK: `op` mode.\n\nTK: change interpolation engine.\n\n## Acknowledgements\nThis project wouldn't have been possible without support from [Hammer research group](http://users-phys.au.dk/hammer/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunaluxie%2Finterpolated-kernels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flunaluxie%2Finterpolated-kernels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunaluxie%2Finterpolated-kernels/lists"}