def METHOD_NAME(img_id, coco, cid2cname, catid2clsid):
    img_anno = coco.loadImgs(img_id)[0]
    im_w = float(img_anno['width'])
    im_h = float(img_anno['height'])
    ins_anno_ids = coco.getAnnIds(imgIds=img_id, iscrowd=0)
    instances = coco.loadAnns(ins_anno_ids)
    bboxes = []
    for inst in instances:
        x, y, box_w, box_h = inst['bbox']
        x1 = max(0, x)
        y1 = max(0, y)
        x2 = min(im_w - 1, x1 + max(0, box_w - 1))
        y2 = min(im_h - 1, y1 + max(0, box_h - 1))
        if inst['area'] > 0 and x2 >= x1 and y2 >= y1:
            inst['clean_bbox'] = [x1, y1, x2, y2]
            bboxes.append(inst)
        else:
            raise Exception("标注文件存在错误")
    num_bbox = len(bboxes)
    gt_bbox = np.zeros((num_bbox, 4), dtype=np.float32)
    gt_class = [""] * num_bbox
    gt_poly = [None] * num_bbox
    for i, box in enumerate(bboxes):
        catid = box['category_id']
        gt_class[i] = cid2cname[catid2clsid[catid]]
        gt_bbox[i, :] = box['clean_bbox']
        # is_crowd[i][0] = box['iscrowd']
        if 'segmentation' in box:
            gt_poly[i] = box['segmentation']
    anno_dict = {
        'h': im_h,
        'w': im_w,
        'gt_class': gt_class,
        'gt_bbox': gt_bbox,
        'gt_poly': gt_poly,
    }
    return anno_dict