voc_utils.py 文件源码

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

项目:TF-Examples 作者: CharlesShang 项目源码 文件源码
def load_img(self, img_filename):
        """
        Summary:
            Load image from the filename. Default is to load in color if
            possible.

        Args:
            img_name (string): string of the image name, relative to
                the image directory.

        Returns:
            np array of float32: an image as a numpy array of float32
        """
        if not img_filename.endswith('.jpg'):
            img_filename = os.path.join(self.img_dir, img_filename + '.jpg')
        else:
            img_filename = os.path.join(self.img_dir, img_filename)
        img = skimage.img_as_float(io.imread(
            img_filename)).astype(np.float32)
        if img.ndim == 2:
            img = img[:, :, np.newaxis]
        elif img.shape[2] == 4:
            img = img[:, :, :3]
        return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号