Skip to content

Fix dynamic batch size support for tiny-yolov3 (#678)#695

Open
Aditsharma12 wants to merge 1 commit into
onnx:mainfrom
Aditsharma12:fix-678-tiny-yolov3-dynamic-batch
Open

Fix dynamic batch size support for tiny-yolov3 (#678)#695
Aditsharma12 wants to merge 1 commit into
onnx:mainfrom
Aditsharma12:fix-678-tiny-yolov3-dynamic-batch

Conversation

@Aditsharma12

Copy link
Copy Markdown

Fixes #678.

This PR resolves the issue where the tiny-yolov3 model failed to run inference on batch sizes greater than 1 due to the Squeeze node TFNodes/yolo_evaluation_layer_1/Squeeze attempting to squeeze axis 0 of image_shape (which has shape (N, 2)).

Changes Made:

  • Added a Slice node (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]).
  • Directed the output of this slice to the Squeeze node so it always receives a tensor of shape (1, 2). This can be squeezed safely to (2,) for any batch size.

Verification:

Verified using onnxruntime for multiple batch sizes:

  • Batch Size 1: Succeeded (Output Shape: (1, 2535, 4))
  • Batch Size 2: Succeeded (Output Shape: (1, 5070, 4))
  • Batch Size 5: Succeeded (Output Shape: (1, 12675, 4))

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>
@Aditsharma12 Aditsharma12 force-pushed the fix-678-tiny-yolov3-dynamic-batch branch from 82420f9 to 9877e97 Compare June 22, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic batch sizes are not supported in tiny-yolov3 model

1 participant