Repository navigation
Conversation
Pass each image's resize dimensions and scale factors through inference and postprocessing instead of storing them on the cached detector. Preserve concurrent inference and cover overlapping detections and crops.
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.
Tickets
Self-contained regression in cached CenterFace inference.
What has been done
CenterFace stores the resized image dimensions and scale factors on its shared model object. When requests with different image sizes overlap, one request can decode and rescale its boxes and landmarks using the other request's geometry. The resulting coordinates also select the wrong pixels during face extraction.
Keep the geometry local to each forward call and pass it through inference and postprocessing. The cached ONNX session can continue serving overlapping calls, and sequential decoding retains the same calculations.
Add deterministic concurrency regressions for images with equal and different resized network shapes, face extraction through the normal detection pipeline, and alternating sequential image sizes. The tests use
unittest.mockonly for model construction/inference; OpenCV resizing, decoding, NMS, coordinate conversion, and cropping run normally.How to test
Base: master
8cec026045be164e14b510c55c1264e743dc4999.img1.jpg, resized to 257×331 and 403×249. Synchronizing the return of two real inference calls reproduces a maximum box error of 16.136 pixels and landmark error of 13.792 pixels on the original source. With this change, both requests exactly match their sequential boxes and landmarks. This used ONNX Runtime 1.32.0 on CPU, OpenCV 4.11.0, NumPy 2.3.5, and Python 3.12.14.git diff --checkpass.visit_typealiason both the original and changed module. Compatible Pylint 3.3.9 reports the same two existing positional-argument warnings and 9.83/10 on both versions.The full model/backend suite and GPU execution were not run.