當前位置: 首頁>>代碼示例>>Python>>正文


Python keypoints.flip_keypoints方法代碼示例

本文整理匯總了Python中utils.keypoints.flip_keypoints方法的典型用法代碼示例。如果您正苦於以下問題:Python keypoints.flip_keypoints方法的具體用法?Python keypoints.flip_keypoints怎麽用?Python keypoints.flip_keypoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils.keypoints的用法示例。


在下文中一共展示了keypoints.flip_keypoints方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: extend_with_flipped_entries

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import flip_keypoints [as 別名]
def extend_with_flipped_entries(roidb, dataset):
    flipped_roidb = []
    for entry in roidb:
        width = entry['width']
        boxes = entry['boxes'].copy()
        oldx1 = boxes[:, 0].copy()
        oldx2 = boxes[:, 2].copy()
        boxes[:, 0] = width - oldx2 - 1
        boxes[:, 2] = width - oldx1 - 1
        assert (boxes[:, 2] >= boxes[:, 0]).all()
        flipped_entry = {}
        dont_copy = ('boxes', 'segms', 'gt_keypoints', 'flipped')
        for k, v in entry.items():
            if k not in dont_copy:
                flipped_entry[k] = v
        flipped_entry['boxes'] = boxes
        flipped_entry['segms'] = segm_utils.flip_segms(
            entry['segms'], entry['width'])
        if dataset.keypoints is not None:
            flipped_entry['gt_keypoints'] = keypoint_utils.flip_keypoints(
                dataset.keypoints, dataset.keypoint_flip_map,
                entry['gt_keypoints'], entry['width'])
        flipped_entry['flipped'] = True
        flipped_roidb.append(flipped_entry)
    roidb.extend(flipped_roidb) 
開發者ID:facebookresearch,項目名稱:DetectAndTrack,代碼行數:27,代碼來源:roidb.py

示例2: extend_with_flipped_entries

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import flip_keypoints [as 別名]
def extend_with_flipped_entries(roidb, dataset):
    """Flip each entry in the given roidb and return a new roidb that is the
    concatenation of the original roidb and the flipped entries.

    "Flipping" an entry means that that image and associated metadata (e.g.,
    ground truth boxes and object proposals) are horizontally flipped.
    """
    flipped_roidb = []
    for entry in roidb:
        width = entry['width']
        boxes = entry['boxes'].copy()
        oldx1 = boxes[:, 0].copy()
        oldx2 = boxes[:, 2].copy()
        boxes[:, 0] = width - oldx2 - 1
        boxes[:, 2] = width - oldx1 - 1
        assert (boxes[:, 2] >= boxes[:, 0]).all()
        flipped_entry = {}
        dont_copy = ('boxes', 'segms', 'gt_keypoints', 'flipped')
        for k, v in entry.items():
            if k not in dont_copy:
                flipped_entry[k] = v
        flipped_entry['boxes'] = boxes
        flipped_entry['segms'] = segm_utils.flip_segms(
            entry['segms'], entry['height'], entry['width']
        )
        if dataset.keypoints is not None:
            flipped_entry['gt_keypoints'] = keypoint_utils.flip_keypoints(
                dataset.keypoints, dataset.keypoint_flip_map,
                entry['gt_keypoints'], entry['width']
            )
        flipped_entry['flipped'] = True
        flipped_roidb.append(flipped_entry)
    roidb.extend(flipped_roidb) 
開發者ID:roytseng-tw,項目名稱:Detectron.pytorch,代碼行數:35,代碼來源:roidb.py

