Loss Calculation

I want to calculate the loss depending upon the bounding box difference and the misclasifications.
I am applying some prebutation and i have new bounding boxes and class labels with scores.
Based on the bboxs, class scores and labels I want to calculate the loss.