{"id":23919305,"url":"https://github.com/zhangxjohn/reversible-instance-normalization","last_synced_at":"2025-04-11T20:41:08.971Z","repository":{"id":45906173,"uuid":"503167043","full_name":"zhangxjohn/Reversible-Instance-Normalization","owner":"zhangxjohn","description":"Implementation of RevIN is based on TF2.Keras and PyTorch.","archived":false,"fork":false,"pushed_at":"2023-08-04T02:30:23.000Z","size":164,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T16:46:07.400Z","etag":null,"topics":["instance-normalization","keras","pytorch","revin","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhangxjohn.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":"2022-06-14T01:21:03.000Z","updated_at":"2024-10-24T07:05:21.000Z","dependencies_parsed_at":"2025-01-05T14:49:58.619Z","dependency_job_id":null,"html_url":"https://github.com/zhangxjohn/Reversible-Instance-Normalization","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/zhangxjohn%2FReversible-Instance-Normalization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxjohn%2FReversible-Instance-Normalization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxjohn%2FReversible-Instance-Normalization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangxjohn%2FReversible-Instance-Normalization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangxjohn","download_url":"https://codeload.github.com/zhangxjohn/Reversible-Instance-Normalization/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248478685,"owners_count":21110748,"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":["instance-normalization","keras","pytorch","revin","tensorflow"],"created_at":"2025-01-05T14:39:53.757Z","updated_at":"2025-04-11T20:41:08.944Z","avatar_url":"https://github.com/zhangxjohn.png","language":"Python","readme":"# Reversible-Instance-Normalization\nImplementation of RevIN is based on TF2.Keras and PyTorch.\n\n### Reference\nRevIN is proposed by this paper: [Reversible Instance Normalization for Accurate Time-Series Forecasting against Distribution Shift](https://openreview.net/forum?id=cGDAkQo1C0p).\n\n### Abstract\nStatistical properties such as mean and variance often change over time in time series, i.e., time-series data suffer from a distribution shift problem. This change in temporal distribution is one of the main challenges that prevent accurate time-series forecasting. To address this issue, RevIN proposes a simple yet effective normalization method called reversible instance normalization (RevIN), a generally-applicable normalization-and-denormalization method with learnable affine transformation. The proposed method is symmetrically structured to remove and restore the statistical information of a time-series instance, leading to significant performance improvements in time-series forecasting, as shown in Figs below.\n\n![RevIN](figures/revin.png)\n\n### Quick Start\n\nkeras\n```python\nimport tensorflow as tf\nfrom tensorflow.keras import layers\nfrom revin.revin_keras import RevIN\n\ndata = tf.reshape(tf.range(0, 24), shape=(4, 3, 2))/24\n\nrevinlayer = RevIN()\ninputs = layers.Input(shape=(3, 2))\nx = revinlayer(inputs, mode='norm')\nx = layers.Conv1D(2, kernel_size=1, activation='relu')(x)\noutputs = revinlayer(x, mode='denorm')\n\nmodel = tf.keras.Model(inputs=[inputs], outputs=[outputs])\n```\n\npytorch\n```python\nimport torch\nimport torch.nn as nn\nfrom revin.revin_torch import RevIN\n\nx = torch.reshape(torch.range(0, 23), shape=(4, 3, 2))/24\n\nrevinlayer = RevIN(2)\n\nclass Net(nn.Module):\n    def __init__(self):\n        super(Net, self).__init__()\n        self.revinlayer = RevIN(num_features=2)\n        self.conv1d = nn.Conv1d(in_channels=2, out_channels=2, kernel_size=1)\n\n    def forward(self, x):\n        x = self.revinlayer(x, mode='norm')\n        x = self.conv1d(x)\n        x = nn.ReLU(x)\n        x = self.revinlayer(x, mode='denorm')\n        return x\n```\n\n### Conclusion\n\nJust interested in the first implementation and welcome to test and ask questions.\n\n### Acknowledgments\n\n* [HyperTS](https://github.com/DataCanvasIO/HyperTS): A Full-Pipeline Automated Time Series (AutoTS) Analysis Toolkit.\n* [RevIN](https://github.com/ts-kim/RevIN): The official PyTorch implementation.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangxjohn%2Freversible-instance-normalization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangxjohn%2Freversible-instance-normalization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangxjohn%2Freversible-instance-normalization/lists"}