Skip to content
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

Issue about the padding when building the PatchEmbedding layer #125

Open
what-is-available-for-name opened this issue Dec 28, 2023 · 1 comment

Comments

@what-is-available-for-name

When I step-by-step debugged with the config (ViTPose_small_simple_coco_256x192.py),
I found a confusing value in the parameters of the PatchEmbedding layer as the padding below:
self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=(patch_size[0] // ratio), padding=4 + 2 * (ratio//2-1))

When I run the train.py, the padding value would be padding = 4 + 2 * (1 // 2 - 1) = 2. It would cause the backbone to miss two columns at the right side of the origin image and two rows at the bottom of the origin image, because Patch_size = 16 and it divides evenly into the img_size(256x192).

Could you please explain the details about this issue?

@what-is-available-for-name
Copy link
Author

1.pdf
A figure in pdf to help understand my issue

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

No branches or pull requests

1 participant