Giter VIP home page Giter VIP logo

Comments (2)

HKervadec avatar HKervadec commented on September 18, 2024

Hey there,

I noticed that in probs2class, you use probs.argmax (dim = 1) to get the class, but if I only have one featuremap, the part above a certain threshold is the text area, how do I use surface loss?

Few things:

  • probs2class is to be used only for visualization/predictions, not for training, as argmax is non-derivable
  • argmax on two classes is effectively a thresholding with t=0.5

Can I einsum the foreground distance map and the logits map directly?

The foreground distance map yes, and the probability map ; not the raw logits. So just put then through a softmax first.

If I do this, I find that if the predicted text area is smaller than the real text area, the loss does not change, because the value of the text area in dist_map is 0, will this cause the prediction result to be too small?

The distance map is supposed to be signed:

  • Positive outside the object
  • Negative inside the object (the text area you are interested in)

If you end-up with the distance map inside the text area to be 0, then there is some problem in your pre-processing. Per the function definition, for the 1-class binary case, you end up with (simplified):

...
posmask = seg.astype(np.bool)
negmask = ~posmask

res = distance(negmask) * negmask - (distance(posmask) - 1) * posmask
...

The -1 is just a shift to have the distance on the boundary to be 0. Depending on the application, I guess you could remove that part.

from boundary-loss.

Whu-wxy avatar Whu-wxy commented on September 18, 2024

Thanks for your help!I think I have made it clear, I will try it in subsequent experiments.

from boundary-loss.

Related Issues (20)

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.