{"id":20063272,"url":"https://github.com/markdtw/temperature-scaling-tensorflow","last_synced_at":"2025-10-29T19:39:53.594Z","repository":{"id":93067263,"uuid":"137570907","full_name":"markdtw/temperature-scaling-tensorflow","owner":"markdtw","description":"On Calibration of Modern Neural Networks - tensorflow implementation","archived":false,"fork":false,"pushed_at":"2018-06-16T11:19:18.000Z","size":6,"stargazers_count":30,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T02:06:11.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/markdtw.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-06-16T09:57:56.000Z","updated_at":"2024-07-09T09:05:38.000Z","dependencies_parsed_at":"2023-04-10T00:48:42.063Z","dependency_job_id":null,"html_url":"https://github.com/markdtw/temperature-scaling-tensorflow","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/markdtw%2Ftemperature-scaling-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdtw%2Ftemperature-scaling-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdtw%2Ftemperature-scaling-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdtw%2Ftemperature-scaling-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markdtw","download_url":"https://codeload.github.com/markdtw/temperature-scaling-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252542389,"owners_count":21764959,"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":[],"created_at":"2024-11-13T13:41:26.923Z","updated_at":"2025-10-29T19:39:53.516Z","avatar_url":"https://github.com/markdtw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Temperature Scaling tensorflow\nTensorflow implementation of [On Calibration of Modern Neural Networks](https://arxiv.org/abs/1706.04599).\n\nWhat this repo can do:\n\n- Train ResNet_v1_110\n- Calibrate it's output on CIFAR-10/100\n- Using ```temp_scaling``` function to calibrate any of your networks using tensorflow.\n\nWhat this repo *cannot* do:\n\n- Calculate ECE (Expected Calibration Error)\n\nOfficial PyTorch implementation by @gpleiss [here](https://github.com/gpleiss/temperature_scaling).\n\n## Prerequisites\n- Python 3.5\n- [NumPy](http://www.numpy.org/)\n- [TensorFlow 1.8](https://www.tensorflow.org/)\n\n\n## Data\n- [CIFAR-10/100](https://www.cs.toronto.edu/~kriz/cifar.html)\n\n\n## Preparation\n- Create `data/` folder, download and extract the python version from CIFAR webpage.\n\n\n## Train\nFirst, train the model (ResNet 110 in this case) using default parameters:\n```bash\npython main.py\n```\nCheck out tunable hyper-parameters:\n```bash\npython main.py --help\n```\n\n## Temperature Scaling\nThen, do temperature scaling to calibrate your model on the validation set.\n```bash\npython temp_scaling.py\n```\nUse the ```temp_var``` returned by ```temp_scaling``` function with your models logits to get calibrated output.\n\n\n## Notes\n- ResNet_v1_110 is trained for 250 epochs with other default parameters introduced in the original ResNet paper.\n- The identity shortcut in ResNet_v1_110 is replaced with projection shortcut, meaning there are two additional convolutional layers.\n- Validation accuracy and test accuracy on CIFAR-100 are around 70%.\n- Issues are welcome!\n\n\n## Resources\n- [The paper](https://arxiv.org/abs/1706.04599).\n- [Official PyTorch Implementation](https://github.com/gpleiss/temperature_scaling)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdtw%2Ftemperature-scaling-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkdtw%2Ftemperature-scaling-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdtw%2Ftemperature-scaling-tensorflow/lists"}