Skip to content

[Relax][TOPI] Add relax.vision.multibox_transform_loc for SSD/TFLite box decode#18942

Open
Dayuxiaoshui wants to merge 2 commits intoapache:mainfrom
Dayuxiaoshui:main
Open

[Relax][TOPI] Add relax.vision.multibox_transform_loc for SSD/TFLite box decode#18942
Dayuxiaoshui wants to merge 2 commits intoapache:mainfrom
Dayuxiaoshui:main

Conversation

@Dayuxiaoshui
Copy link
Contributor

Introduce relax.vision.multibox_transform_loc with MultiboxTransformLocAttrs: decode center-size offsets against ltrb priors, softmax on class logits, and optional clip, threshold masking, and background score zeroing. Register the C++ op with FInferStructInfo checks for shapes and dtypes (including batch and 4*N consistency). Legalize to topi.vision.multibox_transform_loc.

Add tests for struct inference, invalid inputs, Legalize+e2e on LLVM, attribute branches, and TVMScript roundtrip. Add a standalone numpy reference under topi/testing (not exported from tvm.topi.testing to avoid pulling scipy).

Update TFLite frontend NotImplementedError text for DETECTION_POSTPROCESS and NON_MAX_SUPPRESSION_V5 to note multibox is available and link tracking issue #18928.

…box decode

Introduce relax.vision.multibox_transform_loc with MultiboxTransformLocAttrs: decode center-size offsets against ltrb priors, softmax on class logits, and optional clip, threshold masking, and background score zeroing. Register the C++ op with FInferStructInfo checks for shapes and dtypes (including batch and 4*N consistency). Legalize to topi.vision.multibox_transform_loc.

Add tests for struct inference, invalid inputs, Legalize+e2e on LLVM, attribute branches, and TVMScript roundtrip. Add a standalone numpy reference under topi/testing (not exported from tvm.topi.testing to avoid pulling scipy).

Update TFLite frontend NotImplementedError text for DETECTION_POSTPROCESS and NON_MAX_SUPPRESSION_V5 to note multibox is available and link tracking issue apache#18928.
@Dayuxiaoshui
Copy link
Contributor Author

cc @tlopex

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the multibox_transform_loc operator to TVM Relax, enabling SSD and TFLite-style box decoding. The implementation includes the Relax operator definition, C++ attributes, struct info inference, and a TOPI implementation using TE. Additionally, a NumPy reference implementation and comprehensive unit tests for correctness and TVMScript parsing are provided. Review feedback suggests simplifying nested conditionals in the TOPI implementation for better readability and removing redundant type casts in the reference implementation.

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.

1 participant