data_loading_module.py 文件源码

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

项目:road-segmentation 作者: paramoecium 项目源码 文件源码
def extract_label_images(filename_base, num_images, patch_size=const.IMG_PATCH_SIZE,
                         patch_stride=const.IMG_PATCH_STRIDE, img_base_name="satImage_%.3d"):
    """Extract labels from ground truth as label images."""
    gt_imgs = []
    for i in range(1, num_images+1):
        imageid = img_base_name % i
        image_filename = filename_base + imageid + ".png"
        if os.path.isfile(image_filename):
            print('Loading ' + image_filename)
            img = mpimg.imread(image_filename)
            gt_imgs.append(img)
        else:
            print('File ' + image_filename + ' does not exist')

    num_images = len(gt_imgs)
    print('Extracting patches...')
    gt_patches = [pixel_to_patch_labels(gt_imgs[i], patch_size, patch_stride) for i in range(num_images)]

    return gt_patches
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号