utils.py 文件源码

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

项目:pytorch-caffe-darknet-convert 作者: marvis 项目源码 文件源码
def image2torch(img):
    width = img.width
    height = img.height
    img = torch.ByteTensor(torch.ByteStorage.from_buffer(img.tobytes()))
    img = img.view(height, width, 3).transpose(0,1).transpose(0,2).contiguous()
    img = img.view(1, 3, height, width)
    img = img.float().div(255.0)
    return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号