91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8.72MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2022-11-19
  • 語言: 其他
  • 標簽:

資源簡介

圖像風格遷移原始論文完整實現代碼,可以實現內容圖片和風格圖片的轉化,https://blog.csdn.net/kevinoop/article/details/79827782 這個博客有代碼詳細介紹。

資源截圖

代碼片段和文件信息

#?-*-?coding:?utf-8?-*-
“““
Created?on?Sun?Jan?21?11:14:40?2018

@author:?ASUS
“““
import?os
import?sys
import?scipy.io
import?scipy.misc
import?matplotlib.pyplot?as?plt
from?matplotlib.pyplot?import?imshow
from?PIL?import?Image
from?nst_utils?import?*
import?numpy?as?np
import?tensorflow?as?tf

#matplotlib?inline
def?compute_content_cost(a_C?a_G):
????“““
????Computes?the?content?cost
????
????Arguments:
????a_C?--?tensor?of?dimension?(1?n_H?n_W?n_C)?hidden?layer?activations?representing?content?of?the?image?C?
????a_G?--?tensor?of?dimension?(1?n_H?n_W?n_C)?hidden?layer?activations?representing?content?of?the?image?G
????
????Returns:?
????J_content?--?scalar?that?you?compute?using?equation?1?above.
????“““
????
????#?Retrieve?dimensions?from?a_G?(≈1?line)
????m?n_H?n_W?n_C?=?a_G.get_shape().as_list()
????#?Reshape?a_C?and?a_G?(≈2?lines)
????a_C_unrolled?=?tf.reshape(tf.transpose(a_C?perm=[3?2?1?0])?[n_C?n_H*n_W?-1])
????a_G_unrolled?=?tf.reshape(tf.transpose(a_G?perm=[3?2?1?0])?[n_C?n_H*n_W?-1])
????#?compute?the?cost?with?tensorflow?(≈1?line)
????J_content?=?tf.reduce_sum(tf.square(tf.subtract(a_C_unrolled?a_G_unrolled)))?/?(4?*?n_H?*?n_W?*?n_C)
????
????return?J_content

def?gram_matrix(A):
????“““
????Argument:
????A?--?matrix?of?shape?(n_C?n_H*n_W)
????
????Returns:
????GA?--?Gram?matrix?of?A?of?shape?(n_C?n_C)
????“““???
????GA?=?tf.matmul(Atf.transpose(A))?
????return?GA

def?compute_layer_style_cost(a_S?a_G):
????“““
????Arguments:
????a_S?--?tensor?of?dimension?(1?n_H?n_W?n_C)?hidden?layer?activations?representing?style?of?the?image?S?
????a_G?--?tensor?of?dimension?(1?n_H?n_W?n_C)?hidden?layer?activations?representing?style?of?the?image?G
????
????Returns:?
????J_style_layer?--?tensor?representing?a?scalar?value?style?cost?defined?above?by?equation?(2)
????“““
????#?Retrieve?dimensions?from?a_G?(≈1?line)
????m?n_H?n_W?n_C?=?a_G.get_shape().as_list()
????#?Reshape?the?images?to?have?them?of?shape?(n_C?n_H*n_W)?(≈2?lines)
????a_S?=?tf.reshape(tf.transpose(a_S?perm=[3?1?2?0])?[n_C?n_W*n_H])
????a_G?=?tf.reshape(tf.transpose(a_G?perm=[3?1?2?0])?[n_C?n_W*n_H])
????#?Computing?gram_matrices?for?both?images?S?and?G?(≈2?lines)
????GS?=?gram_matrix(a_S)
????GG?=?gram_matrix(a_G)
????#?Computing?the?loss?(≈1?line)
????J_style_layer?=?tf.reduce_sum(tf.square(tf.subtract(GS?GG)))?/?(4?*?n_C**2?*?(n_W?*?n_H)**2)
????return?J_style_layer

style_layerS?=?[
????(‘conv1_1‘?0.2)
????(‘conv2_1‘?0.2)
????(‘conv3_1‘?0.2)
????(‘conv4_1‘?0.2)
????(‘conv5_1‘?0.2)]

def?compute_style_cost(model?style_layerS):
????“““
????Computes?the?overall?style?cost?from?several?chosen?layers
????
????Arguments:
????model?--?our?tensorflow?model
????style_layerS?--?A?python?list?containing:
????????????????????????-?the?names?of?the?layers?we?would?like?to?extract?style?from
????????????????????????-?a?coefficient?for?eac

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????????68??2018-05-12?10:40??pretrained-model\預訓練數據下載網址.txt
?????文件????????7669??2018-01-21?11:33??NST(Gaty).py
?????目錄???????????0??2018-01-21?11:25??images\
?????文件??????720646??2017-11-26?03:30??images\NST_GM.png
?????文件??????868690??2017-11-26?03:30??images\NST_LOSS.png
?????文件??????533504??2017-12-28?23:38??images\Thumbs.db
?????文件???????76975??2017-11-26?03:30??images\camp-nou.jpg
?????文件???????33239??2017-11-26?03:30??images\cat.jpg
?????文件??????930639??2017-11-26?03:30??images\circle_abstract.png
?????文件???????29674??2017-11-26?03:30??images\claude-monet.jpg
?????文件???????90349??2017-11-26?03:30??images\content.jpeg
?????文件???????21296??2017-11-26?03:30??images\content300.jpg
?????文件??????232594??2017-11-26?03:30??images\content_plus_style.png
?????文件???????74758??2017-11-26?03:30??images\drop-of-water.jpg
?????文件??????320270??2017-11-26?03:30??images\gram.png
?????文件??????368783??2017-11-26?03:30??images\hidden_layers.png
?????文件??????168901??2017-11-26?03:30??images\louvre.jpg
?????文件??????897986??2017-11-26?03:30??images\louvre_generated.png
?????文件???????50296??2017-11-26?03:30??images\louvre_small.jpg
?????文件???????48146??2017-11-26?03:30??images\monet.jpg
?????文件??????172643??2017-11-26?03:30??images\monet_800600.jpg
?????文件??????858141??2017-11-26?03:30??images\pasargad_kashi.png
?????文件??????238928??2017-11-26?03:30??images\persian_cat.jpg
?????文件???????30492??2017-11-26?03:30??images\persian_cat_content.jpg
?????文件??????820820??2017-11-26?03:30??images\perspolis_vangogh.png
?????文件??????329708??2017-11-26?03:30??images\reshape_loss.png
?????文件??????893421??2017-11-26?03:30??images\result.png
?????文件???????66303??2017-11-26?03:30??images\sandstone.jpg
?????文件???????53165??2017-11-26?03:30??images\stone_style.jpg
?????文件???????29674??2017-11-26?03:30??images\style300.jpg
?????文件????????6716??2017-12-20?23:45??nst_utils.py
............此處省略4個文件信息

評論

共有 條評論