当前位置: 首页>>代码示例>>Python>>正文


Python bbox_transform.bbox_pred方法代码示例

本文整理汇总了Python中bbox.bbox_transform.bbox_pred方法的典型用法代码示例。如果您正苦于以下问题:Python bbox_transform.bbox_pred方法的具体用法?Python bbox_transform.bbox_pred怎么用?Python bbox_transform.bbox_pred使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bbox.bbox_transform的用法示例。


在下文中一共展示了bbox_transform.bbox_pred方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: im_detect

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def im_detect(predictor, data_batch, data_names, scales, cfg):
    output_all = predictor.predict(data_batch)
    data_dict_all = [dict(zip(data_names, data_batch.data[i])) for i in xrange(len(data_batch.data))]
    scores_all = []
    pred_boxes_all = []
    for output, data_dict, scale in zip(output_all, data_dict_all, scales):
        if cfg.TEST.HAS_RPN:
            rois = output['rois_output'].asnumpy()[:, 1:]
        else:
            rois = data_dict['rois'].asnumpy().reshape((-1, 5))[:, 1:]
        im_shape = data_dict['data'].shape

        # save output
        scores = output['cls_prob_reshape_output'].asnumpy()[0]
        bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]
        # post processing
        pred_boxes = bbox_pred(rois, bbox_deltas)
        pred_boxes = clip_boxes(pred_boxes, im_shape[-2:])

        # we used scaled image & roi to train, so it is necessary to transform them back
        pred_boxes = pred_boxes / scale

        scores_all.append(scores)
        pred_boxes_all.append(pred_boxes)
    return zip(scores_all, pred_boxes_all, data_dict_all) 
开发者ID:wangshy31,项目名称:MANet_for_Video_Object_Detection,代码行数:27,代码来源:tester.py

示例2: check_movements

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def check_movements(ims, bef_ims, aft_ims, processed_roidb, delta_bef_roi, delta_aft_roi):
    save_name = '/home/wangshiyao/Documents/testdata/'+processed_roidb[0]['image'].split('/')[-1]
    print 'saving images to '+save_name
    boxes = processed_roidb[0]['boxes']
    ims.squeeze().transpose(1, 2, 0).astype(np.int8)
    bef_ims.squeeze().transpose(1, 2, 0).astype(np.int8)
    aft_ims.squeeze().transpose(1, 2, 0).astype(np.int8)
    delta_bef_roi = np.array(delta_bef_roi).transpose(1, 0, 2)
    delta_aft_roi = np.array(delta_aft_roi).transpose(1, 0, 2)
    for i in range(boxes.shape[0]):
        cv2.rectangle(ims, (int(boxes[i][0]), int(boxes[i][1])),(int(boxes[i][2]), int(boxes[i][3])),(55, 255, 155),5)
        bef_box = bbox_pred(boxes[i].reshape(1, -1), delta_bef_roi[i])
        cv2.rectangle(bef_ims, (int(bef_box[0][0]), int(bef_box[0][1])),(int(bef_box[0][2]), int(bef_box[0][3])),(55, 255, 155),5)
        aft_box = bbox_pred(boxes[i].reshape(1, -1), delta_aft_roi[i])
        cv2.rectangle(aft_ims, (int(aft_box[0][0]), int(aft_box[0][1])),(int(aft_box[0][2]), int(aft_box[0][3])),(55, 255, 155),5)

    imageio.imsave(save_name, ims)
    imageio.imsave(save_name.split('.')[-2]+'_bef'+'.JPEG', bef_ims)
    imageio.imsave(save_name.split('.')[-2]+'_aft'+'.JPEG', aft_ims) 
开发者ID:wangshy31,项目名称:MANet_for_Video_Object_Detection,代码行数:21,代码来源:image.py

示例3: im_detect

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def im_detect(predictor, data_batch, data_names, scales, cfg):
    output_all = predictor.predict(data_batch)

    data_dict_all = [dict(zip(data_names, idata)) for idata in data_batch.data]
    scores_all = []
    pred_boxes_all = []
    for output, data_dict, scale in zip(output_all, data_dict_all, scales):
        if cfg.TEST.HAS_RPN:
            rois = output['rois_output'].asnumpy()[:, 1:]
        else:
            rois = data_dict['rois'].asnumpy().reshape((-1, 5))[:, 1:]
        im_shape = data_dict['data'].shape

        # save output
        scores = output['cls_prob_reshape_output'].asnumpy()[0]
        bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]

        # post processing
        pred_boxes = bbox_pred(rois, bbox_deltas)
        pred_boxes = clip_boxes(pred_boxes, im_shape[-2:])

        # we used scaled image & roi to train, so it is necessary to transform them back
        pred_boxes = pred_boxes / scale

        scores_all.append(scores)
        pred_boxes_all.append(pred_boxes)
    return scores_all, pred_boxes_all, data_dict_all 
开发者ID:i-pan,项目名称:kaggle-rsna18,代码行数:29,代码来源:tester.py

示例4: list_arguments

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def list_arguments(self):
        return ['cls_prob', 'bbox_pred', 'im_info'] 