示例3: extend_with_flipped_entries

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import flip_keypoints [as 別名]
def extend_with_flipped_entries(roidb, dataset):
    """Flip each entry in the given roidb and return a new roidb that is the
    concatenation of the original roidb and the flipped entries.

    "Flipping" an entry means that that image and associated metadata (e.g.,
    ground truth boxes and object proposals) are horizontally flipped.
    """
    flipped_roidb = []
    for entry in roidb:
        width = entry['width']
        boxes = entry['boxes'].copy()
        oldx1 = boxes[:, 0].copy()
        oldx2 = boxes[:, 2].copy()
        boxes[:, 0] = width - oldx2 - 1
        boxes[:, 2] = width - oldx1 - 1
        assert (boxes[:, 2] >= boxes[:, 0]).all()
        polygons = entry['polygons'].copy()
        polygons = flip_polygons(polygons, entry['width'])
        charboxes = entry['charboxes'].copy()
        charboxes = flip_polygons(charboxes, entry['width'])
        words = [flip_word(x) for x in entry['words']]
        flipped_entry = {}
        dont_copy = ('boxes', 'segms', 'gt_keypoints', 'flipped', 'polygons', 'charboxes', 'words')
        for k, v in entry.items():
            if k not in dont_copy:
                flipped_entry[k] = v
        flipped_entry['boxes'] = boxes
        flipped_entry['segms'] = segm_utils.flip_segms(
            entry['segms'], entry['height'], entry['width']
        )
        flipped_entry['polygons'] = polygons
        flipped_entry['charboxes'] = charboxes
        flipped_entry['words'] = words
        if dataset.keypoints is not None:
            flipped_entry['gt_keypoints'] = keypoint_utils.flip_keypoints(
                dataset.keypoints, dataset.keypoint_flip_map,
                entry['gt_keypoints'], entry['width']
            )
        flipped_entry['flipped'] = True
        flipped_roidb.append(flipped_entry)
    roidb.extend(flipped_roidb) 
開發者ID:lvpengyuan,項目名稱:masktextspotter.caffe2,代碼行數:43,代碼來源:roidb_text.py

示例4: extend_with_flipped_entries

# 需要導入模塊: from utils import keypoints [as 別名]
# 或者: from utils.keypoints import flip_keypoints [as 別名]
def extend_with_flipped_entries(roidb, dataset):
    """Flip each entry in the given roidb and return a new roidb that is the
    concatenation of the original roidb and the flipped entries.

    "Flipping" an entry means that that image and associated metadata (e.g.,
    ground truth boxes and object proposals) are horizontally flipped.
    """
    # import ipdb; ipdb.set_trace()
    flipped_roidb = []
    for entry in roidb:
        entry['flipped'] = False
        width = entry['width']
        boxes = entry['boxes'].copy()
        precomp_boxes = entry['precomp_boxes'].copy()
        oldx1 = boxes[:, 0].copy()
        oldx2 = boxes[:, 2].copy()
        precomp_boxes_x1 = precomp_boxes[:, 0].copy()
        precomp_boxes_x2 = precomp_boxes[:, 2].copy()
        boxes[:, 0] = width - oldx2 - 1
        boxes[:, 2] = width - oldx1 - 1
        precomp_boxes[:, 0] = width - precomp_boxes_x2 - 1
        precomp_boxes[:, 2] = width - precomp_boxes_x1 - 1
        assert (boxes[:, 2] >= boxes[:, 0]).all()
        flipped_entry = {}
        dont_copy = ('boxes', 'segms', 'gt_keypoints', 'flipped', 'precomp_boxes')

        for k, v in entry.items():
            if k not in dont_copy:
                flipped_entry[k] = v
        flipped_entry['boxes'] = boxes
        flipped_entry['precomp_boxes'] = precomp_boxes
        flipped_entry['segms'] = segm_utils.flip_segms(
            entry['segms'], entry['height'], entry['width']
        )
        if dataset.keypoints is not None:
            flipped_entry['gt_keypoints'] = keypoint_utils.flip_keypoints(
                dataset.keypoints, dataset.keypoint_flip_map,
                entry['gt_keypoints'], entry['width']
            )
            flipped_entry['precomp_keypoints'] = keypoint_utils.flip_keypoints(
                dataset.keypoints, dataset.keypoint_flip_map,
                entry['precomp_keypoints'], entry['width']
            )
        flipped_entry['flipped'] = True
        flipped_roidb.append(flipped_entry)
    roidb.extend(flipped_roidb) 
開發者ID:bobwan1995,項目名稱:PMFNet,代碼行數:48,代碼來源:roidb.py


注:本文中的utils.keypoints.flip_keypoints方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。