{"id":16858801,"url":"https://github.com/titu1994/tf_neural_deconvolution","last_synced_at":"2026-03-06T04:03:51.229Z","repository":{"id":150947203,"uuid":"261363889","full_name":"titu1994/tf_neural_deconvolution","owner":"titu1994","description":"Neural Deconvolutions in Tensorflow","archived":false,"fork":false,"pushed_at":"2020-05-18T00:10:51.000Z","size":96,"stargazers_count":12,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-05T03:52:36.273Z","etag":null,"topics":["keras","tensorflow","tensorflow2"],"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/titu1994.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-05-05T04:46:56.000Z","updated_at":"2021-08-05T01:45:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a6934f6-3f0d-471a-9c44-cd6e5bcb5776","html_url":"https://github.com/titu1994/tf_neural_deconvolution","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/titu1994/tf_neural_deconvolution","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titu1994%2Ftf_neural_deconvolution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titu1994%2Ftf_neural_deconvolution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titu1994%2Ftf_neural_deconvolution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titu1994%2Ftf_neural_deconvolution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/titu1994","download_url":"https://codeload.github.com/titu1994/tf_neural_deconvolution/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/titu1994%2Ftf_neural_deconvolution/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30161345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"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":["keras","tensorflow","tensorflow2"],"created_at":"2024-10-13T14:15:15.391Z","updated_at":"2026-03-06T04:03:51.166Z","avatar_url":"https://github.com/titu1994.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neural Deconvolutions (Tensorflow)\n\nTensorflow implementation of the `FastDeconv2D` and `ChannelDeconv` layers from the paper [Network Deconvolution](https://openreview.net/forum?id=rkeu30EtvS) by Ye et al. Code ported from the repository - https://github.com/yechengxi/deconvolution/.\n\nTensorflow implementation also support mixed precision training, allowing larger training sizes with no reduction in accuracy (found in `tf_deconv_mixed_prec.py`).\n\n# Usage\n\nSimply download the `tf_deconv.py` script and import `ChannelDeconv2D` and `FastDeconv2D` layers. Mixed precision support can be found in equivalent classes inside `tf_deconv_mixed_prec.py`.\n\nA baseline model has been provided in `models/vgg.py` to try out the architecture. `FastDeconv2D` can replace most Conv2D layer operations.\n\n## Important Note\n-----------------\n\nIt is crucial to initialize your models properly to obtain correct performance. \n\n1) All `FastDeconv2D` kernels are initialized by default using `he_uniform`, and their bias by `BiasHeUniform`. \n\n2) Final `Dense` layer `kernel_initializer` should be `he_uniform` and `bias_initializer` should be `BiasHeUniform`.\n\n--------\n\n```python\nimport tensorflow as tf\nfrom tf_deconv import FastDeconv2D, ChannelDeconv2D, BiasHeUniform\n\nkernel_size = 3\n\ncfg = {\n    'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],\n    'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],\n    'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'],\n    'VGG19': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 256, 'M', 512, 512, 512, 512, 'M', 512, 512, 512, 512, 'M'],\n}\n\n\nclass VGG(tf.keras.Model):\n    def __init__(self, vgg_name, num_classes=10):\n        super(VGG, self).__init__()\n        assert vgg_name in cfg.keys(), \"Choose VGG model from {}\".format(cfg.keys())\n\n        self.features = self._make_layers(cfg[vgg_name])\n        self.channel_deconv = ChannelDeconv2D(block=512)\n        self.classifier = tf.keras.layers.Dense(num_classes, activation='softmax',\n                                                kernel_initializer='he_uniform',\n                                                bias_initializer=BiasHeUniform(),\n                                                )\n\n    def call(self, x, training=None, mask=None):\n        out = self.features(x, training=training)\n        out = self.channel_deconv(out, training=training)\n        out = self.classifier(out)\n        return out\n\n    def _make_layers(self, cfg):\n        layers = []\n        in_channels = 3\n\n        for x in cfg:\n            if x == 'M':\n                layers.append(tf.keras.layers.MaxPool2D())\n            else:\n                if in_channels == 3:\n                    deconv = FastDeconv2D(in_channels, x, kernel_size=(kernel_size, kernel_size), padding='same',\n                                          freeze=True, n_iter=15, block=64, activation='relu')\n                else:\n                    deconv = FastDeconv2D(in_channels, x, kernel_size=(kernel_size, kernel_size), padding='same',\n                                          block=64, activation='relu')\n\n                layers.append(deconv)\n                in_channels = x\n\n        layers.append(tf.keras.layers.GlobalAveragePooling2D())\n        return tf.keras.Sequential(layers)\n```\n\n# Dependencies\n- Tensorflow 2.1+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitu1994%2Ftf_neural_deconvolution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftitu1994%2Ftf_neural_deconvolution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftitu1994%2Ftf_neural_deconvolution/lists"}