Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include each class metrics in logs #445

Merged
merged 5 commits into from
Mar 29, 2021
Merged

Include each class metrics in logs #445

merged 5 commits into from
Mar 29, 2021

Conversation

sshuair
Copy link
Contributor

@sshuair sshuair commented Mar 27, 2021

Add each class metric to the .log and .log.json.

Each class metric format is metric.class:0.43, such as IoU.Persion: 0.2432, Acc:Persion: 0.5434.

This PR Fix the iussue #397

For now the output should be like this:

xxx.log

2021-03-27 23:50:31,241 - mmseg - INFO - Iter(val) [10] mIoU: 0.0492, mAcc: 0.0714, aAcc: 0.6881, IoU.background: 0.6881, IoU.aeroplane: 0.0000, IoU.bicycle: 0.0000, IoU.bird: nan, IoU.boat: 0.0000, IoU.bottle: 0.0000, IoU.bus: nan, IoU.car: 0.0000, IoU.cat: nan, IoU.chair: 0.0000, IoU.cow: 0.0000, IoU.diningtable: nan, IoU.dog: nan, IoU.horse: 0.0000, IoU.motorbike: nan, IoU.person: 0.0000, IoU.pottedplant: nan, IoU.sheep: 0.0000, IoU.sofa: 0.0000, IoU.train: 0.0000, IoU.tvmonitor: 0.0000, Acc.background: 1.0000, Acc.aeroplane: 0.0000, Acc.bicycle: 0.0000, Acc.bird: nan, Acc.boat: 0.0000, Acc.bottle: 0.0000, Acc.bus: nan, Acc.car: 0.0000, Acc.cat: nan, Acc.chair: 0.0000, Acc.cow: 0.0000, Acc.diningtable: nan, Acc.dog: nan, Acc.horse: 0.0000, Acc.motorbike: nan, Acc.person: 0.0000, Acc.pottedplant: nan, Acc.sheep: 0.0000, Acc.sofa: 0.0000, Acc.train: 0.0000, Acc.tvmonitor: 0.0000
| person      | 0.0   | 0.0   |
| pottedplant | nan   | nan   |
| sheep       | 0.0   | 0.0   |
| sofa        | 0.0   | 0.0   |
| train       | 0.0   | 0.0   |
| tvmonitor   | 0.0   | 0.0   |
+-------------+-------+-------+
2021-03-27 23:50:31,240 - mmseg - INFO - Summary:
2021-03-27 23:50:31,240 - mmseg - INFO -
+--------+------+------+-------+
| Scope  | mIoU | mAcc | aAcc  |
+--------+------+------+-------+
| global | 4.92 | 7.14 | 68.81 |
+--------+------+------+-------+
2021-03-27 23:50:31,241 - mmseg - INFO - Iter(val) [10] mIoU: 0.0492, mAcc: 0.0714, aAcc: 0.6881, IoU.background: 0.6881, IoU.aeroplane: 0.0000, IoU.bicycle: 0.0000, IoU.bird: nan, IoU.boat: 0.0000, IoU.bottle: 0.0000, IoU.bus: nan, IoU.car: 0.0000, IoU.cat: nan, IoU.chair: 0.0000, IoU.cow: 0.0000, IoU.diningtable: nan, IoU.dog: nan, IoU.horse: 0.0000, IoU.motorbike: nan, IoU.person: 0.0000, IoU.pottedplant: nan, IoU.sheep: 0.0000, IoU.sofa: 0.0000, IoU.train: 0.0000, IoU.tvmonitor: 0.0000, Acc.background: 1.0000, Acc.aeroplane: 0.0000, Acc.bicycle: 0.0000, Acc.bird: nan, Acc.boat: 0.0000, Acc.bottle: 0.0000, Acc.bus: nan, Acc.car: 0.0000, Acc.cat: nan, Acc.chair: 0.0000, Acc.cow: 0.0000, Acc.diningtable: nan, Acc.dog: nan, Acc.horse: 0.0000, Acc.motorbike: nan, Acc.person: 0.0000, Acc.pottedplant: nan, Acc.sheep: 0.0000, Acc.sofa: 0.0000, Acc.train: 0.0000, Acc.tvmonitor: 0.0000
2021-03-27 23:50:31,745 - mmseg - INFO - Iter [11/40000]        lr: 9.998e-03, eta: 12:59:57, time: 6.345, data_time: 5.846, memory: 3569, decode.loss_seg: 1.6204, decode.acc_seg: 63.9891, loss: 1.6204
2021-03-27 23:50:32,246 - mmseg - INFO - Iter [12/40000]        lr: 9.998e-03, eta: 12:22:44, time: 0.501, data_time: 0.005, memory: 3569, decode.loss_seg: 2.7463, decode.acc_seg: 46.6898, loss: 2.7463
2021-03-27 23:50:32,747 - mmseg - INFO - Iter [13/40000]        lr: 9.997e-03, eta: 11:51:16, time: 0.501, data_time: 0.005, memory: 3569, decode.loss_seg: 1.5349, decode.acc_seg: 69.0987, loss: 1.5349
2021-03-27 23:50:33,249 - mmseg - INFO - Iter [14/40000]        lr: 9.997e-03, eta: 11:24:20, time: 0.502, data_time: 0.005, memory: 3569, decode.loss_seg: 2.2271, decode.acc_seg: 39.2558, loss: 2.2271
2021-03-27 23:50:33,752 - mmseg - INFO - Iter [15/40000]        lr: 9.997e-03, eta: 11:01:03, time: 0.503, data_time: 0.005, memory: 3569, decode.loss_seg: 0.6409, decode.acc_seg: 81.1710, loss: 0.6409
2021-03-27 23:50:34,257 - mmseg - INFO - Iter [16/40000]        lr: 9.997e-03, eta: 10:40:45, time: 0.505, data_time: 0.005, memory: 3569, decode.loss_seg: 1.1608, decode.acc_seg: 62.2077, loss: 1.1608

