Skip to main content
. 2023 Jan 3;15(1):314. doi: 10.3390/cancers15010314
Pseudocode ResNet50
Input: Chest Radiographs
Output: classification results: Covid Or Normal
Start
  lr ← 1 × 10−4           ▷ lr is Initial_Learning_rate
  Batch_Size ← 32
  Number_of_Epochs ← 28
  Base_ModelResNet50(weights ← “imagenet”, include_topFalse,
  input_tensor ← Input (shape ← (224, 224, 3)))  ▷ ResNet50 is the base Model

  headModel ← baseModel.output
  headModel ← AveragePooling2D(pool_size ← (7, 7))(headModel)
   headModel ← Flatten(name ← “flatten”)(headModel)
  headModel ← Dense(256, activation ← “relu”)(headModel)
  headModel ← Dropout(0.5)(headModel)
  headModel ← Dense(len(CLASSES), activation ← “softmax”)(headModel)
  model ← Model(inputs ← baseModel.input, outputs ← headModel)
  for layer in baseModel.layers:
      layer.trainable ← True
  end for
  opt ← optimizers.Adam (lr ← INIT_LR, decay ← INIT_LR/Number_of_Epochs)
  model.compile (loss ← “binary_crossentropy”, optimizer ← opt, metrics ← [“Accuracy”])
  H ← model.fit_generator (trainGen, steps_per_epoch ← totalTrain, validation_data ← valGen, validation_steps ← totalVal, epochs ← Number_of_Epochs)
End