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

what does "pad = (kernel_size - 1) // 2" mean? #48

Open
bot66 opened this issue Sep 24, 2019 · 1 comment
Open

what does "pad = (kernel_size - 1) // 2" mean? #48

bot66 opened this issue Sep 24, 2019 · 1 comment

Comments

@bot66
Copy link

bot66 commented Sep 24, 2019

darknet.py line 94
still don't get it, I googled a lot, at yolov3.cfg where padding always equal to 1, some say padding is constant( links), and i tried padding = 1 in every loop, end up with error, so I use the original code from darknet.py in this repository, it works, but how "pad = (kernel_size - 1) // 2" ? why?

if padding:
    pad = (kernel_size -1) // 2
else:
    pad = 0
@paleomoon
Copy link

As a beginner, I think pad in yolov3.cfg means whether to use padding. In yolo, only stride controls the output size. If stride = 1, output the same size as input, you must use pad = (kernel_size - 1) // 2.(called Same Convolution). If stride = 2, pad = (kernel_size - 1) // 2, output half size.

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

2 participants