torchgeo icon indicating copy to clipboard operation
torchgeo copied to clipboard

Support classwise metrics

Open robmarkcole opened this issue 1 year ago • 3 comments

Summary

This FR is to add support for classwise metrics to the segmentation trainer

Rationale

There can be many classes in a dataset and we want class specific metrics

Implementation

Using the approach of @isaaccorley as here with ClasswiseWrapper and enabled by an optional arg to the segmentation trainer, classwise_metrics: bool = False. To support this an additional labels: Optional[List[str]] = None arg will also be added

Alternatives

None

Additional information

No response

robmarkcole avatar Jun 15 '24 03:06 robmarkcole

Why not always compute both macro and micro statistics in all trainers? I would welcome a PR that adds this.

adamjstewart avatar Jun 15 '24 09:06 adamjstewart

In addition to class wise or instead of? I think that would be nice to have the complete set - with the classwise as optional otherwise the list of metrics can get very long

robmarkcole avatar Jun 15 '24 09:06 robmarkcole

Ah sorry, yeah I meant macro + micro + classwise. As long as that doesn't noticeably slow down training time it should be fine.

adamjstewart avatar Jun 15 '24 17:06 adamjstewart