Fix dynamic batch size support for tiny-yolov3 (#678)#695
Open
Aditsharma12 wants to merge 1 commit into
Open
Conversation
Insert Slice node before Squeeze node in yolo_evaluation_layer to make it batch-size independent. Signed-off-by: Adit Sharma <aditsharma2005.vs@gmail.com>
82420f9 to
9877e97
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.
Fixes #678.
This PR resolves the issue where the
tiny-yolov3model failed to run inference on batch sizes greater than 1 due to the Squeeze nodeTFNodes/yolo_evaluation_layer_1/Squeezeattempting to squeeze axis 0 ofimage_shape(which has shape(N, 2)).Changes Made:
Slicenode (TFNodes/yolo_evaluation_layer_1/image_shape_slice) before the squeeze operation to slice the first element along axis 0 (starts=[0],ends=[1],axes=[0]).Squeezenode so it always receives a tensor of shape(1, 2). This can be squeezed safely to(2,)for any batch size.Verification:
Verified using
onnxruntimefor multiple batch sizes:(1, 2535, 4))(1, 5070, 4))(1, 12675, 4))