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)
- Switch from SMP to TorchSeg HOT 1
- Add plot method to IntersectionDataset HOT 1
- v0.5.2 missing PRs HOT 2
- Use ruff
- Add Inference Example HOT 1
- Switch coverage providers? HOT 1
- Auto download fails for FireRisk HOT 11
- Anomaly with RandomGrayScale tests HOT 2
- Add YAML formatter HOT 16
- Change documentation theme HOT 1
- CDL: cannot redownload additional years HOT 20
- Overrideable resample property for IntersectionDataset
- UnionDataset of two IntersectionDataset fails HOT 2
- RandomBatchGeoSampler produces nan or nodata values HOT 6
- Check if bbox of intersection is valid HOT 4
- Git clone and pip install results in 'Successfully installed UNKNOWN-0.0.0' HOT 10
- class_weights cannot be passed via config file as a tensor is expected HOT 5
- README.md benchmark dataset code HOT 17
- AgriFieldNet missing filename glob HOT 3
- CLI script for test 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.