image_reader.py 文件源码

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

项目:deeplab_v1_tf1.0 作者: automan000 项目源码 文件源码
def read_labeled_image_list(data_dir, data_list):
    """Reads txt file containing paths to images and ground truth masks.

    Args:
      data_dir: path to the directory with images and masks.
      data_list: path to the file with lines of the form '/path/to/image /path/to/mask'.

    Returns:
      Two lists with all file names for images and masks, respectively.
    """
    f = open(data_list, 'r')
    images = []
    masks = []
    shape = []

    for line in f:
        image, mask = line.strip("\n").split(' ')
        images.append(data_dir + image)
        shape.append(ndimage.imread(data_dir + image).shape[:2])
        masks.append(data_dir + mask)
    return images, masks, shape
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号