Add Detectron2 model support to accuracy checker - #4046
Open
pwolnows wants to merge 14 commits into
Open
Conversation
test_annotation_conversion_save_subset asserted save_annotation was called with the subsampled annotation, which matched the old behavior before commit fd2c122 changed save_annotation to always run before subsetting. Update the test to expect the full converted annotation.
When cv2 isn't importable at install time, setup.py appended an unpinned opencv-python to install_requires, which resolved to opencv-python 5.0.0 in CI and broke test_opencv_launcher.py (Caffe importer removed, ONNX API changes). Pin to the same versions used in requirements-extra.in.
opencv-python==4.6.0.66 is compiled against the numpy 1.x C-API ABI, but requirements-core.in allows numpy<2.1.0, so pip can resolve numpy==2.0.x and crash on 'import cv2' with an ABI mismatch. Bump to opencv-python==4.10.0.84 (already used for python>=3.12) in both the setup.py fallback and requirements-extra.in, since it is compatible with numpy 2.x and still supports the Caffe importer.
- wrap the long initial_retry_delay description line under 120 cols - always raise last_error at the end of wrapper() so pylint doesn't flag inconsistent-return-statements
sstrehlk
approved these changes
Aug 20, 2026
pwolnows
enabled auto-merge (squash)
August 20, 2026 15:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Detectron2 model support to the PyTorch launcher and accuracy checker adapters, hardens dataset reading against transient OS-level I/O errors, and includes a handful of related fixes and dependency updates picked up along the way.
Detectron2 Support
Detectron2Adapter(accuracy_checker/adapters/detectron2.py) to convert Detectron2Instances-based output intoDetectionPrediction/InstanceSegmentationPredictionrepresentations, with 0-based class indexing.Detectron2Wrapper(accuracy_checker/launcher/detectron2_wrapper.py), a compatibility adapter that:[{"image": tensor}, ...]dict format expected by Detectron2 models;pred_boxes,pred_classes,pred_masks, andscoresfrom the returnedInstancesobjects;PyTorchLaunchergains ause_detectron2_wrapperconfig flag that delegates model preparation and checkpoint loading toDetectron2Wrapper, keeping Detectron2-specific logic out of the generic launcher code path.pytorch_launcher_readme.md, including a sample config.Retry on Transient Read Errors
BaseReadernow retries reads that fail with a transientOSError(e.g. flaky network shares), instead of failing the whole dataset validation run.read_retry_attempts(default1, i.e. no retry)read_retry_delay(default0.1seconds)data_readers/README.mdwith a config example.TestBaseReaderRetry::test_retry_transient_read_errorcovering the retry-then-succeed path.Dataset & Evaluator Fixes
sub_evaluationis combined with subset settings.Testing
tests/test_config_validator.py::TestBaseReaderRetry::test_retry_transient_read_error— verified passing.