utils.py 文件源码

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

项目:enet-keras 作者: PavlosMelissinos 项目源码 文件源码
def preprocess_label(label):
    """
    load label image, keep a single channel (all three should be the same)
    :param label:
    :return:
    """
    # TODO: Populate with actual logic and move away from here into a dedicated class (like ImageDataGenerator)
    # target = 'pillow' if mode == 'pillow' else 'numpy'
    # # lbl = resize(lbl, target_h, target_w, mode=mode, target_type='numpy', keep_aspect_ratio=keep_aspect_ratio)
    # if mode == 'pillow':
    #     # lbl = np.expand_dims(lbl[:, :, 0], axis=2)
    #     assert np.all(lbl[:, :, 0] == lbl[:, :, 1]) and np.all(lbl[:, :, 0] == lbl[:, :, 2])
    #     lbl = lbl[:, :, 0].astype(np.uint8)
    # array2d = mapper[lbl]
    # onehot_lbl = to_categorical(array2d, num_classes=nc)
    # return onehot_lbl
    return label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号