COCO crowd annotations (iscrowd=1) are counted as ground truth, lowering detection recall and AP
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- computer-vision
Research direction
Read perceptionmetrics/datasets/coco.py, especially CocoDataset.read_annotation(), to see how COCO annotations are converted. Add or run a test with both a normal annotation and one marked iscrowd=1; verify the crowd annotation does not count as a missed object and that the normal detection still scores correctly. The issue also mentions optionally ignoring predictions that match crowd regions, so check the project’s preferred evaluation behavior.
Written by the indexing model from the issue text.
Description
Description
CocoDataset.read_annotation() (perceptionmetrics/datasets/coco.py) returns every COCO annotation, including the ones with iscrowd=1. Nothing else in the repo checks iscrowd, so crowd regions (for example a group of people annotated as one region) are treated as normal objects.
The official COCO evaluation (pycocotools) ignores crowd regions: a missed crowd region is not a false negative, and a detection on one is not a false positive. Here they become false negatives, so recall and AP go down for classes that have crowd annotations, such as person.
Steps to reproduce
One image with a normal person box and a crowd region, and a perfect prediction on the person:
import numpy as np
from perceptionmetrics.utils.detection_metrics import DetectionMetricsFactory
anns = [
{"bbox": [10, 10, 50, 100], "category_id": 1, "iscrowd": 0},
{"bbox": [200, 20, 300, 150], "category_id": 1, "iscrowd": 1}, # crowd region
]
gt_boxes = np.array([[x, y, x + w, y + h] for x, y, w, h in (a["bbox"] for a in anns)], float)
gt_labels = np.array([a["category_id"] for a in anns])
pred_boxes = np.array([[10, 10, 60, 110]], float)
pred_labels, pred_scores = np.array([1]), np.array([0.9])
mf = DetectionMetricsFactory(iou_threshold=0.5)
mf.update(gt_boxes, gt_labels, pred_boxes, pred_labels, pred_scores)
m = mf.compute_metrics()[1]
print(m["TP"], m["FN"], m["Recall"], m["AP"])
Output
On master (b190ec4):
TP=1 FN=1 Recall=0.50 AP=0.545 # crowd region included, as read_annotation returns it today
TP=1 FN=0 Recall=1.00 AP=1.000 # same image with the crowd annotation left out
The crowd region counts as a missed object, so recall is 0.5 and AP is about 0.545, although the only real object was detected perfectly.
Expected behavior
Crowd annotations should be ignored, as in pycocotools.
Proposed fix
Skip annotations with iscrowd=1 in CocoDataset.read_annotation(), and add a test with a crowd annotation. Optionally, predictions that only match a crowd region could also be left out of the false positives, as COCO does. Happy to go with whichever you prefer.
I'd like to work on this if that's okay. Could you assign it to me?
Used an AI assistant to help check this.
- Dominant language
- Python
- Stars
- 115
- Forks
- 117
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 12
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
-
YOLO loader drops images that have no label filePossibly taken @guptakaran20 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JdeRobot/PerceptionMetrics#680 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JdeRobot/PerceptionMetrics#679 ·
Maintainers usually reply within 1 day
-
pm_eval_model crashes with TypeError after the evaluation when --out_fname is not given (regression from #617)Possibly taken @Siddhanthguptaa claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JdeRobot/PerceptionMetrics#675 ·
Maintainers usually reply within 1 day
-
Micro accuracy in segmentation is always the same as macro accuracyPossibly taken @guptakaran20 claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JdeRobot/PerceptionMetrics#674 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] Inference tab renders normalized tensors without inverse normalization.Possibly taken @divyanshAgarwal123 claimed this 67 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
JdeRobot/PerceptionMetrics#524 · 8 comments ·
Maintainers usually reply within 1 day
All issues in JdeRobot/PerceptionMetrics
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OCA/account-invoicing#2529 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textOpenbug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Email validation accepts a trailing newlinePossibly taken @marcello-pichini claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day