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
评论列表
文章目录