diff --git a/modules/deeplearning/cnn_l1b_l2_16.py b/modules/deeplearning/cnn_l1b_l2_16.py index 79cba6dba6b9aceb0bf41fc7c55366ae7196eafc..0531a21beb099084b5f820b6d04667a7e46dcb03 100644 --- a/modules/deeplearning/cnn_l1b_l2_16.py +++ b/modules/deeplearning/cnn_l1b_l2_16.py @@ -414,9 +414,9 @@ class UNET: conv = input_layer - # conv = build_residual_block_1x1(input_layer, num_filters, activation, 'Residual_Block_1', padding=padding) + conv = build_residual_block_1x1(input_layer, num_filters, activation, 'Residual_Block_1', padding=padding) - # conv = build_residual_block_1x1(conv, num_filters, activation, 'Residual_Block_2', padding=padding) + conv = build_residual_block_1x1(conv, num_filters, activation, 'Residual_Block_2', padding=padding) # conv = build_residual_block_1x1(conv, num_filters, activation, 'Residual_Block_3', padding=padding) @@ -467,8 +467,8 @@ class UNET: 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.BatchNormalization()(skip) + conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=None)(conv) + conv = tf.keras.layers.BatchNormalization()(conv) conv = conv + skip conv = tf.keras.layers.LeakyReLU()(conv) @@ -476,50 +476,46 @@ class UNET: # ----------------------------------------------------------------------------------------------------------- skip = conv - num_filters *= 2 + conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv) - conv = tf.keras.layers.MaxPool2D(padding=padding)(conv) conv = tf.keras.layers.BatchNormalization()(conv) - 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 = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=None)(conv) + conv = tf.keras.layers.BatchNormalization()(conv) conv = conv + skip conv = tf.keras.layers.LeakyReLU()(conv) print('2d: ', conv.shape) - # # ---------------------------------------------------------------------------------------------------------- - # + # ---------------------------------------------------------------------------------------------------------- + skip = conv - num_filters *= 2 + conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv) - conv = tf.keras.layers.MaxPool2D(padding=padding)(conv) conv = tf.keras.layers.BatchNormalization()(conv) - 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 = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=None)(conv) + conv = tf.keras.layers.BatchNormalization()(conv) conv = conv + skip conv = tf.keras.layers.LeakyReLU()(conv) print('3d: ', conv.shape) - # - # return conv - # ----------------------------------------------------------------------------------------------------------- - skip = conv - num_filters *= 2 - conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv) - conv = tf.keras.layers.MaxPool2D(padding=padding)(conv) - conv = tf.keras.layers.BatchNormalization()(conv) - - 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('4d: ', conv.shape) + return conv + + # ----------------------------------------------------------------------------------------------------------- + # skip = conv + # num_filters *= 2 + # conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv) + # conv = tf.keras.layers.MaxPool2D(padding=padding)(conv) + # conv = tf.keras.layers.BatchNormalization()(conv) + # + # 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('4d: ', conv.shape) return conv