VishnuEcoClim commited on
Commit
b3797b8
·
1 Parent(s): 527d8f9

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +14 -0
utils.py CHANGED
@@ -20,6 +20,20 @@ def gen_labels():
20
 
21
  return labels
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  def preprocess(image):
24
  image = np.array(image.resize((256, 256), Image.LANCZOS))
25
  image = image.astype('float32') / 255.0
 
20
 
21
  return labels
22
 
23
+ data_augmentation = tf.keras.Sequential([
24
+ tf.keras.layers.experimental.preprocessing.Rescaling(1./127.5, offset= -1),
25
+ tf.keras.layers.experimental.preprocessing.RandomFlip("horizontal_and_vertical"),
26
+ tf.keras.layers.experimental.preprocessing.RandomRotation(0.2),
27
+ tf.keras.layers.experimental.preprocessing.RandomZoom(0.2)
28
+ ], name='data_augmentation')
29
+
30
+ #Instantiating the base model
31
+ input_shape = (256,256,3)
32
+ base_model = tf.keras.applications.ResNet50V2(include_top=False, input_shape=input_shape)
33
+
34
+ #Making the layers of the model trainable
35
+ base_model.trainable = True
36
+
37
  def preprocess(image):
38
  image = np.array(image.resize((256, 256), Image.LANCZOS))
39
  image = image.astype('float32') / 255.0