The cost function is primarily used to evaluate the current performance of the model by comparing the true class labels (y_true_cls
) with the predicted class labels (y_pred_cls
). Based on the current performance, the optimizer then fine-tunes the network parameters, such as weights and biases, to further improve its performance.
The cost function definition is critical as it will decide optimization criteria. The cost function definition will require true classes and predicted classes to do comparison. The objective function used in this recipe is cross entropy, used in multi-classification problems.
- Evaluate the current performance of each image using the cross entropy function in TensorFlow. As the cross entropy function in TensorFlow internally applies softmax normalization, we provide the output of the fully connected layer post dropout (
layer_fc2_drop
) as an input along with true labels (y_true
):
cross_entropy...