Code Monkey home page Code Monkey logo

I have a question of gamma value in paper, In fact, if gamma less than one, if p values is bigger which means this is easy example, and (1-p)**gamma will result in a bigger weight for ctc loss, it is different from idea of focal loss. As in paper, easy example will get bigger weight and hard example get less weight about focal-ctc-omr HOT 1 CLOSED

jimitshah77 avatar jimitshah77 commented on September 24, 2024
I have a question of gamma value in paper, In fact, if gamma less than one, if p values is bigger which means this is easy example, and (1-p)**gamma will result in a bigger weight for ctc loss, it is different from idea of focal loss. As in paper, easy example will get bigger weight and hard example get less weight

from focal-ctc-omr.

Comments (1)

jimitshah77 avatar jimitshah77 commented on September 24, 2024 1

No the idea proposed in the paper is correct. It is the relative loss which matters. That is if it is a hard example(p<0.5) it should contribute more to the loss, and if it is a easy example(p>0.5) it should contribute less to the loss.
For example:
p=0.3 for hard example
p=0.7 for easy example
gamma=0.5
hard_loss=(1-p)=1-0.3=0.7 sqrt(0.7)=0.83
easy_loss=(1-p)=1-0.7=0.3 sqrt(0.3)=0.54
hard_loss>easy_loss
Another example:
p=0.3 for hard example
p=0.7 for easy example
gamma=2.0
hard_loss=(1-p)=1-0.3=0.7 sq(0.7)=0.49
easy_loss=(1-p)=1-0.7=0.3 sq(0.3)=0.09
hard_loss>easy_loss

Here gamma controls the relative difference between the losses. If the dataset set is highly skewed choose higher value of gamma.
(Check this out. This shows how different gamma values will impact loss during training)
image

In sequence tasks like OCR/OMR we have to distribute the p over many symbols, but the sum of probabilities remains 1 (sum(p)=1). Therefore we select lower gamma value(but greater than 0) as long as we maintain the relative loss.

Inshort, gamma(>0) controls the relative loss we want to impose on easy and hard samples.

if a>b
then a^n > b^n holds true
as long as n>0.

Image Source: Focal Loss for Dense Object Detection. (https://arxiv.org/pdf/1708.02002.pdf)

from focal-ctc-omr.

Related Issues (3)

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.