Giter Site home page Giter Site logo

nachiket273 / loss-tryout Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 28 KB

PyTorch implementation of polyloss and cyclic focal loss and their performance with sample dataset/s.

License: MIT License

Python 8.00% Jupyter Notebook 92.00%
crossentropyloss focal-loss focalloss polyloss python pytorch python3 loss-functions

loss-tryout's Introduction

loss-tryout

PyTorch implementation of POLYLOSS: A POLYNOMIAL EXPANSION PERSPECTIVE OF CLASSIFICATION LOSS FUNCTIONS

polyloss.py contains the implementation of Poly-1 loss and Poly-1 focal loss.
While polynloss.py contains simple implementations of Poly-N and Poly-N focal loss. Note that this implemenation of Poly-N loss is just for experimenation.

Simple_Example_Polyloss.ipynb is notebook with simple examples of Poly-1 loss usage.

Usage

  1. Git clone the repoository and change to directory
git clone https://github.com/nachiket273/loss-tryout.git
cd loss-tryout
  1. Import
from polyloss import PolyLoss, PolyFocalLoss
  1. Poly crossentropy loss example
import torch
inputs = torch.rand((20, 5))
targets = torch.randint(high=5, size=(20,))
ploss = PolyLoss()
ploss(inputs, targets)
  1. Poly focal loss example
import torch
inputs = torch.rand((20, 5))
targets = torch.randint(high=5, size=(20,))
pfloss = PolyFocalLoss()
pfloss(inputs, targets)

Citations

@misc{POLYLOSS,
    title={POLYLOSS: A POLYNOMIAL EXPANSION PERSPECTIVE OF CLASSIFICATION LOSS FUNCTIONS},
    author={Zhaoqi Leng, Mingxing Tan, Chenxi Liu, Ekin Dogus Cubuk, Xiaojie Shi, Shuyang Cheng, Dragomir Anguelov},
    year={2022},
    url={https://arxiv.org/pdf/2204.12511.pdf},
}

loss-tryout's People

Contributors

nachiket273 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.