当前位置: 首页>>代码示例>>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;未经允许,请勿转载。