Skip to content

[pycocotools] Accept in-memory results in COCO.loadRes - #16570

Merged
srittau merged 1 commit into
python:mainfrom
Blacksujit:pycocotools-loadres-results
Oct 20, 2026
Merged

srittau merged 1 commit into
python:mainfrom
Blacksujit:pycocotools-loadres-results

Conversation

@Blacksujit

Copy link
Copy Markdown
Contributor

COCO.loadRes was typed to take only a file name, but besides a JSON path it also accepts an Nx7 NumPy array (forwarded to loadNumpyAnnotations) or the result list itself, which is how most evaluation code passes detections, so those calls were rejected.

This widens resFile to str | npt.NDArray[np.float64] | list[dict[str, Any]], matching the three branches at runtime.

Upstream source (pycocotools 2.0.11): https://github.com/ppwwyyxx/cocoapi/blob/ac87f5077ad6b8864c2dc5e93d14cae62d1db05a/PythonAPI/pycocotools/coco.py#L307-L326

AI agent used: Claude Code (claude-opus-5-5).

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 2256268 into python:main Oct 20, 2026
74 checks passed
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