code: def update(self, labels, preds):
      if self.loss_idx >= 0 and self.weight_idx >= 0:
          bbox_loss = preds[self.loss_idx].asnumpy()
          bbox_weight = preds[self.weight_idx].asnumpy()
      else:
          bbox_loss = preds[self.pred.index("rpn_bbox_loss")].asnumpy()
          bbox_weight = labels[
              self.label.index("rpn_bbox_weight")
          ].asnumpy()
          # bbox_weight = preds[self.pred.index('rpn_bbox_weight')].asnumpy()
  
      # print('in_metric', self.name, bbox_weight.shape, bbox_loss.shape)
  
      # calculate num_inst (average on those fg anchors)
      if config.LR_MODE == 0:
          num_inst = np.sum(bbox_weight > 0) / (
              bbox_weight.shape[1] / config.NUM_ANCHORS
          )
      else:
          num_inst = 1
      # print('in_metric log', bbox_loss.shape, num_inst, file=sys.stderr)
  
      self.sum_metric += np.sum(bbox_loss)
      self.num_inst += num_inst
  
imports: from __future__ import print_function
  import sys
  import mxnet
  import numpy
  from rcnn.config import config
label_desc: Use image node_id 2 for calling the RPNL1LossMetric obj's underlying member method code with example usage: obj.update(labels, preds) without return types