Skip to content

Add optional ultrafast COCO backend to detection references - #9666

Draft
developer0hye wants to merge 1 commit into
pytorch:mainfrom
developer0hye:feat/ultrafast-coco-backend
Draft

Add optional ultrafast COCO backend to detection references#9666
developer0hye wants to merge 1 commit into
pytorch:mainfrom
developer0hye:feat/ultrafast-coco-backend

Conversation

@developer0hye

Copy link
Copy Markdown
Contributor

Adds --coco-backend ultrafast to the Detection reference training/test-only scripts, coco_backend="ultrafast" to engine.evaluate(), and backend="ultrafast" to CocoEvaluator. The default remains pycocotools; dataset loading/transforms still use pycocotools. Install the optional evaluator with pip install "ultrafast-pycocotools>=0.1.11,<0.2".

Closes #9665. This is a draft for scope discussion; maintainer agreement is pending. I maintain ultrafast-pycocotools (BSD-2-Clause).

The native evaluator combines evaluation and accumulation. Its distributed path therefore gathers prepared predictions, keeps the first occurrence of each image ID in rank/batch order, sorts the IDs, and evaluates once during synchronization. It explicitly requests per-image records instead of trying to recompute native curves by assigning merged evalImgs. The existing pycocotools evaluation path is retained, with empty-batch/rank handling added. Backend imports are local to each instance, and the source dataset is copied before adaptation.

Validation

  • 9 passed on macOS, Python 3.12 / Torch 2.14, and 9 passed on Linux, Python 3.12 / Torch 2.10 CPU.
  • Exact bbox, segmentation and keypoint precision/recall/scores/stats and per-image matching records; false positives, tied scores, crowd/empty images, conflicting duplicate image IDs, repeated accumulation and pickle before synchronization.
  • Two actual Gloo ranks, including an empty rank; distributed curves also match a single-process reference over unique images.
  • CLI argument parsing and engine.evaluate() with fixed model outputs verify option propagation.
  • Pinned ufmt/black/usort formatting checks and flake8 passed on Python 3.10; git diff --check passed.
  • A focused CPU CI workflow runs these standalone reference-script tests on Python 3.10/3.12. Local tests use installed torchvision wheels; the full torchvision native build, model training and unrelated test suite were not run.

The README explains the different timing boundary: per-batch evaluator_time does not include ultrafast's final synchronization/evaluation work. No end-to-end speedup or memory reduction is claimed from standalone library benchmarks.

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@meta-cla meta-cla Bot added the cla signed label Sep 11, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9666

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional ultrafast COCO evaluation backend in Detection reference scripts

1 participant