资源简介
深度学习(花书)代码和笔记:一份深度学习的笔记(英文),以及相关的代码
代码片段和文件信息
# coding: UTF-8
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
file name: main.py
create time: 2017年09月01日 星期五 13时48分54秒
author: Jipeng Huang
e-mail: huangjipengnju@gmail.com
github: https://github.com/hjptriplebee
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘
# based on tensorflow/example/tutorials deepdream
import os
import argparse
import tensorflow as tf
import numpy as np
import cv2
# parameter
model_name = “tensorflow_inception_graph.pb“
imagenet_mean = 117.0
layer = ‘mixed4c‘
iter_num = 50
octave_num = 4
octave_scale = 1.4
learning_rate = 1.5
tile_size = 512
noise = np.random.uniform(size=(224 224 3)) + 100.0
def define_args():
“““define args“““
parser = argparse.ArgumentParser(description=“deep_dream“)
parser.add_argument(“-i“ “--input“ help=“input path“ default=“none“)
parser.add_argument(“-o“ “--output“ help=“output path“ default=“output/output.jpg“)
return parser.parse_args()
def get_model():
“““download model“““
model = os.path.join(“model“ model_name)
if not os.path.exists(model):
print(“Down model...“)
os.system(“wget https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -P model“)
os.system(“unzip model/inception5h.zip -d model“)
os.system(“rm model/inception5h.zip“)
os.system(“rm model/imagenet_comp_graph_label_strings.txt“)
return model
def deep_dream(model output_path input_image=noise):
“““implement of deep dream“““
# define graph
graph = tf.Graph()
sess = tf.InteractiveSession(graph=graph)
# load model
with tf.gfile.FastGFile(model “rb“) as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
# define input
X = tf.placeholder(tf.float32 name=“input“)
X2 = tf.expand_dims(X - imagenet_mean 0)
tf.import_graph_def(graph_def {“input“: X2})
# L2 and gradient
loss = tf.reduce_mean(tf.square(graph.get_tensor_by_name(“import/%s:0“ % layer)))
gradient = tf.gradients(loss X)[0]
image = input_image
octaves = []
# tranforming TF function
def tffunc(*argtypes):
placeholders = list(map(tf.placeholder argtypes))
def wrap(f):
out = f(*placeholders)
def wrapper(*args **kw):
return out.eval(dict(zip(placeholders args)) session=kw.get(‘session‘))
return wrapper
return wrap
def resize(image size):
“““resize image in nparray“““
image = tf.expand_dims(image 0)
return tf.image.resize_bilinear(image size)[0 : : :]
resize = tffunc(np.float32 np.int32)(resize)
for i in range(octave_num - 1):
size = np.shape(image)[:2]
narrow_size = np.int32(np.float32(size) / octave_scale)
# down sampling and up sampling equal to smooth diff can save significance
down = resize(image narrow_size)
diff = image - resize(down size)
image = do
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 306 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\.gitignore
文件 149739 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\bak\function-approximation\figures\long.png
文件 18630 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\bak\function-approximation\figures\model.png
文件 0 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\bak\function-approximation\README.md
文件 2395 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\bak\README.md
文件 4601 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\pending\CNN_deepdream\DeepDream.py
文件 2810 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\pending\CNN_deepdream\README.md
文件 431 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\pending\README.md
文件 8606 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\README.md
文件 20424 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\img\network-structure.png
文件 10413 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\img\share-weight.png
文件 35705 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\img\sparse-representation.png
文件 1587 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\README.md
文件 6707 2019-04-12 20:34 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\src\simple-mnist-CNN.ipynb
文件 5519 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\卷积网络\简单卷积网络.md
文件 23 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\实践调参\README.md
文件 137 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\CharRNN.md
文件 44701 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\img\sinx.png
文件 51756 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\img\sinxx.png
文件 327 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\LSTM.md
文件 518 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\RNN.md
文件 189589 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\rnn_func_approx.ipynb
文件 565 2019-04-12 20:32 深度学习(花书)代码和笔记\simplified-deeplearning-master\循环递归网络\Sequence.md
文件 8556 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\gradient_descent_loss.png
文件 14309 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\graph_model.png
文件 20007 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\laplace_dist.png
文件 13163 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\local_min.png
文件 9739 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\logistic_curve.png
文件 11770 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\logistic_feature.png
文件 17068 2019-04-12 20:33 深度学习(花书)代码和笔记\simplified-deeplearning-master\数学基础\img\max_min_saddle_point.png
............此处省略124个文件信息
- 上一篇:MSDOS7.1操作系统
- 下一篇:Xcode支持iOS12.2 设备真机测试包
相关资源
- NSC2018第六届中国网络安全大会PPT
- 三菱Q系列PLC 手册 教程 Q62DA Q64DA Q68
- AI拓客商家联盟V2.1.3前端+后端.rar
- 10个HUD高科技界面.zip
- why programs fail 系统化调试指南中文版
- 阿里天池FashionAI服装属性标签图像识
- 基于百度Ai -- 理解与交互技术UNIT 实现
- 情感机器_马文明斯基
- FSX 飞行模拟教程
- unity3d 怪物AI智能攻击源码
- Magic Winmail 4.7邮件系统 最终完全破解
- HPE服务器Windows下磁盘阵列(RAID) 管
- Speech and Language Processing: An introductio
- TerraVolVoxelTerrainEngine2.1c.7z
- Grails.in.Action.2nd.Edition.2014.6.pdf
- Raize FOR XE10 源码版本 亲测好用
- airopeek汉化破解版
- 深度学习中文版-Deep+Learning-Yoshua+Ben
- markmMan(马克鳗) for mac 2.7.21 破解版
- Linear Systems Thomas Kailath 1980
- 智能电话机器人源码,电销ai机器人源
-
zw_baidu_38396237-10813429-weibodataba
se.zi - 微软雅黑 JetBrainsMono 混合字体,编程
- 最新18000多个动物数据大全
- 2D Hand Painted - Dungeon Tileset v1.2.unitypa
- 5G时代下的AI应用场景展望.pdf
- Programming Game AI by Example-游戏人工智能
- Qt实现中国象棋支持局域网对战,混战
- 机器人学导论(原书第3版)_(美)
- raid驱动Windows server版
评论
共有 条评论