catalyst-team / catalyst

Accelerated deep learning R&D
https://catalyst-team.com
Apache License 2.0
3.3k stars 388 forks source link

Segmentation metric callback outputs don't contain per-class values in current version #1392

Closed chekhovana closed 2 years ago

chekhovana commented 2 years ago

🐛 Bug Report

In the previous version (21.10) output from DiceCallback and IOUCallback contained per-class values, but in the current version these values are missing.

How To Reproduce

Run the code sample provided below.

#### Code sample ``` import torch from torch import nn from torch.utils.data import DataLoader, Dataset from catalyst import dl class DummyDataset(Dataset): def __getitem__(self, idx): w = h = 100 image = torch.rand((3, w, h)) mask = torch.rand((3, w, h)) return image, mask def __len__(self): return 4 class DummyModel(nn.Module): def forward(self, inputs): return inputs dataset = DummyDataset() loader = DataLoader(dataset, batch_size=4) model = DummyModel() runner = dl.SupervisedRunner(model=model, input_key="image", output_key="outputs", target_key="mask" ) callbacks = [ dl.IOUCallback(input_key="outputs", target_key="mask"), dl.DiceCallback(input_key='outputs', target_key='mask') ] metrics = runner.evaluate_loader(loader=loader, callbacks=callbacks) ``` ### Expected behavior Current version (21.12) output: ``` 21.12 output valid (1/1) dice: 0.5007089972496033 | dice/_macro: 0.5007089972496033 | dice/_micro: 0.5007092356681824 | iou: 0.33396410942077637 | iou/_macro: 0.33396410942077637 | iou/_micro: 0.333964079618454 ``` Expected output (as it was in 21.10 version) ``` valid (1/1) dice: 0.5007089972496033 | dice/_macro: 0.5007089972496033 | dice/_micro: 0.5007092356681824 | dice/class_00: 0.5014960169792175 | dice/class_01: 0.5007226467132568 | dice/class_02: 0.49990835785865784 | iou: 0.33396410942077637 | iou/_macro: 0.33396410942077637 | iou/_micro: 0.333964079618454 | iou/class_00: 0.3346644341945648 | iou/class_01: 0.33397597074508667 | iou/class_02: 0.3332518935203552 ```

Environment

Catalyst version: 21.12
PyTorch version: 1.10.1+cu102
TensorBoard version: 2.7.0
OS: Ubuntu 18.04.5 LTS
Python version: 3.7
CUDA runtime version: 10.2
Nvidia driver version: 460.32.03
cuDNN version: None
github-actions[bot] commented 2 years ago

Hi! Thank you for your contribution! Please re-check all issue template checklists - unfilled issues would be closed automatically. And do not forget to join our slack for collaboration.

Scitator commented 2 years ago

Yeah, that's right, please follow the changelog and docs: