def _get_image_blob(roidb, scale_inds, data_i):
"""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):
imname1 = roidb[i]['image'][data_i]
imname2= imname1 + '_norm.png'
im1= cv2.imread(imname1)
im2= cv2.imread(imname2)
if roidb[i]['flipped']:
im1 = im1[:, ::-1, :]
im2 = im2[:, ::-1, :]
im2[:,:,2] = 255 - im2[:,:,2]
im = np.zeros((im1.shape[0], im1.shape[1], 6))
im = im.astype('uint8')
im1 = im1[:, :, ::-1]
im2 = im2[:, :, ::-1]
im[:,:,0:3] = im1
im[:,:,3:6] = im2
target_size = cfg.TRAIN.SCALES[scale_inds[i]]
im, im_scale = prep_im_for_blob(im, 127.5, 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
评论列表
文章目录