docstr: Instantiates the ResNet50 architecture.
  Optionally loads weights pre-trained on ImageNet.
  Note that the data format convention used by the model is
  the one specified in your Keras config at `~/.keras/keras.json`.
  # Arguments
      include_top: whether to include the fully-connected
          layer at the top of the network.
      pooling: Optional pooling mode for feature extraction
          when `include_top` is `False`.
          - `None` means that the output of the model will be
              the 4D tensor output of the
              last convolutional block.
          - `avg` means that global average pooling
              will be applied to the output of the
              last convolutional block, and thus
              the output of the model will be a 2D tensor.
          - `max` means that global max pooling will
              be applied.
      classes: optional number of classes to classify images
          into, only to be specified if `include_top` is True, and
          if no `weights` argument is specified.
  # Returns
      A Keras model instance.
  # Raises
      ValueError: in case of invalid argument for `weights`,
          or invalid input shape.
  # Reference
      https://github.com/keras-team/keras-applications/blob/master/keras_applications/resnet50.py
docstr_tok: ["Instantiates","the","ResNet50","architecture",".","Optionally","loads","weights","pre-trained","on","ImageNet",".","Note","that","the","data","format","convention","used","by","the","model","is","the","one","specified","in","your","Keras","config","at","`","~\/.keras\/keras.json","`",".","#","Arguments","include_top",":","whether","to","include","the","fully-connected","layer","at","the","top","of","the","network",".","pooling",":","Optional","pooling","mode","for","feature","extraction","when","`","include_top","`","is","`","False","`",".","-","`","None","`","means","that","the","output","of","the","model","will","be","the","4D","tensor","output","of","the","last","convolutional","block",".","-","`","avg","`","means","that","global","average","pooling","will","be","applied","to","the","output","of","the","last","convolutional","block",",","and","thus","the","output","of","the","model","will","be","a","2D","tensor",".","-","`","max","`","means","that","global","max","pooling","will","be","applied",".","classes",":","optional","number","of","classes","to","classify","images","into",",","only","to","be","specified","if","`","include_top","`","is","True",",","and","if","no","`","weights","`","argument","is","specified",".","#","Returns","A","Keras","model","instance",".","#","Raises","ValueError",":","in","case","of","invalid","argument","for","`","weights","`",",","or","invalid","input","shape",".","#","Reference","https",":","\/\/github.com\/keras-team\/keras-applications\/blob\/master\/keras_applications\/resnet50.py"]
code: def __init__(self, config, **kwargs):
      """Instantiates the ResNet50 architecture.
      Optionally loads weights pre-trained on ImageNet.
      Note that the data format convention used by the model is
      the one specified in your Keras config at `~/.keras/keras.json`.
      # Arguments
          include_top: whether to include the fully-connected
              layer at the top of the network.
          pooling: Optional pooling mode for feature extraction
              when `include_top` is `False`.
              - `None` means that the output of the model will be
                  the 4D tensor output of the
                  last convolutional block.
              - `avg` means that global average pooling
                  will be applied to the output of the
                  last convolutional block, and thus
                  the output of the model will be a 2D tensor.
              - `max` means that global max pooling will
                  be applied.
          classes: optional number of classes to classify images
              into, only to be specified if `include_top` is True, and
              if no `weights` argument is specified.
      # Returns
          A Keras model instance.
      # Raises
          ValueError: in case of invalid argument for `weights`,
              or invalid input shape.
      # Reference
          https://github.com/keras-team/keras-applications/blob/master/keras_applications/resnet50.py
      """
      super().__init__(**kwargs)
      classes = config["data"]["task"]["classes"]["num"]
      self.include_top = True
      self.pooling = "avg"
  
      if K.image_data_format() == "channels_last":
          bn_axis = 3
      else:
          bn_axis = 1
  
      self.zero_pad1 = layers.ZeroPadding2D(
          padding=(3, 3), name="conv1_pad"
      )
      self.conv1 = layers.Conv2D(
          64,
          (7, 7),
          strides=(2, 2),
          padding="valid",
          kernel_initializer="he_normal",
          name="conv1",
      )
      self.bn1 = layers.BatchNormalization(
          axis=bn_axis, name="bn_conv1"
      )
      self.act1 = layers.Activation("relu")
      self.zero_pad2 = layers.ZeroPadding2D(
          padding=(1, 1), name="pool1_pad"
      )
      self.max_pool1 = layers.MaxPooling2D((3, 3), strides=(2, 2))
  
      self.conv_block1a = ConvBlock(
          3, [64, 64, 256], stage=2, block="a", strides=(1, 1)
      )
      self.identity_block1b = IdentityBlock(
          3, [64, 64, 256], stage=2, block="b"
      )
      self.identity_block1c = IdentityBlock(
          3, [64, 64, 256], stage=2, block="c"
      )
  
      self.conv_block2a = ConvBlock(
          3, [128, 128, 512], stage=3, block="a"
      )
      self.identity_block2b = IdentityBlock(
          3, [128, 128, 512], stage=3, block="b"
      )
      self.identity_block2c = IdentityBlock(
          3, [128, 128, 512], stage=3, block="c"
      )
      self.identity_block2d = IdentityBlock(
          3, [128, 128, 512], stage=3, block="d"
      )
  
      self.conv_block3a = ConvBlock(
          3, [256, 256, 1024], stage=4, block="a"
      )
      self.identity_block3b = IdentityBlock(
          3, [256, 256, 1024], stage=4, block="b"
      )
      self.identity_block3c = IdentityBlock(
          3, [256, 256, 1024], stage=4, block="c"
      )
      self.identity_block3d = IdentityBlock(
          3, [256, 256, 1024], stage=4, block="d"
      )
      self.identity_block3e = IdentityBlock(
          3, [256, 256, 1024], stage=4, block="e"
      )
      self.identity_block3f = IdentityBlock(
          3, [256, 256, 1024], stage=4, block="f"
      )
  
      self.conv_block4a = ConvBlock(
          3, [512, 512, 2048], stage=5, block="a"
      )
      self.identity_block4b = IdentityBlock(
          3, [512, 512, 2048], stage=5, block="b"
      )
      self.identity_block4c = IdentityBlock(
          3, [512, 512, 2048], stage=5, block="c"
      )
  
      self.global_avg_pool = layers.GlobalAveragePooling2D(
          name="avg_pool"
      )
      self.dense = layers.Dense(
          classes, activation="softmax", name="fc-class"
      )
  
file_path: delta/delta/models/resnet_model.py
imports: from absl import logging
  import delta.compat
  from tensorflow.python.keras import backend
  from delta.models.base_model import Model
  from delta.layers.resnet import IdentityBlock
  from delta.layers.resnet import ConvBlock
  from delta.utils.register import registers
label_desc: Use image node_id 1 to create a new ResNet50 object from inherited base classes: Model with example: obj = ResNet50(config)