14_DeepDream.py 文件源码

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

项目:LIE 作者: EmbraceLife 项目源码 文件源码
def save_image(image, filename):
    # Ensure the pixel-values are between 0 and 255.
    image = np.clip(image, 0.0, 255.0)

    # Convert to bytes.
    image = image.astype(np.uint8)

    # Write the image-file in jpeg-format.
    with open(filename, 'wb') as file:
        PIL.Image.fromarray(image).save(file, 'jpeg')


# This function plots an image. Using matplotlib gives low-resolution images. Using PIL gives pretty pictures.

# In[12]:
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号