Micro accuracy in segmentation is always the same as macro accuracy
Maintainers usually reply within 1 day
@guptakaran20 is already working on this.
Since Nov 7, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- numpy, python
- Domain
- computer-vision, machine-learning, testing
Research direction
Start by reading perceptionmetrics/utils/segmentation_metrics.py, especially get_tn(per_class=False) and the micro accuracy calculation. Reproduce the issue with the NumPy example in the report, then check any segmentation metric tests covering averaged accuracy. Done when micro accuracy reports 4/6 (0.667) for the example and macro behavior remains correct.
Written by the indexing model from the issue text.
Description
Micro accuracy for segmentation is not the real pixel accuracy, and it always comes out the same as macro accuracy.
Example with 3 classes and 6 pixels, 4 predicted right. Real accuracy is 0.667 but both show 0.778:
import numpy as np
from perceptionmetrics.utils.segmentation_metrics import SegmentationMetricsFactory
m = SegmentationMetricsFactory(n_classes=3)
m.update(np.array([0, 0, 1, 1, 0, 0]), np.array([0, 0, 1, 1, 2, 2]))
print(m.get_averaged_metric("accuracy", "macro")) # 0.778
print(m.get_averaged_metric("accuracy", "micro")) # 0.778
I think it is because get_tn(per_class=False) adds up the true negatives of every class.
Possible fix: for micro, use correct pixels / total pixels.
- Dominant language
- Python
- Stars
- 114
- Forks
- 116
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JdeRobot/PerceptionMetrics
-
pm_eval_model crashes with TypeError after the evaluation when --out_fname is not given (regression from #617)Possibly taken @Siddhanthguptaa claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JdeRobot/PerceptionMetrics#675 ·
Maintainers usually reply within 1 day
-
Segmentation metrics give wrong results or crash for invalid predicted classesPossibly taken @soujasK claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JdeRobot/PerceptionMetrics#659 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug] Inference tab renders normalized tensors without inverse normalization.Possibly taken @divyanshAgarwal123 claimed this 61 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
JdeRobot/PerceptionMetrics#524 · 8 comments ·
Maintainers usually reply within 1 day
-
Detection AUC-PR is underestimated: the curve is not anchored at recall 0, so a perfect detector scores (N-1)/NPossibly taken @Siddhanthguptaa claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
JdeRobot/PerceptionMetrics#672 ·
Maintainers usually reply within 1 day
-
YOLO TorchScript model fails to load on Apple Silicon (MPS float64 error)Possibly taken @guptakaran20 claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 65/100
JdeRobot/PerceptionMetrics#671 · 1 comment ·
Maintainers usually reply within 1 day
All issues in JdeRobot/PerceptionMetrics
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
RunestoneInteractive/rs#1661 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
streamlink/streamlink#7192 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws-samples/sample-per-model-bedrock#795 ·
Maintainers usually reply within 1 day