def _get_image_blob(roidb, scale_inds):
"""Builds an input blob from the images in the roidb at the specified
scales.
"""
num_images = len(roidb)
processed_ims = []
im_scales = []
im_shapes = np.zeros((0, 2), dtype=np.float32)
for i in xrange(num_images):
im = cv2.imread(roidb[i]['image'])
if roidb[i]['flipped']:
im = im[:, ::-1, :]
target_size = cfg.TRAIN.SCALES[scale_inds[i]]
im, im_scale, im_shape = prep_im_for_blob(im, cfg.PIXEL_MEANS, target_size)
im_scales.append(im_scale)
processed_ims.append(im)
im_shapes = np.vstack((im_shapes, im_shape))
# Create a blob to hold the input images
blob = im_list_to_blob(processed_ims)
return blob, im_scales, im_shapes
评论列表
文章目录