{"id":16915692,"url":"https://github.com/nvti/resnet","last_synced_at":"2026-05-20T03:03:59.213Z","repository":{"id":90552489,"uuid":"379982305","full_name":"nvti/resnet","owner":"nvti","description":"An implementation of ResNet in tensorflow 2.0","archived":false,"fork":false,"pushed_at":"2021-07-01T15:08:35.000Z","size":217,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T18:30:58.698Z","etag":null,"topics":["computer-vision","resnet","tensorflow2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-06-24T16:08:07.000Z","updated_at":"2024-11-17T11:13:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd320196-9060-4459-bb30-93cfba32e961","html_url":"https://github.com/nvti/resnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"nvti/template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvti%2Fresnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvti%2Fresnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvti%2Fresnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvti%2Fresnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvti","download_url":"https://codeload.github.com/nvti/resnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244688599,"owners_count":20493846,"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":["computer-vision","resnet","tensorflow2"],"created_at":"2024-10-13T19:21:58.516Z","updated_at":"2026-05-20T03:03:54.191Z","avatar_url":"https://github.com/nvti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Implementation of ResNet in tensorflow 2\n\nMy implementation for paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385), using [tensorflow 2](https://www.tensorflow.org/)\n\n![ResNet model architecture](docs/images/resnet.png)\n\n\u003e ResNet model architecture (figure from the paper)\n\n## Pre-requirement\n\nInstall dependence package with pip:\n\n```\npip install -r requirements.txt\n```\n\n## Setup dataset folder\n\nThis library use `image_dataset_from_directory` API from Tensorflow 2.0 to load images. You can read more about this API [here](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image_dataset_from_directory)\n\nDataset directory structure:\n\n```\nmain_directory/\n...class_a/\n......a_image_1.jpg\n......a_image_2.jpg\n...class_b/\n......b_image_1.jpg\n......b_image_2.jpg\n```\n\n## Training\n\nI create `train.py` for training model.\n\n```\nusage: train.py [-h] [--model MODEL] [--classes CLASSES] [--lr LR] [--batch-size BATCH_SIZE] [--epochs EPOCHS] [--image-size IMAGE_SIZE] [--image-channels IMAGE_CHANNELS]\n                [--train-folder TRAIN_FOLDER] [--valid-folder VALID_FOLDER] [--model-folder MODEL_FOLDER]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --model MODEL         Type of ResNet model, valid option: resnet18, resnet34, resnet50, resnet101, resnet152\n  --classes CLASSES     Number of classes\n  --lr LR               Learning rate\n  --batch-size BATCH_SIZE\n                        Batch size\n  --epochs EPOCHS       Number of training epoch\n  --image-size IMAGE_SIZE\n                        Size of input image\n  --image-channels IMAGE_CHANNELS\n                        Number channel of input image\n  --train-folder TRAIN_FOLDER\n                        Where training data is located\n  --valid-folder VALID_FOLDER\n                        Where validation data is located\n  --model-folder MODEL_FOLDER\n                        Folder to save trained model\n```\n\nAn example command for training:\n\n```\npython train.py --model resnet18 --epochs 10 --num-classes 2\n```\n\nAfter training successfully, your model will be saved to `model-folder`, default is `./output`\n\n## Prediction\n\nAfter your model is trained successfully, you can test your model with `predict.py` script:\n\n```\npython predict.py --test-image ./test.png --image-size=28\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvti%2Fresnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvti%2Fresnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvti%2Fresnet/lists"}