Comments (8)
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.
TorchSeg now supports both classes
and ignore_index
in DiceLoss
, JaccardLoss
, and FocalLoss
.
from torchgeo.
+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.
@robmarkcole it's merged into main now. I'll make another pre-release on pypi today.
from torchgeo.
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.
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.
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.
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)
- Incompatible image size with RandomGeoSampler HOT 3
- Easier way to use Data Processing steps outside of datamodule HOT 4
- Benchmarking of all pre-trained weights HOT 4
- Add instructions on downloading the DeepGlobeLandCover dataset HOT 5
- The new lightly release breaks BaseTask with timm imports HOT 5
- SSL Weight Decay HOT 6
- Migrate from Radiant MLHub to Source Cooperative HOT 13
- Datamodule augmentation defaults HOT 8
- NCCM checksum error HOT 6
- Support additional SatlasPretrain models. HOT 6
- Document significance of macro vs micro averaging HOT 3
- Add BalancedRandomGeoSampler balancing positives and negatives HOT 2
- Add support for Lightning Streaming Dataset HOT 14
- OSCDDataModule initialises with batch_size 1, ignoring the configured batch_size HOT 4
- Add `ignore_index` support for Jaccard Loss HOT 1
- Unpin torch, use a min or range? HOT 4
- GeoDataset: non-deterministic behavior HOT 5
- Sentinel 2 dataset can't see files downloaded from Copernicus Browser - filename doesn't fit regex HOT 1
- Errors & improvements in Metrics descriptions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchgeo.