Pre-and API introduction Mxnet.metric
From mxnet Import metriccls_metric = metric. Accuracy () Box_metric = metric. MAE () cls_metric.update ([Cls_target], [Class_preds.transpose ((0,2,1))]) box_metric.update ([Box_target], [box_preds * Box_mask]) cls_metric.get () Box_metric.get ()
Gluon.loss.Loss
Class Focalloss (Gluon.loss.Loss): def __init__ (self, axis=-1, alpha=0.25, gamma=2, Batch_axis=0, **kwargs): Super (Focalloss, self). __init__ (None, Batch_axis, **kwargs) self._axis = Axis Self._alpha = Alpha self._ Gamma = Gamma def hybrid_forward (self, f, output, label): # here ' F ' can is either mx.nd or Mx.sym # here use F instead of F Orward explicitly specify both for ease of use # so non-hybrid without this parameter output = F.softmax (output) PJ = output.pick (label, Axis=self._axis, Keepdims=true) loss =-Self._alpha * ((1-PJ) * * self._gamma) * Pj.log () return Loss.mean (Axis=self._batch_axi S, exclude=true)
Mxnet.contrib.ndarray.MultiBoxTarget
def training_targets (anchors, class_preds, labels): "" "Get all the border coordinates to get all the borders of each category score real category and corresponding border coordinates " "" class_preds = Class_preds.transpose (axes= (0,2,1))
Mxnet.contrib.ndarray.MultiBoxDetection
"MXNet" Eighth bomb _ object detection of SSD