-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
darknet importer: padding is parsed incorrectly for convolutional layers #16259
Copy link
Copy link
Closed
Description
System information (version)
- OpenCV => 4.2.0
- Operating System / Platform => Ubuntu 18.04
- Compiler => g++ 7.4
Detailed description
It appears that the pad value in darknet configuration files indicates the padding mode and not the padding value itself. I think pad being one implies same padding and pad being zero implies manual padding (which is specified in the padding parameter).
The OpenCV darknet parser treats the pad value as the actual padding value. There is also a comment which shows that the original author of the parser was stunned by the weird pad=1 and sets it to zero. It's actually zero because pad=1 would imply a padding of kernel_size//2 which would anyway give zero.
opencv/modules/dnn/src/darknet/darknet_io.cpp
Lines 566 to 567 in 7b12cbd
| // correct the strange value of pad=1 for kernel_size=1 in the Darknet cfg-file | |
| if (kernel_size < 3) pad = 0; |
Reactions are currently unavailable