Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Azure by (5.8k points)

For my thesis, I am trying to modify the loss function of faster-rcnn with regards to recognizing table structures.

Currently, I am using Facebook's Detectron. It seems to be working great but I am now actively trying to modify the loss function. Debugging my code I notice this is where the loss functions are added

def add_fast_rcnn_losses(model):

"""Add losses for RoI classification and bounding box regression."""

cls_prob, loss_cls =

    ['cls_score', 'labels_int32'], ['cls_prob', 'loss_cls'],



loss_bbox =


        'bbox_pred', 'bbox_targets', 'bbox_inside_weights',






loss_gradients = blob_utils.get_loss_gradients(model, [loss_cls, loss_bbox])

model.Accuracy(['cls_prob', 'labels_int32'], 'accuracy_cls')

model.AddLosses(['loss_cls', 'loss_bbox'])


return loss_gradients

The debugger cant find any declaration or implementation of nor SoftmaxWithLoss. Detectron uses caffe, and when I look in the net_builder (which inits the I see it makes "binds"(don't know the proper word) to caffe2, which in itself is a py lib with a compiled lib behind it.

Am I looking in the wrong place to make a minor adjustment to this loss function, or will I really have to open de source from dcaffe, adjust the loss, recompile the lib?

1 Answer

0 votes
by (9.6k points)

Try to implement the function by yourself. 

You can create a python function to predict and return loss value. Caffe is now part of PyTorch.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.2k users

Browse Categories