minibatch.py 文件源码

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

项目:fast-rcnn-distillation 作者: xiaolonw 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号