xxx.log.json

...
{"mode": "val", "epoch": 1, "iter": 10, "lr": 0.01, "mIoU": 0.0577, "mAcc": 0.0977, "aAcc": 0.5454, "IoU.road": 0.7423, "IoU.sidewalk": 0.0, "IoU.building": 0.3544, "IoU.wall": 0.0, "IoU.fence": 0.0, "IoU.pole": 0.0, "IoU.traffic light": 0.0, "IoU.traffic sign": 0.0, "IoU.vegetation": 0.0, "IoU.terrain": 0.0, "IoU.sky": 0.0, "IoU.person": 0.0, "IoU.rider": 0.0, "IoU.car": 0.0, "IoU.truck": 0.0, "IoU.bus": 0.0, "IoU.train": 0.0, "IoU.motorcycle": 0.0, "IoU.bicycle": 0.0, "Acc.road": 0.8795, "Acc.sidewalk": 0.0, "Acc.building": 0.977, "Acc.wall": 0.0, "Acc.fence": 0.0, "Acc.pole": 0.0, "Acc.traffic light": 0.0, "Acc.traffic sign": 0.0, "Acc.vegetation": 0.0, "Acc.terrain": 0.0, "Acc.sky": 0.0, "Acc.person": 0.0, "Acc.rider": 0.0, "Acc.car": 0.0, "Acc.truck": 0.0, "Acc.bus": 0.0, "Acc.train": 0.0, "Acc.motorcycle": 0.0, "Acc.bicycle": 0.0}
...
{"mode": "train", "epoch": 1, "iter": 7, "lr": 0.01, "memory": 3569, "data_time": 0.00477, "decode.loss_seg": 1.78463, "decode.acc_seg": 51.22833, "loss": 1.78463, "time": 0.50375}
{"mode": "train", "epoch": 1, "iter": 8, "lr": 0.01, "memory": 3569, "data_time": 0.00475, "decode.loss_seg": 1.70086, "decode.acc_seg": 60.25438, "loss": 1.70086, "time": 0.50268}
{"mode": "train", "epoch": 1, "iter": 9, "lr": 0.01, "memory": 3569, "data_time": 0.00477, "decode.loss_seg": 1.27715, "decode.acc_seg": 56.3323, "loss": 1.27715, "time": 0.50368}
{"mode": "val", "epoch": 1, "iter": 10, "lr": 0.01, "mIoU": 0.0492, "mAcc": 0.0714, "aAcc": 0.6881, "IoU.background": 0.6881, "IoU.aeroplane": 0.0, "IoU.bicycle": 0.0, "IoU.bird": NaN, "IoU.boat": 0.0, "IoU.bottle": 0.0, "IoU.bus": NaN, "IoU.car": 0.0, "IoU.cat": NaN, "IoU.chair": 0.0, "IoU.cow": 0.0, "IoU.diningtable": NaN, "IoU.dog": NaN, "IoU.horse": 0.0, "IoU.motorbike": NaN, "IoU.person": 0.0, "IoU.pottedplant": NaN, "IoU.sheep": 0.0, "IoU.sofa": 0.0, "IoU.train": 0.0, "IoU.tvmonitor": 0.0, "Acc.background": 1.0, "Acc.aeroplane": 0.0, "Acc.bicycle": 0.0, "Acc.bird": NaN, "Acc.boat": 0.0, "Acc.bottle": 0.0, "Acc.bus": NaN, "Acc.car": 0.0, "Acc.cat": NaN, "Acc.chair": 0.0, "Acc.cow": 0.0, "Acc.diningtable": NaN, "Acc.dog": NaN, "Acc.horse": 0.0, "Acc.motorbike": NaN, "Acc.person": 0.0, "Acc.pottedplant": NaN, "Acc.sheep": 0.0, "Acc.sofa": 0.0, "Acc.train": 0.0, "Acc.tvmonitor": 0.0}
{"mode": "train", "epoch": 1, "iter": 11, "lr": 0.01, "memory": 3569, "data_time": 5.84578, "decode.loss_seg": 1.62035, "decode.acc_seg": 63.98907, "loss": 1.62035, "time": 6.34452}

