{"id":14958640,"url":"https://github.com/johnnixon6972/resnets","last_synced_at":"2026-01-06T22:07:59.022Z","repository":{"id":250721149,"uuid":"835267996","full_name":"JohnNixon6972/ResNets","owner":"JohnNixon6972","description":"Implementations of ResNet-18, ResNet-34, ResNet-50, ResNet-101, and ResNet-152 in TensorFlow 2, based on the \"Deep Residual Learning for Image Recognition\" paper by Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun (2015)","archived":false,"fork":false,"pushed_at":"2024-08-01T14:31:29.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T03:13:37.226Z","etag":null,"topics":["convolutional-neural-networks","keras","neural-network","resnet","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/JohnNixon6972.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-07-29T13:44:21.000Z","updated_at":"2024-08-01T22:28:45.000Z","dependencies_parsed_at":"2024-08-01T16:04:41.081Z","dependency_job_id":null,"html_url":"https://github.com/JohnNixon6972/ResNets","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.5,"last_synced_commit":"39cb8b61bf0339869b7d8b93853622c227779d8d"},"previous_names":["johnnixon6972/resnets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnNixon6972%2FResNets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnNixon6972%2FResNets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnNixon6972%2FResNets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnNixon6972%2FResNets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnNixon6972","download_url":"https://codeload.github.com/JohnNixon6972/ResNets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245579675,"owners_count":20638679,"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":["convolutional-neural-networks","keras","neural-network","resnet","tensorflow"],"created_at":"2024-09-24T13:17:38.684Z","updated_at":"2026-01-06T22:07:58.960Z","avatar_url":"https://github.com/JohnNixon6972.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Every ResNet in TensorFlow 2\n\nThis repository contains implementations of every ResNet model descibed in the [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) paper by Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun (2015). The models are implemented in the [`resnets.py`](./resnets.py) file. The only requirement is TensorFlow 2 or higher (tested with TensorFlow 2.17.0).\n\nThe implemented models are:\n\n- ResNet-18\n- ResNet-34\n- ResNet-50\n- ResNet-101\n- ResNet-152\n\nEach model is implemented as a function that follows this signature:\n\n```py\ndef ResNetN(\n    input_shape: Tuple[int, int, int],\n    output_units: int = 1000,\n    include_top: bool = True,\n    after_input: Optional[Union[Sequential, Layer]] = None,\n    normalize: bool = False,\n    kernel_regularizer: Optional[Union[Regularizer, str]] = None,\n    kernel_initializer: Union[Initializer, str] = \"he_uniform\",\n    flatten: bool = False,\n    dropout_rate: float = 0.0,\n) -\u003e Model\n```\n\nwhere N in the function name is the number of layers in the model that should be replaced with 18, 34, 50, 101, or 152. The function takes the following parameters:\n\n- `input_shape` - Shape of the input images\n- `output_units` - Number of output units used in the last layer if `include_top` is `True` (default: `1000`)\n- `include_top` - Whether to include the network top after global average pooling or the flatten layer (default: `True`)\n- `after_input` - Custom layers to add after the input like preprocessing layers as a Keras model of class [`tf.keras.Sequential`](https://www.tensorflow.org/api_docs/python/tf/keras/Sequential) or as a single layer of class [`tf.keras.layers.Layer`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) (default: `None` - no custom layers)\n- `normalize` - Whether to normalize the input images to the range [0, 1] (default: `False`)\n- `kernel_regularizer` - Kernel regularizer of class [`tf.keras.regularizers.Regularizer`](https://www.tensorflow.org/api_docs/python/tf/keras/regularizers/Regularizer) or as a string (default: `None`)\n- `kernel_initializer` - Kernel initializer of class [`tf.keras.initializers.Initializer`](https://www.tensorflow.org/api_docs/python/tf/keras/initializers/Initializer) or as a string (default: `\"he_uniform\"`)\n- `flatten` - Whether to use a flatten layer instead of a global average pooling layer after the last block (default: `False` - use global average pooling)\n- `dropout_rate` - Dropout rate used after global average pooling or flattening (default: `0.0`)\n\nModels use the [Functional API](https://www.tensorflow.org/guide/keras/functional) of Keras under the hood which defines the model's structure as a directed acyclic graph of layers. The function returns a [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) instance that needs to be compiled and trained.\n\nThe implementation was tested by successfully creating each model and printing its summary to text files. A helper function to print model summaries to text files was used:\n\n```py\ndef write_summary(model: Model, file_path: str) -\u003e None:\n    with open(file_path, \"w\") as f:\n        model.summary(print_fn=lambda x: f.write(x + \"\\n\"))\n```\n\nThe text files are included in the repository and are named [`resnet18.txt`](./resnet18.txt), [`resnet34.txt`](./resnet34.txt), [`resnet50.txt`](./resnet50.txt), [`resnet101.txt`](./resnet101.txt), and [`resnet152.txt`](./resnet152.txt).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnixon6972%2Fresnets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnixon6972%2Fresnets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnixon6972%2Fresnets/lists"}