diff --git a/modules/deeplearning/cloud_fraction_fcn_abi_hkm_refl.py b/modules/deeplearning/cloud_fraction_fcn_abi_hkm_refl.py index 704bfaf7618259da30ff7fd61267117966655130..fd5a4f6dcd6b6ae52bdbb017fb13e7a8af8ad6cb 100644 --- a/modules/deeplearning/cloud_fraction_fcn_abi_hkm_refl.py +++ b/modules/deeplearning/cloud_fraction_fcn_abi_hkm_refl.py @@ -114,6 +114,26 @@ def build_residual_conv2d_block(conv, num_filters, block_name, activation=tf.nn. return conv +def build_conv2d_block(conv, num_filters, activation, block_name, padding='SAME'): + with tf.name_scope(block_name): + skip = conv + + conv = tf.keras.layers.Conv2D(num_filters, kernel_size=5, strides=1, padding=padding, activation=activation)(conv) + conv = tf.keras.layers.MaxPool2D(padding=padding)(conv) + conv = tf.keras.layers.BatchNormalization()(conv) + print(conv.shape) + + skip = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=None)(skip) + skip = tf.keras.layers.MaxPool2D(padding=padding)(skip) + skip = tf.keras.layers.BatchNormalization()(skip) + + conv = conv + skip + conv = tf.keras.layers.LeakyReLU()(conv) + print(conv.shape) + + return conv + + def upsample_mean(grd): bsize, ylen, xlen = grd.shape up = np.zeros((bsize, ylen*2, xlen*2))