mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
TFDWConv() depthwise_initializer
fix (#7845)
This commit is contained in:
parent
05d4fc9db4
commit
b52fd48b4a
@ -97,7 +97,7 @@ class TFDWConv(keras.layers.Layer):
|
|||||||
strides=s,
|
strides=s,
|
||||||
padding='SAME' if s == 1 else 'VALID',
|
padding='SAME' if s == 1 else 'VALID',
|
||||||
use_bias=not hasattr(w, 'bn'),
|
use_bias=not hasattr(w, 'bn'),
|
||||||
kernel_initializer=keras.initializers.Constant(w.conv.weight.permute(2, 3, 1, 0).numpy()),
|
depthwise_initializer=keras.initializers.Constant(w.conv.weight.permute(2, 3, 1, 0).numpy()),
|
||||||
bias_initializer='zeros' if hasattr(w, 'bn') else keras.initializers.Constant(w.conv.bias.numpy()))
|
bias_initializer='zeros' if hasattr(w, 'bn') else keras.initializers.Constant(w.conv.bias.numpy()))
|
||||||
self.conv = conv if s == 1 else keras.Sequential([TFPad(autopad(k, p)), conv])
|
self.conv = conv if s == 1 else keras.Sequential([TFPad(autopad(k, p)), conv])
|
||||||
self.bn = TFBN(w.bn) if hasattr(w, 'bn') else tf.identity
|
self.bn = TFBN(w.bn) if hasattr(w, 'bn') else tf.identity
|
||||||
|
Loading…
x
Reference in New Issue
Block a user