Skip to content

Add Swin Transformer Backbone #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AdonaiVera
Copy link

Add Swin Transformer Backbone

This PR adds SwinTransformerBackbone, based on the paper Swin Transformer: Hierarchical Vision Transformer using Shifted Windows. It is the first step to support Grounding DINO in keras-hub, where Swin is the main image encoder.

Related Work

This idea has been discussed in previous threads:

  • keras-cv issue #2114 — community request to support Grounding DINO, which requires Swin.
  • keras-hub issue #2117 — A request to support Swin-UNETR, a model originally designed for 3D medical image segmentation using Swin Transformers for effective feature extraction.

Included in this PR

  • SwinTransformerBackbone model
  • Core layers (PatchEmbedding, WindowAttention, etc.)
  • Unit tests
  • (Presets will be added later)

🧪 Current Status

This PR is still a draft. I’m finishing:

  • Fixing some issues with float16 and float32
  • Preparing a Colab notebook to:
    • Convert pretrained weights from the original repo
    • Compare the outputs with the original model

Let me know if this direction makes sense, or if you have any comments or suggestions. Thanks!

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