import os, sys
import numpy as np
from config import config
from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr
import megengine as mge
from megengine import functional as F
import pdb
def _compute_center(boxes):

    ptrx = 0.5 * (boxes[:, 0] + boxes[:, 2])
    ptry = 0.5 * (boxes[:, 1] + boxes[:, 3])
    centre = F.stack([ptrx, ptry], axis=1)
    return centre

def _compute_pos_area(gtboxes, ratio = 0.3):

    H, W = gtboxes[:, 3] - gtboxes[:, 1], gtboxes[:, 2] - gtboxes[:, 0]
    centres = _compute_center(gtboxes)
    l = centres[:, 0] - ratio * W
    r = centres[:, 0] + ratio * W
    t = centres[:, 1] - ratio * H
    b = centres[:, 1] + ratio * H
    boundary = 
F.stack([l, t, r, b], axis = 