资源简介
这是基于Pytorch的图片风格迁移教程源码,对其进行了逐句对照解析以便于理解。 详情请搜索博文:【Pytorch代码】神经风格迁移Pytorch教程代码 逐句解析
代码片段和文件信息
# coding: utf-8
# In[ ]:
【Paper翻译】A Neural Algorithm Artistic style:https://blog.csdn.net/sinat_33761963/article/details/53521292
# In[27]:
get_ipython().run_line_magic(‘matplotlib‘ ‘inline # Python中定义的魔法函数,使得matplotlib中绘制的图像都显示在Notebook页面内,而不是新弹出窗口‘)
# 这是IPython的命令函数,智能在Jupyter Notebook中使用,在别的IDE中会出错
#
# Neural Transfer Using PyTorch
# =============================
#
#
# **Author**: ‘Alexis Jacq ‘_
#
# **Edited by**: ‘Winston Herring ‘_
#
# Introduction
# ------------
#
# This tutorial explains how to implement the ‘Neural-style algorithm ‘__
# developed by Leon A. Gatys Alexander S. Ecker and Matthias Bethge.
# Neural-style or Neural-Transfer allows you to take an image and
# reproduce it with a new artistic style. The algorithm takes three images
# an input image a content-image and a style-image and changes the input
# to resemble the content of the content-image and the artistic style of the style-image.
#
#
# .. figure:: /_static/img/neural-style/neuralstyle.png
# :alt: content1
#
#
# 基于Pytorch的神经网络风格迁移
#
# 本教程展示如何实现由Leon A. Gatys、Alexander S. Ecker和Matthias Bethge开发的神经风格算法__。神经风格迁移可以让你用一种新的艺术风格来重构图像。该算法用一个风格图像,一个内容图像,使得模型通过改变输入来模仿内容图像的内容和样式图像的艺术风格。
# Underlying Principle
# --------------------
#
# The principle is simple: we define two distances one for the content
# ($D_C$) and one for the style ($D_S$). $D_C$ measures how different the content
# is between two images while $D_S$ measures how different the style is
# between two images. Then we take a third image the input and
# transform it to minimize both its content-distance with the
# content-image and its style-distance with the style-image. Now we can
# import the necessary packages and begin the neural transfer.
#
# Importing Packages and Selecting a Device
# -----------------------------------------
# Below is a list of the packages needed to implement the neural transfer.
#
# - ‘‘torch‘‘ ‘‘torch.nn‘‘ ‘‘numpy‘‘ (indispensables packages for
# neural networks with PyTorch)
# - ‘‘torch.optim‘‘ (efficient gradient descents)
# - ‘‘PIL‘‘ ‘‘PIL.Image‘‘ ‘‘matplotlib.pyplot‘‘ (load and display
# images)
# - ‘‘torchvision.transforms‘‘ (transform PIL images into tensors)
# - ‘‘torchvision.models‘‘ (train or load pre-trained models)
# - ‘‘copy‘‘ (to deep copy the models; system package)
#
#
# 基本原理
# 首先定义两个距离:一个内容距离(
- 上一篇:全新裂变红包,亲测可用
- 下一篇:中国行政区划shape文件
相关资源
- keras实现的VGGface 特征提取,用来抽取
- 基于CycleGAN的艺术风格迁移
- Deep Learning with PyTorch 完整版
- Opencv安装过程中使用的vgg_generated_12
- 图像风格迁移.zip
- pytorchhandbook
- 卷积与反卷积运算
- 基于pytorch的cnn水果分类器深度学习平
- VGGNet16完整测试代码
- VGG16图像分类源代码、测试图片
- vgg_generated_48,vgg_generated_64,vgg_gene
- boostdesc vgg_generated.zip
- 深度学习框架-pytorch入门与实践源代码
- pytorch visdom蓝屏,可此文件直接覆盖
- EfficientNet.tar.gz
- pytorch_yolov3_2.zip
- gpt2_chinese_poetry.rar
- pytorch .pt格式的MNIST数据集
- PyTorch Recipes A Problem-Solution Approach 20
- CycleGAN--应用于图像风格迁移
- 深度学习框架-PyTorch: 入门与实践(陈
- knowledge_representation_pytorch.zip
- Deep Reinforcement Learning Hands-On pdf
- BEGAN-pyTorch实现
-
SSD-300 VGG-ba
sed - torch-1.4.0+cpu-cp36-cp36m-win_amd64.whl
- Darknet53-pytorch
- 目标检测模型YOLOv1-v3系列,ssd的pyto
- 《PyTorch深度学习实战侯宜军 著》&《
- 深度学习框架PyTorch:入门与实践.陈云
评论
共有 条评论