def fn5():
        bboxes_xywh = np.zeros_like(bboxes_xyxy)
        bboxes_xywh[:, 2] = bboxes_xyxy[:, 2] - bboxes_xyxy[:, 0] + 1.
        bboxes_xywh[:, 3] = bboxes_xyxy[:, 3] - bboxes_xyxy[:, 1] + 1.
        bboxes_xywh[:, 0] = bboxes_xyxy[:, 0] + bboxes_xywh[:, 2] / 2.
        bboxes_xywh[:, 1] = bboxes_xyxy[:, 1] + bboxes_xywh[:, 3] / 2.

        h, w = im.shape[:2]
        bboxes_xywh_normed = bboxes_xywh.astype("float32")
        bboxes_xywh_normed[...,
                           0::2] = bboxes_xywh_normed[..., 0::2] / float(w)
        bboxes_xywh_normed[...,
                           1::2] = bboxes_xywh_normed[..., 1::2] / float(h)

        currentAxis = plt.gca()
        ret_im, ret_bboxes = random_expand(
            im,
            bboxes_xywh_normed,
            thresh=1,
            xy_ratio_same=False,
            # fill=[np.mean(im[..., i]) for i in range(im.shape[-1])],
            fill=[100, 100, 100],
            xywh_do_normalize=True,
            xywh_is_normalize=True)

        oh, ow = ret_im.shape[:2]
        ret_bboxes_decode = ret_bboxes.astype(np.float)
        ret_bboxes_decode[:, 0::2] = ret_bboxes_decode[:, 0::2] * ow
        ret_bboxes_decode[:, 1::2] = ret_bboxes_decode[:, 1::2] * oh
        plt.imshow(ret_im.astype("uint8"))
        for bbox in ret_bboxes_decode:
            draw_rectangle(currentAxis, bbox, edgecolor="b")
 def fn1():
     bboxes_xywh = np.zeros_like(bboxes_xyxy)
     bboxes_xywh[:, 2] = bboxes_xyxy[:, 2] - bboxes_xyxy[:, 0] + 1.
     bboxes_xywh[:, 3] = bboxes_xyxy[:, 3] - bboxes_xyxy[:, 1] + 1.
     bboxes_xywh[:, 0] = bboxes_xyxy[:, 0] + bboxes_xywh[:, 2] / 2.
     bboxes_xywh[:, 1] = bboxes_xyxy[:, 1] + bboxes_xywh[:, 3] / 2.
     currentAxis = plt.gca()
     ret_im, ret_bboxes = random_expand(im,
                                        bboxes_xywh,
                                        thresh=1,
                                        xy_ratio_same=False,
                                        xywh_do_normalize=False,
                                        xywh_is_normalize=False)
     plt.imshow(ret_im.astype("uint8"))
     for bbox in ret_bboxes:
         draw_rectangle(currentAxis, bbox, edgecolor="b")
    def fn3():

        bboxes_xywh = np.zeros_like(bboxes_xyxy)
        bboxes_xywh[:, 2] = bboxes_xyxy[:, 2] - bboxes_xyxy[:, 0] + 1.
        bboxes_xywh[:, 3] = bboxes_xyxy[:, 3] - bboxes_xyxy[:, 1] + 1.
        bboxes_xywh[:, 0] = bboxes_xyxy[:, 0] + bboxes_xywh[:, 2] / 2.
        bboxes_xywh[:, 1] = bboxes_xyxy[:, 1] + bboxes_xywh[:, 3] / 2.

        currentAxis = plt.gca()
        ret_im, ret_bboxes = random_expand(im,
                                           bboxes_xywh,
                                           thresh=1,
                                           xy_ratio_same=False,
                                           xywh_do_normalize=True,
                                           xywh_is_normalize=False)

        oh, ow = ret_im.shape[:2]
        ret_bboxes_decode = ret_bboxes.astype(np.float)
        ret_bboxes_decode[:, 0::2] = ret_bboxes_decode[:, 0::2] * ow
        ret_bboxes_decode[:, 1::2] = ret_bboxes_decode[:, 1::2] * oh
        plt.imshow(ret_im.astype("uint8"))
        for bbox in ret_bboxes_decode:
            draw_rectangle(currentAxis, bbox, edgecolor="b")
    def fn2():
        bboxes_xywh = np.zeros_like(bboxes_xyxy)
        bboxes_xywh[:, 2] = bboxes_xyxy[:, 2] - bboxes_xyxy[:, 0] + 1.
        bboxes_xywh[:, 3] = bboxes_xyxy[:, 3] - bboxes_xyxy[:, 1] + 1.
        bboxes_xywh[:, 0] = bboxes_xyxy[:, 0] + bboxes_xywh[:, 2] / 2.
        bboxes_xywh[:, 1] = bboxes_xyxy[:, 1] + bboxes_xywh[:, 3] / 2.

        h, w = im.shape[:2]
        bboxes_xywh_normed = bboxes_xywh.astype("float32")
        bboxes_xywh_normed[...,
                           0::2] = bboxes_xywh_normed[..., 0::2] / float(w)
        bboxes_xywh_normed[...,
                           1::2] = bboxes_xywh_normed[..., 1::2] / float(h)

        currentAxis = plt.gca()
        ret_im, ret_bboxes = random_expand(im,
                                           bboxes_xywh_normed,
                                           thresh=1,
                                           xy_ratio_same=False,
                                           xywh_do_normalize=False,
                                           xywh_is_normalize=True)
        plt.imshow(ret_im.astype("uint8"))
        for bbox in ret_bboxes:
            draw_rectangle(currentAxis, bbox, edgecolor="b")