'Decodes relative codes to boxes.
Args:
rel_codes: a tensor representing N anchor-encoded boxes.
anchors: BoxList of anchors.
Returns:
boxes: BoxList holding N bounding boxes.'

def _decode(self, rel_codes, anchors):

    (ycenter_a, xcenter_a, ha, wa) = anchors.get_center_coordinates_and_sizes()
    la = tf.sqrt((ha * wa))
    (ty, tx, tl) = tf.unstack(tf.transpose(rel_codes))
    if self._scale_factors:
        ty /= self._scale_factors[0]
        tx /= self._scale_factors[1]
        tl /= self._scale_factors[2]
    l = (tf.exp(tl) * la)
    ycenter = ((ty * la) + ycenter_a)
    xcenter = ((tx * la) + xcenter_a)
    ymin = (ycenter - (l / 2.0))
    xmin = (xcenter - (l / 2.0))
    ymax = (ycenter + (l / 2.0))
    xmax = (xcenter + (l / 2.0))
    return box_list.BoxList(tf.transpose(tf.stack([ymin, xmin, ymax, xmax])))