开发者ID:i-pan,项目名称:kaggle-rsna18,代码行数:4,代码来源:proposal.py

示例5: im_batch_detect

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def im_batch_detect(predictor, data_batch, data_names, scales, cfg):
    output_all = predictor.predict(data_batch)

    data_dict_all = [dict(zip(data_names, data_batch.data[i])) for i in xrange(len(data_batch.data))]
    scores_all = []
    pred_boxes_all = []
    for output, data_dict, scale in zip(output_all, data_dict_all, scales):
        im_infos = data_dict['im_info'].asnumpy()
        # save output
        scores = output['cls_prob_reshape_output'].asnumpy()[0]
        bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]
        rois = output['rois_output'].asnumpy()
        for im_idx in xrange(im_infos.shape[0]):
            bb_idxs = np.where(rois[:,0] == im_idx)[0]
            im_shape = im_infos[im_idx, :2].astype(np.int)

            # post processing
            pred_boxes = bbox_pred(rois[bb_idxs, 1:], bbox_deltas[bb_idxs, :])
            pred_boxes = clip_boxes(pred_boxes, im_shape)

            # we used scaled image & roi to train, so it is necessary to transform them back
            pred_boxes = pred_boxes / scale[im_idx]

            scores_all.append(scores[bb_idxs, :])
            pred_boxes_all.append(pred_boxes)

    return scores_all, pred_boxes_all, data_dict_all 
开发者ID:wangshy31,项目名称:MANet_for_Video_Object_Detection,代码行数:29,代码来源:tester.py

示例6: im_detect

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def im_detect(predictor, data_batch, data_names, scales, cfg):
    output_all = predictor.predict(data_batch)

    data_dict_all = [dict(zip(data_names, data_batch.data[i])) for i in xrange(len(data_batch.data))]
    scores_all = []
    pred_boxes_all = []
    for output, data_dict, scale in zip(output_all, data_dict_all, scales):
        if cfg.TEST.HAS_RPN:
            rois = output['rois_output'].asnumpy()[:, 1:]
        else:
            rois = data_dict['rois'].asnumpy().reshape((-1, 5))[:, 1:]
        im_shape = data_dict['data'].shape

        # save output
        scores = output['cls_prob_reshape_output'].asnumpy()[0]
        bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]

        # post processing
        pred_boxes = bbox_pred(rois, bbox_deltas)
        pred_boxes = clip_boxes(pred_boxes, im_shape[-2:])

        # we used scaled image & roi to train, so it is necessary to transform them back
        pred_boxes = pred_boxes / scale

        scores_all.append(scores)
        pred_boxes_all.append(pred_boxes)

    if output_all[0].has_key('feat_conv_3x3_relu_output'):
        feat = output_all[0]['feat_conv_3x3_relu_output']
    else:
        feat = None
    return scores_all, pred_boxes_all, data_dict_all, feat 
开发者ID:msracver,项目名称:Deep-Feature-Flow,代码行数:34,代码来源:tester.py

示例7: list_arguments

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def list_arguments(self):

        return ['rois', 'bbox_pred', 'cls_prob', 'im_info'] 
开发者ID:dingjiansw101,项目名称:RoITransformer_DOTA,代码行数:5,代码来源:RRoIDecoder.py

示例8: im_detect

# 需要导入模块: from bbox import bbox_transform [as 别名]
# 或者: from bbox.bbox_transform import bbox_pred [as 别名]
def im_detect(predictor, data_batch, data_names, scales, cfg):
    output_all = predictor.predict(data_batch)

    data_dict_all = [dict(zip(data_names, idata)) for idata in data_batch.data]
    scores_all = []
    pred_boxes_all = []
    for output, data_dict, scale in zip(output_all, data_dict_all, scales):
        if cfg.TEST.HAS_RPN or cfg.network.ROIDispatch:
            rois = output['rois_output'].asnumpy()[:, 1:]
        else:
            rois = data_dict['rois'].asnumpy().reshape((-1, 5))[:, 1:]
        im_shape = data_dict['data'].shape

        # save output
        if cfg.TEST.LEARN_NMS:
            pred_boxes = output['learn_nms_sorted_bbox'].asnumpy()
            # raw_scores = output['sorted_score_output'].asnumpy()
            scores = output['nms_final_score_output'].asnumpy()
        else:
            scores = output['cls_prob_reshape_output'].asnumpy()[0]
            bbox_deltas = output['bbox_pred_reshape_output'].asnumpy()[0]

            # post processing
            pred_boxes = bbox_pred(rois, bbox_deltas)
            pred_boxes = clip_boxes(pred_boxes, im_shape[-2:])

        # we used scaled image & roi to train, so it is necessary to transform them back
        pred_boxes = pred_boxes / scale

        scores_all.append(scores)
        pred_boxes_all.append(pred_boxes)
    return scores_all, pred_boxes_all, data_dict_all 
开发者ID:msracver,项目名称:Relation-Networks-for-Object-Detection,代码行数:34,代码来源:tester.py


注:本文中的bbox.bbox_transform.bbox_pred方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。