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

  • 大小: 10.94MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2022-03-22
  • 語言: 其他
  • 標(biāo)簽: Image??style??transfer??

資源簡介

用于圖像風(fēng)格轉(zhuǎn)化(image style transfer)的代碼實(shí)現(xiàn)。

資源截圖

代碼片段和文件信息

#?#?style?Transfer
#?In?this?notebook?we?will?implement?the?style?transfer?technique?from?[“Image?style?Transfer?Using?Convolutional?Neural?Networks“?(Gatys?et?al.?CVPR?2015)](http://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_style_Transfer_CVPR_2016_paper.pdf).
#
#?The?general?idea?is?to?take?two?images?and?produce?a?new?image?that?reflects?the?content?of?one?but?the?artistic?“style“?of?the?other.?We?will?do?this?by?first?formulating?a?loss?function?that?matches?the?content?and?style?of?each?respective?image?in?the?feature?space?of?a?deep?network?and?then?performing?gradient?descent?on?the?pixels?of?the?image?itself.
#
#?The?deep?network?we?use?as?a?feature?extractor?is?[SqueezeNet](https://arxiv.org/abs/1602.07360)?a?small?model?that?has?been?trained?on?ImageNet.?You?could?use?any?network?but?we?chose?SqueezeNet?here?for?its?small?size?and?efficiency.
#
#?Here‘s?an?example?of?the?images?you‘ll?be?able?to?produce?by?the?end?of?this?notebook:
#
#?![caption](example_styletransfer.png)
#
#

#?Set?up

from?scipy.misc?import?imread?imresize
import?numpy?as?np
import?os
from?scipy.misc?import?imread
import?matplotlib.pyplot?as?plt

#?Helper?functions?to?deal?with?image?preprocessing
from?cs231n.image_utils?import?load_image?preprocess_image?deprocess_image

from?cs231n.classifiers.squeezenet?import?SqueezeNet
import?tensorflow?as?tf


def?get_session():
????“““Create?a?session?that?dynamically?allocates?memory.“““
????#?See:?https://www.tensorflow.org/tutorials/using_gpu#allowing_gpu_memory_growth
????config?=?tf.ConfigProto()
????config.gpu_options.allow_growth?=?True
????session?=?tf.Session(config=config)
????return?session

def?rel_error(xy):
????return?np.max(np.abs(x?-?y)?/?(np.maximum(1e-8?np.abs(x)?+?np.abs(y))))

#?Older?versions?of?scipy.misc.imresize?yield?different?results
#?from?newer?versions?so?we?check?to?make?sure?scipy?is?up?to?date.
def?check_scipy():
????import?scipy
????vnum?=?int(scipy.__version__.split(‘.‘)[1])
????assert?vnum?>=?16?“You?must?install?SciPy?>=?0.16.0?to?complete?this?notebook.“

check_scipy()


#?Load?the?pretrained?SqueezeNet?model.?This?model?has?been?ported?from?PyTorch?see?‘cs231n/classifiers/squeezenet.py‘?for?the?model?architecture.
#
#?To?use?SqueezeNet?you?will?need?to?first?**download?the?weights**?by?changing?into?the?‘cs231n/datasets‘?directory?and?running?‘get_squeezenet_tf.sh‘?.?Note?that?if?you?ran?‘get_assignment3_data.sh‘?then?SqueezeNet?will?already?be?downloaded.


tf.reset_default_graph()?#?remove?all?existing?variables?in?the?graph
sess?=?get_session()?#?start?a?new?Session

#?Load?pretrained?SqueezeNet?model
SAVE_PATH?=?‘cs231n/datasets/squeezenet_tf/squeezenet.ckpt‘
#?if?not?os.path.exists(SAVE_PATH):
#?????raise?ValueError(“You?need?to?download?SqueezeNet!“)
model?=?SqueezeNet(save_path=SAVE_PATH?sess=sess)

#?Load?data?for?testing
content_img_test?=?preprocess_image(load_image(‘styles/

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????9792??2018-01-22?17:45??style-transfer\.idea\workspace.xml

?????文件???????4741??2017-05-18?09:46??style-transfer\cs231n\classifiers\squeezenet.py

?????文件???????3628??2018-01-22?17:42??style-transfer\cs231n\classifiers\__pycache__\squeezenet.cpython-36.pyc

?????文件????4941984??2017-05-04?11:57??style-transfer\cs231n\datasets\squeezenet_tf\squeezenet.ckpt.data-00000-of-00001

?????文件???????2293??2017-05-04?11:57??style-transfer\cs231n\datasets\squeezenet_tf\squeezenet.ckpt.index

?????文件????5060877??2017-05-04?11:57??style-transfer\cs231n\datasets\squeezenet_tf\squeezenet.ckpt.meta

?????文件???????2627??2017-12-26?14:33??style-transfer\cs231n\image_utils.py

?????文件??????66274??2017-05-18?09:46??style-transfer\style-transfer-checks-tf.npz

?????文件??????66274??2017-05-18?09:46??style-transfer\style-transfer-checks.npz

?????文件??????22417??2018-01-06?18:10??style-transfer\style-Transfer.py

?????文件?????202426??2017-05-18?09:46??style-transfer\styles\composition_vii.jpg

?????文件?????703587??2017-05-18?09:46??style-transfer\styles\muse.jpg

?????文件?????613337??2017-05-18?09:46??style-transfer\styles\starry_night.jpg

?????文件?????216723??2017-05-18?09:46??style-transfer\styles\the_scream.jpg

?????文件?????406531??2017-05-18?09:46??style-transfer\styles\tubingen.jpg

?????目錄??????????0??2018-01-22?17:42??style-transfer\cs231n\classifiers\__pycache__

?????目錄??????????0??2018-01-22?17:38??style-transfer\cs231n\datasets\squeezenet_tf

?????目錄??????????0??2018-01-22?17:42??style-transfer\cs231n\classifiers

?????目錄??????????0??2018-01-22?17:38??style-transfer\cs231n\datasets

?????目錄??????????0??2018-01-22?17:45??style-transfer\.idea

?????目錄??????????0??2018-01-22?17:44??style-transfer\cs231n

?????目錄??????????0??2018-01-22?17:38??style-transfer\styles

?????目錄??????????0??2018-01-22?17:45??style-transfer

-----------?---------??----------?-----??----

?????????????12323511????????????????????23


評(píng)論

共有 條評(píng)論