test.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:RON 作者: taokong 项目源码 文件源码
def _get_image_blob(ims, target_size):
    """Converts an image into a network input.

    Arguments:
        im (ndarray): a color image in BGR order

    Returns:
        blob (ndarray): a data blob holding an image pyramid
        im_infos(ndarray): a data blob holding input size pyramid
    """
    processed_ims = []
    for im in ims:
        im = im.astype(np.float32, copy = False)
        im = im - cfg.PIXEL_MEANS
        im_shape = im.shape[0:2]
        im = cv2.resize(im, None, None, fx = float(target_size) / im_shape[1], \
            fy = float(target_size) / im_shape[0], interpolation = cv2.INTER_LINEAR)
        processed_ims.append(im)

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号