def _get_image_blob(self, roidb, scale_inds, im_names):
"""Builds an input blob from the images in the roidb at the specified
scales.
"""
num_images = len(roidb)
processed_ims = []
im_scales = []
for i in xrange(num_images):
im = cv2.imread(im_names[i])
# here [0][0] is due to the nature of scipy.io.savemat
# since it will change True/False to [[1]] or [[0]] with shape (1,1)
# so we judge whether flip image in this un-normal way
if roidb[i]['Flip'][0][0]:
im = im[:, ::-1, :]
target_size = cfg.TRAIN.SCALES[scale_inds[i]]
im, im_scale = prep_im_for_blob(im, cfg.PIXEL_MEANS, target_size,
cfg.TRAIN.MAX_SIZE)
im_scales.append(im_scale)
processed_ims.append(im)
# Create a blob to hold the input images
blob = im_list_to_blob(processed_ims)
return blob, im_scales
评论列表
文章目录