@xvjiarui
Copy link
Collaborator

Hi @sshuair
Thanks very much for your contribution. It seems that unittest has failed. Could you please fix it?

@codecov
Copy link

codecov bot commented Mar 28, 2021

Codecov Report

Merging #445 (b8985d8) into master (6acd77e) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #445      +/-   ##
==========================================
- Coverage   86.43%   86.37%   -0.06%     
==========================================
  Files          97       97              
  Lines        4960     4963       +3     
  Branches      805      807       +2     
==========================================
  Hits         4287     4287              
- Misses        518      519       +1     
- Partials      155      157       +2     
Flag Coverage Δ
unittests 86.37% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/datasets/custom.py 88.81% <100.00%> (+0.21%) ⬆️
mmseg/datasets/pipelines/transforms.py 97.12% <0.00%> (-0.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6acd77e...b8985d8. Read the comment docs.

@sshuair
Copy link
Contributor Author

sshuair commented Mar 28, 2021

@xvjiarui Hi the unittest has passed. But the codecov still has some problem. I don't know how to fix it.

@xvjiarui
Copy link
Collaborator

Hi @sshuair
It seems that this part it not tested.

@sshuair
Copy link
Contributor Author

sshuair commented Mar 28, 2021

@xvjiarui which part? It seems that the transforms.py caused the problem. But I didn’t modify this file.

@xvjiarui xvjiarui merged commit f7a5d53 into open-mmlab:master Mar 29, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* Include each class metrics in logs

* format

* fix the unitest

* fix the custom int class_name

* fix the custom int class_name
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* use torch.matmul instead of einsum

* fix softmax
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 2023
Co-authored-by: lizz <innerlee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants