code: def resnet_v1(input_shape, num_res_blocks, num_classes=10):
      """ResNet Version 1 Model builder [a]
      Stacks of 2 x (3 x 3) Conv2D-BN-ReLU
      Last ReLU is after the shortcut connection.
      At the beginning of each stage, the feature map size is halved (downsampled)
      by a convolutional layer with strides=2, while the number of filters is
      doubled. Within each stage, the layers have the same number filters and the
      same number of filters.
      Features maps sizes:
      stage 0: 32x32, 16
      stage 1: 16x16, 32
      stage 2:  8x8,  64
      The Number of parameters is approx the same as Table 6 of [a]:
      ResNet20 0.27M
      ResNet32 0.46M
      ResNet44 0.66M
      ResNet56 0.85M
      ResNet110 1.7M
      # Arguments
          input_shape (tensor): shape of input image tensor
          depth (int): number of core convolutional layers
          num_res_blocks (int): number of res blocks to be used.
          num_classes (int): number of classes (CIFAR10 has 10)
      # Returns
          model (Model): Keras model instance
      """
  
      # Start model definition.
      num_filters = 16
  
      inputs = Input(shape=input_shape)
      x = resnet_layer(inputs=inputs)
      # Instantiate the stack of residual units
      for stack in range(3):
          for res_block in range(num_res_blocks):
              strides = 1
              if (
                  stack > 0 and res_block == 0
              ):  # first layer but not first stack
                  strides = 2  # downsample
              y = resnet_layer(
                  inputs=x, num_filters=num_filters, strides=strides
              )
              y = resnet_layer(
                  inputs=y, num_filters=num_filters, activation=None
              )
              if (
                  stack > 0 and res_block == 0
              ):  # first layer but not first stack
                  # linear projection residual shortcut connection to match
                  # changed dims
                  x = resnet_layer(
                      inputs=x,
                      num_filters=num_filters,
                      kernel_size=1,
                      strides=strides,
                      activation=None,
                      batch_normalization=False,
                  )
              x = keras.layers.add([x, y])
              x = Activation("relu")(x)
          num_filters *= 2
  
      # Add classifier on top.
      # v1 does not use BN after last shortcut connection-ReLU
      x = AveragePooling2D(pool_size=8)(x)
      y = Flatten()(x)
      outputs = Dense(
          num_classes,
          activation="softmax",
          kernel_initializer="he_normal",
      )(y)
  
      # Instantiate model.
      model = Model(inputs=inputs, outputs=outputs)
      return model
  
file_path: AIX360/aix360/algorithms/profwt/resnet_keras_model.py
imports: from __future__ import print_function
  import keras
  from keras.layers import Dense, Conv2D, BatchNormalization, Activation
  from keras.layers import AveragePooling2D, Input, Flatten
  from keras.optimizers import Adam
  from keras.callbacks import ModelCheckpoint, LearningRateScheduler
  from keras.callbacks import ReduceLROnPlateau
  from keras.preprocessing.image import ImageDataGenerator
  from keras.regularizers import l2
  from keras import backend
  from keras.models import Model
  from keras.datasets import cifar10
  import numpy
  import os
  import json
  from collections import namedtuple
label_desc: Use image node_id 3 for calling a global function with example usage: resnet_v1(input_shape, num_res_blocks, num_classes) and returns: model