"tests/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "46bcddf4f256a6cb2f403bf0ab495b24b8d7b088"
Unverified Commit d4a6670a authored by Bilal Alsallakh's avatar Bilal Alsallakh Committed by GitHub
Browse files

fix index error, to support non-square kernels (#8421)

With kernel=[3, 3] in all entries of MOBILENETV1_CONV_DEFS, the latent index error (likely due to copy-paste) did not cause problems.
Fix is needed to ensure proper padding with non-square kernels.
parent e72080fe
...@@ -155,7 +155,7 @@ def _fixed_padding(inputs, kernel_size, rate=1): ...@@ -155,7 +155,7 @@ def _fixed_padding(inputs, kernel_size, rate=1):
input, either intact (if kernel_size == 1) or padded (if kernel_size > 1). input, either intact (if kernel_size == 1) or padded (if kernel_size > 1).
""" """
kernel_size_effective = [kernel_size[0] + (kernel_size[0] - 1) * (rate - 1), kernel_size_effective = [kernel_size[0] + (kernel_size[0] - 1) * (rate - 1),
kernel_size[0] + (kernel_size[0] - 1) * (rate - 1)] kernel_size[1] + (kernel_size[1] - 1) * (rate - 1)]
pad_total = [kernel_size_effective[0] - 1, kernel_size_effective[1] - 1] pad_total = [kernel_size_effective[0] - 1, kernel_size_effective[1] - 1]
pad_beg = [pad_total[0] // 2, pad_total[1] // 2] pad_beg = [pad_total[0] // 2, pad_total[1] // 2]
pad_end = [pad_total[0] - pad_beg[0], pad_total[1] - pad_beg[1]] pad_end = [pad_total[0] - pad_beg[0], pad_total[1] - pad_beg[1]]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment