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
评论列表
文章目录