cfm_data_layer.py 文件源码

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

项目:MNC 作者: daijifeng001 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号