title: ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1
body: <pre><code>from keras import backend as K
  from tensorflow.keras.layers import MaxPooling2D,Conv2D,Input,Add,Flatten,AveragePooling2D,Dense,BatchNormalization,ZeroPadding2D,Activation
  from tensorflow.keras.models import Model
  
  
  def Dense_Layer(x,k):
      x = BatchNormalization(axis = 3)(x)
      x = Activation('relu')(x)
      x = Conv2D(4*k,(1,1),strides = (1,1))(x)
      x = BatchNormalization(axis = 3)(x)
      x = Activation('relu')(x)
      x = Conv2D(k,(1,1),strides = (1,1))(x)
      return x
  
  def Dense_Block(x,k):
      
      x1 = Dense_Layer(x,k)
      x1_add = keras.layers.Concatenate()([x1,x])
      x2 = Dense_Layer(x1_add,k)
      x2_add = keras.layers.Concatenate()([x1,x2])
      
      return x2_add
  def Dilated_Spatial_Pyramid_Pooling(x,k):
      x = BatchNormalization(axis = 3)(x)
      d1 = Conv2D(k, (1,1), dilation_rate = 2)(x)
      d2 = Conv2D(k, (1,1), dilation_rate = 4)(d1)
      d3 = Conv2D(k, (1,1), dilation_rate = 8)(d2)
      d4 = Conv2D(k, (1,1), dilation_rate = 16)(d3)
      c = keras.layers.Concatenate()([d1,d2,d3,d4])
      return c
  
      
          
      
  def down_block(x,filters, kernel_size = (3, 3), padding = &quot;same&quot;,strides =1 ):
      c = Dense_Block(x,filters)
      c = Dense_Block(c,filters)
      p = keras.layers.MaxPool2D((2,2),(2,2))(c)
      return c,p
  def up_block(x,skip,filters, kernel_size = (3, 3), padding = &quot;same&quot;,strides =1 ):
      us = keras.layers.UpSampling2D((2,2))(x)
      concat = keras.layers.Concatenate()([us,skip])
      c = Dense_Block(concat,filters)
      c = Dense_Block(c,filters)
      return c
  def bottleneck(x,filters, kernel_size = (3, 3), padding = &quot;same&quot;,strides =1 ):
      c = Dense_Block(x,filters)
      c = Dense_Block(c,filters)
      c = Dilated_Spatial_Pyramid_Pooling(c,filters)
      return c
  
  def UNet():
      f = [32,64,128,256]
      input = keras.layers.Input((128,128,1))
      
      
      p0 = input
      c1,p1 =  down_block(p0,f[0])
      c2,p2 =  down_block(p1,f[1])
      c3,p3 =  down_block(p2,f[2])
  
      
      bn = bottleneck(p3,f[3])
      
      u1 = up_block(bn,c3,f[2])
      u2 = up_block(u1,c2,f[1])
      u3 = up_block(u2,c1,f[0])
      
      
      outputs = keras.layers.Conv2D(1,(1,1),padding= &quot;same&quot;,activation = &quot;sigmoid&quot;)(u3)
      model = keras.models.Model(input,outputs)
      return model
  model=UNet()
  model.summary()
  
  </code></pre>
  <p>my versions are:</p>
  <p>pip install q tensorflow==2.1</p>
  <p>pip install q keras==2.3.1</p>
  <p>pip install imgaug</p>
  <p>pip install -U segmentation-models</p>
  <p>I am using UNET using dense block instead of convulational layer with dilated spatial pooling layer in bottlenack layer.
  but i am getting  ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1'</p>