image_channel.py 文件源码

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

项目:FCN_train 作者: 315386775 项目源码 文件源码
def preprocess(image):
    """Takes an image and apply preprocess"""
    # ????????????
    image = cv2.resize(image, (data_shape, data_shape))
    # ?? BGR ? RGB
    image = image[:, :, (2, 1, 0)]
    # ?mean?????float
    image = image.astype(np.float32)
    # ? mean
    image -= np.array([123, 117, 104])
    # ??? [batch-channel-height-width]
    image = np.transpose(image, (2, 0, 1))
    image = image[np.newaxis, :]
    # ?? ndarray
    image = nd.array(image)
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号