ADMMutils.py 文件源码

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

项目:sparsecnn 作者: fkiaee 项目源码 文件源码
def read_image(path):
    img = imread(path,mode="RGB")
    h, w, c = np.shape(img)
    scale_size = 256
    crop_size = 224
    assert c == 3
    img = zoom(img, (scale_size/h, scale_size/w,1))
    img = img.astype(np.float32)
    img -= np.array([104., 117., 124.])
    h, w, c = img.shape
    ho, wo = ((h - crop_size) / 2, (w - crop_size) / 2)
    img = img[ho:ho + crop_size, wo:wo + crop_size, :]
    #print(np.shape(img))
    img = img[None, ...]
    return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号