CBAM: unsure if it's 1 ro 3 dense ayers in the shared mlp

This commit is contained in:
Starbeamrainbowlabs 2022-12-02 17:21:13 +00:00
parent 62f6a993bb
commit cad82cd1bc
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -33,15 +33,19 @@ class LayerCBAMAttentionChannel(tf.keras.layers.Layer):
super(LayerCBAMAttentionSpatial, self).__init__(**kwargs)
self.param_dim = dim
self.param_reduction_ratio = reduction_ratio
self.mlp = tf.keras.Sequential([
tf.keras.layers.Dense(self.param_dim),
tf.keras.layers.Dense(self.param_dim / self.param_reduction_ratio),
tf.keras.layers.Dense(self.param_dim)
])
def get_config(self):
config = super(LayerCBAMAttentionSpatial, self).get_config()
config.update({
"dim": self.param_dim
"dim": self.param_dim,
"reduction_ratio": self.param_reduction_ratio
})
return config