parameters: (self, labels, preds)
docstring: Implementation of updating metrics
docstring_summary: Implementation of updating metrics
docstring_tokens: Implementation of updating metrics
function: def update(self, labels, preds):
          """
          Implementation of updating metrics
          """
          # get generated multi label from network
          cls_prob = preds[0].asnumpy()
          loc_loss = preds[1].asnumpy()
          cls_label = preds[2].asnumpy()
          valid_count = np.sum(cls_label >= 0)
          # overall accuracy & object accuracy
          label = cls_label.flatten()
          mask = np.where(label >= 0)[0]
          indices = np.int64(label[mask])
          prob = cls_prob.transpose((0, 2, 1)).reshape((-1, cls_prob.shape[1]))
          prob = prob[mask, indices]
          self.sum_metric[0] += (-np.log(prob + self.eps)).sum()
          self.num_inst[0] += valid_count
          # smoothl1loss
          self.sum_metric[1] += np.sum(loc_loss)
          self.num_inst[1] += valid_count
function_tokens: def update ( self , labels , preds ) : # get generated multi label from network cls_prob = preds [ 0 ] . asnumpy ( ) loc_loss = preds [ 1 ] . asnumpy ( ) cls_label = preds [ 2 ] . asnumpy ( ) valid_count = np . sum ( cls_label >= 0 ) # overall accuracy & object accuracy label = cls_label . flatten ( ) mask = np . where ( label >= 0 ) [ 0 ] indices = np . int64 ( label [ mask ] ) prob = cls_prob . transpose ( ( 0 , 2 , 1 ) ) . reshape ( ( - 1 , cls_prob . shape [ 1 ] ) ) prob = prob [ mask , indices ] self . sum_metric [ 0 ] += ( - np . log ( prob + self . eps ) ) . sum ( ) self . num_inst [ 0 ] += valid_count # smoothl1loss self . sum_metric [ 1 ] += np . sum ( loc_loss ) self . num_inst [ 1 ] += valid_count