Repository navigation
fix: self-heal stale annots.pkl cache instead of crashing with KeyError - #1911
Closed
HikeAndMap wants to merge 2 commits into
Closed
HikeAndMap wants to merge 2 commits into
HikeAndMap wants to merge 2 commits into
Conversation
fix: typo in index.rst (Megvii-BaseDetection#1804)
voc_eval() builds a ground-truth annotation cache (annots.pkl) the first time eval runs for an experiment, then trusts it unconditionally on every subsequent eval - there's no check that it still matches the current imagesetfile/dataset. Iterating on a custom dataset (adding images, re-labeling, re-tiling) between training runs without manually deleting <data_dir>/annotations_cache/ causes the next eval to crash with KeyError as soon as it hits an image that wasn't present when the cache was written. This is very likely the real, undiagnosed cause behind several long-open upstream issues that all report the same symptom without ever tracing it to a stale pickle cache (Megvii-BaseDetection#1397, Megvii-BaseDetection#874, Megvii-BaseDetection#1490). Fixed by checking every imagesetfile entry is a key in the loaded recs dict; if any are missing, rebuild the cache from the XML annotations instead of raising. Verified against a real dataset that hit this exact crash - eval now rebuilds the cache and completes normally, and stays fast (no rebuild) on subsequent evals once back in sync.
|
HikeAndMap seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
HikeAndMap
force-pushed
the
fix/stale-annots-cache
branch
from
September 11, 2026 06:36
96ed3f3 to
3cf33c1
Compare
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.
voc_eval() builds a ground-truth annotation cache (annots.pkl) the first time eval runs for an experiment, then trusts it unconditionally on every subsequent eval - there's no check that it still matches the current imagesetfile/dataset. Iterating on a custom dataset (adding images, re-labeling, re-tiling) between training runs without manually deleting <data_dir>/annotations_cache/ causes the next eval to crash with KeyError as soon as it hits an image that wasn't present when the cache was written.
This is very likely the real, undiagnosed cause behind several long-open upstream issues that all report the same symptom without ever tracing it to a stale pickle cache (#1397, #874, #1490).
Fixed by checking every imagesetfile entry is a key in the loaded recs dict; if any are missing, rebuild the cache from the XML annotations instead of raising. Verified against a real dataset that hit this exact crash - eval now rebuilds the cache and completes normally, and stays fast (no rebuild) on subsequent evals once back in sync.