Giter Site home page Giter Site logo

temperature-scaling-tensorflow's Introduction

Temperature Scaling tensorflow

Tensorflow implementation of On Calibration of Modern Neural Networks.

What this repo can do:

  • Train ResNet_v1_110
  • Calibrate it's output on CIFAR-10/100
  • Using temp_scaling function to calibrate any of your networks using tensorflow.

What this repo cannot do:

  • Calculate ECE (Expected Calibration Error)

Official PyTorch implementation by @gpleiss here.

Prerequisites

Data

Preparation

  • Create data/ folder, download and extract the python version from CIFAR webpage.

Train

First, train the model (ResNet 110 in this case) using default parameters:

python main.py

Check out tunable hyper-parameters:

python main.py --help

Temperature Scaling

Then, do temperature scaling to calibrate your model on the validation set.

python temp_scaling.py

Use the temp_var returned by temp_scaling function with your models logits to get calibrated output.

Notes

  • ResNet_v1_110 is trained for 250 epochs with other default parameters introduced in the original ResNet paper.
  • The identity shortcut in ResNet_v1_110 is replaced with projection shortcut, meaning there are two additional convolutional layers.
  • Validation accuracy and test accuracy on CIFAR-100 are around 70%.
  • Issues are welcome!

Resources

temperature-scaling-tensorflow's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

temperature-scaling-tensorflow's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.