How to retrieve the loss function of FasterRCNN for object detection?

The losses are calculated here in the GeneralizedRCNN.forward method so you might be able to reimplement the forward method and pass the targets to during the validation pass, too.