From 4978b9b02fdc3aba4d8ceb0789345e18f6ff14f7 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 3 Aug 2022 13:30:51 -0500
Subject: [PATCH] snapshot...

---
 modules/deeplearning/espcn.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/deeplearning/espcn.py b/modules/deeplearning/espcn.py
index a09007e1..f665a5cf 100644
--- a/modules/deeplearning/espcn.py
+++ b/modules/deeplearning/espcn.py
@@ -210,12 +210,14 @@ class ESPCN:
 
         self.n_chans = 1
 
-        self.X_img = tf.keras.Input(shape=(None, None, self.n_chans))
+        #self.X_img = tf.keras.Input(shape=(None, None, self.n_chans))
         # self.X_img = tf.keras.Input(shape=(36, 36, self.n_chans))
+        self.X_img = tf.keras.Input(shape=(32, 32, self.n_chans))
 
         self.inputs.append(self.X_img)
-        self.inputs.append(tf.keras.Input(shape=(None, None, self.n_chans)))
+        #self.inputs.append(tf.keras.Input(shape=(None, None, self.n_chans)))
         # self.inputs.append(tf.keras.Input(shape=(36, 36, self.n_chans)))
+        self.inputs.append(tf.keras.Input(shape=(32, 32, self.n_chans)))
 
         self.DISK_CACHE = False
 
@@ -420,20 +422,19 @@ class ESPCN:
         print('input: ', input_2d.shape)
         # conv = tf.keras.layers.Conv2D(num_filters, kernel_size=5, strides=1, padding='VALID', activation=None)(input_2d)
         conv = input_2d
-        print('Contracting Branch')
         print('input: ', conv.shape)
         skip = conv
 
         if NOISE_TRAINING:
             conv = tf.keras.layers.GaussianNoise(stddev=NOISE_STDDEV)(conv)
 
-        conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv)
+        conv = tf.keras.layers.Conv2D(num_filters, kernel_size=5, strides=1, padding=padding, activation=activation)(conv)
         conv = tf.keras.layers.BatchNormalization()(conv)
         print(conv.shape)
 
-        # conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv)
-        # conv = tf.keras.layers.BatchNormalization()(conv)
-        # print(conv.shape)
+        conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=activation)(conv)
+        conv = tf.keras.layers.BatchNormalization()(conv)
+        print(conv.shape)
 
         conv = tf.keras.layers.Conv2D(num_filters, kernel_size=3, strides=1, padding=padding, activation=None)(conv)
         conv = tf.keras.layers.BatchNormalization()(conv)
@@ -447,10 +448,15 @@ class ESPCN:
         conv = tf.keras.layers.BatchNormalization()(conv)
         print(conv.shape)
 
+        conv = tf.keras.layers.Conv2D(num_filters/2, kernel_size=3, strides=1, padding=padding, activation=activation)(conv)
+        conv = tf.keras.layers.BatchNormalization()(conv)
+        print(conv.shape)
+
         conv = tf.keras.layers.Conv2D(4, kernel_size=3, strides=1, padding=padding, activation=activation)(conv)
         print(conv.shape)
 
         conv = tf.nn.depth_to_space(conv, block_size=2)
+        conv = tf.keras.layers.Activation(activation=activation)(conv)
         print(conv.shape)
 
         if NumClasses == 2:
-- 
GitLab