NS之VGG(Keras):基于Keras的VGG16实现之《复仇者联盟3》灭霸图像风格迁移设计(A Neural Algorithm of Artistic Style)
NS之VGG(Keras):基于Keras的VGG16实现之《复仇者联盟3》灭霸图像风格迁移设计(A Neural Algorithm of Artistic Style)
导读
通过代码设计,基于Keras的VGG16实现A Neural Algorithm of Artistic Style之灭霸风格迁移设计
输出结果实现
灭霸风格素材
1、对我的偶像胡歌,下手……
22044672/58889256 [==========>...................] - ETA: 1:53
22077440/58889256 [==========>...................] - ETA: 1:53
22093824/58889256 [==========>...................] - ETA: 1:53
22126592/58889256 [==========>...................] - ETA: 1:52
22142976/58889256 [==========>...................] - ETA: 1:52
22183936/58889256 [==========>...................] - ETA: 1:52
……
58826752/58889256 [============================>.] - ETA: 0s
58859520/58889256 [============================>.] - ETA: 0s
58875904/58889256 [============================>.] - ETA: 0s
58892288/58889256 [==============================] - 250s 4us/step
Model loaded.
Start of iteration 0
Current loss value: 2254528800.0
Image saved as F:\File_Python\Python_example\fast_style_transfer_master\examples\results_at_iteration_0.png
Iteration 0 completed in 252s
Start of iteration 1
Current loss value: 1771042400.0
Image saved as F:\File_Python\Python_example\fast_style_transfer_master\examples\results_at_iteration_1.png
Iteration 1 completed in 238s
Start of iteration 2
2、其他风格迁移设计
核心代码
#Keras:基于Keras的VGG16实现A Neural Algorithm of Artistic Style
from keras.preprocessing.image import load_img, img_to_array
import numpy as np
from scipy.misc import imsave
from scipy.optimize import fmin_l_bfgs_b
import time
from keras.applications.vgg16 import VGG16
from keras.applications.vgg16 import preprocess_input
from keras import backend as K
import os
# References
- [A Neural Algorithm of Artistic Style](http://arxiv.org/abs/1508.06576)
'''
base_image_path=r'F:\File_Python\Python_example\fast_style_transfer_master\examples\content\20180214(21).jpg'
style_reference_image_path=r'F:\File_Python\Python_example\fast_style_transfer_master\examples\style\mieba02.jpg'
result_prefix=r'F:\File_Python\Python_example\fast_style_transfer_master\examples\results'
iterations=10
content_weight=0.025
style_weight=1.0
total_variation_weight=1.0
赞 (0)