Giter Club home page Giter Club logo

Comments (8)

calebrob6 avatar calebrob6 commented on May 26, 2024 2

I verified the behavior of JaccardLoss here https://gist.github.com/calebrob6/658edaa59c68f0c0a510f8d9d7a41458.

Currently our code will always use the average jaccard over all classes regardless of what self.hparams["num_classes"] is.

We definitely should fix this.

@isaaccorley ignore_index support might be a cool feature for the torchseg fork.

from torchgeo.

isaaccorley avatar isaaccorley commented on May 26, 2024 2

TorchSeg now supports both classes and ignore_index in DiceLoss, JaccardLoss, and FocalLoss.

from torchgeo.

calebrob6 avatar calebrob6 commented on May 26, 2024 1

+1 for fiddling with weights in CrossEntropyLoss.

Yep, I can imagine a few scenarios too (e.g. dropping loss over noisy classes). I would usually do this by simply remapping all classes I didn't care about to a nodata mask value, then setting ignore_index to that value, but this is more elegant. My concern now would be implementing this functionality for the other loss functions.

from torchgeo.

isaaccorley avatar isaaccorley commented on May 26, 2024 1

@robmarkcole it's merged into main now. I'll make another pre-release on pypi today.

from torchgeo.

robmarkcole avatar robmarkcole commented on May 26, 2024

I suggest this requires a new arg of classes_in_loss which is a List[int]. This should pop off the ignore_index

from torchgeo.

calebrob6 avatar calebrob6 commented on May 26, 2024

Have you run into scenarios in which you would want to ignore multiple classes? If not, I think we can just pop ignore_index from the entire class list if it is given.

from torchgeo.

robmarkcole avatar robmarkcole commented on May 26, 2024

I've not really used JaccardLoss, and commonly use nn.CrossEntropyLoss where the weights parameter has been very effective for imbalanced datasets. If I understand the use of classes in JaccardLoss it has a simiar purpose, but is binary on/off per class, rather than a weighting

Coming back to your question, for multiclass datasets where I might only care about 1 or 2 classes, I can imagine ignoring multiple classes

from torchgeo.

robmarkcole avatar robmarkcole commented on May 26, 2024

Thanks @isaaccorley

For anyone looking, they are on branch https://github.com/isaaccorley/torchseg/blob/losses/ignore-index/torchseg/losses/

from torchgeo.

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.