mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-22 17:23:01 +00:00
drop activation function in last layers
This commit is contained in:
parent
bcd2f1251e
commit
dbf8f5617c
2 changed files with 6 additions and 5 deletions
|
@ -69,12 +69,13 @@ def model_rainfallwater_mono(metadata, model_arch_enc="convnext_xtiny", model_ar
|
||||||
|
|
||||||
# TODO: An attention layer here instead of a dense layer, with a skip connection perhaps?
|
# TODO: An attention layer here instead of a dense layer, with a skip connection perhaps?
|
||||||
logger.warning("Warning: TODO implement attention from https://ieeexplore.ieee.org/document/9076883")
|
logger.warning("Warning: TODO implement attention from https://ieeexplore.ieee.org/document/9076883")
|
||||||
layer_next = tf.keras.layers.Dense(32, activation="gelu")(layer_next)
|
# Ref https://stackoverflow.com/a/54031459/1460422, no activation functions in segmentation head!
|
||||||
|
layer_next = tf.keras.layers.Dense(32)(layer_next)
|
||||||
# LOSS cross entropy
|
# LOSS cross entropy
|
||||||
# layer_next = tf.keras.layers.Conv2D(water_bins, activation="gelu", kernel_size=1, padding="same")(layer_next)
|
# layer_next = tf.keras.layers.Conv2D(water_bins, activation="gelu", kernel_size=1, padding="same")(layer_next)
|
||||||
# layer_next = tf.keras.layers.Softmax(axis=-1)(layer_next)
|
# layer_next = tf.keras.layers.Softmax(axis=-1)(layer_next)
|
||||||
# LOSS dice
|
# LOSS dice
|
||||||
layer_next = tf.keras.layers.Conv2D(1, activation="gelu", kernel_size=1, padding="same")(layer_next)
|
layer_next = tf.keras.layers.Conv2D(1, kernel_size=1, padding="same")(layer_next)
|
||||||
layer_next = tf.keras.layers.Reshape(layer_next.shape[1:-1])(layer_next) # Strip the channels
|
layer_next = tf.keras.layers.Reshape(layer_next.shape[1:-1])(layer_next) # Strip the channels
|
||||||
|
|
||||||
model = tf.keras.Model(
|
model = tf.keras.Model(
|
||||||
|
@ -92,7 +93,7 @@ def model_rainfallwater_mono(metadata, model_arch_enc="convnext_xtiny", model_ar
|
||||||
# loss=LossCrossentropy(batch_size=batch_size),
|
# loss=LossCrossentropy(batch_size=batch_size),
|
||||||
loss=LossDice(),
|
loss=LossDice(),
|
||||||
# loss=tf.keras.losses.CategoricalCrossentropy(),
|
# loss=tf.keras.losses.CategoricalCrossentropy(),
|
||||||
metrics=[tf.keras.metrics.CategoricalAccuracy()]
|
metrics=[tf.keras.metrics.BinaryAccuracy()]
|
||||||
)
|
)
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
|
|
@ -44,8 +44,8 @@ def model_rainfallwater_segmentation(metadata, shape_water_out, model_arch="conv
|
||||||
|
|
||||||
# TODO: An attention layer here instead of a dense layer, with a skip connection perhaps?
|
# TODO: An attention layer here instead of a dense layer, with a skip connection perhaps?
|
||||||
logger.warning("Warning: TODO implement attention from https://ieeexplore.ieee.org/document/9076883")
|
logger.warning("Warning: TODO implement attention from https://ieeexplore.ieee.org/document/9076883")
|
||||||
layer_next = tf.keras.layers.Dense(32, activation="relu")(layer_next)
|
layer_next = tf.keras.layers.Dense(32)(layer_next)
|
||||||
layer_next = tf.keras.layers.Conv2D(water_bins, activation="relu", kernel_size=1, padding="same")(layer_next)
|
layer_next = tf.keras.layers.Conv2D(water_bins, kernel_size=1, padding="same")(layer_next)
|
||||||
layer_next = tf.keras.layers.Softmax(axis=-1)(layer_next)
|
layer_next = tf.keras.layers.Softmax(axis=-1)(layer_next)
|
||||||
|
|
||||||
model = tf.keras.Model(
|
model = tf.keras.Model(
|
||||||
|
|
Loading…
Reference in a new issue