吴裕雄--天生自然PythonDjangoWeb企业开发:解决Pythonno module named "XX"问题
摘要:在项目中加入 sys.path.append('你的django项目路径') sys.path.append('python的site-packages路径')
阅读全文
吴裕雄--天生自然深度学习TensorBoard可视化:projector_MNIST
摘要:import os import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.contrib.tensorboard.plugins import projector INPUT_NODE = 784 OUTPUT_NODE = 10 LAYER1_NODE
阅读全文
吴裕雄--天生自然深度学习TensorBoard可视化:projector_data_prepare
摘要:import os import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data %matplotlib inline LOG_DIR = 'F:\\temp\\log\\' SPRITE_FI
阅读全文
吴裕雄--天生自然深度学习TensorBoard可视化:监控指标可视化
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 1. 生成变量监控信息并定义生成监控信息日志的操作。 SUMMARY_DIR = "F:\\temp\\log" BATCH_SIZE = 100 TRAIN_STEPS = 3000 def variable_summaries
阅读全文
吴裕雄--天生自然深度学习TensorBoard可视化:改造后的mnist_train
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 OUTPUT_NODE = 10 LAYER1_NODE = 500 def get_weight_variable(shape, regularizer): weights = tf.get_var
阅读全文
吴裕雄--天生自然深度学习TensorBoard可视化:命名空间
摘要:# 1. 不同的命名空间。 import tensorflow as tf with tf.variable_scope("foo"): a = tf.get_variable("bar", [1]) print(a.name) with tf.variable_scope("bar"): b = tf.get_variable("bar", [1]) pri...
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Estimator-自定义模型
摘要:# 1. 自定义模型并训练。 import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data tf.logging.set_verbosity(tf.logging.INFO) def lenet(x, is_training): x = tf.reshape
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Estimator-DNNClassifier
摘要:# 1. 模型定义。 import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data tf.logging.set_verbosity(tf.logging.INFO) mnist = input_data.read_data_sets("F:\\Tensor
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Keras-TensorFlow API
摘要:# 1. 模型定义。 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist_data = input_data.read_data_sets('F:\\TensorFlowGoogle\\201806-github\\datasets\\MNIST_data', one_...
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Keras-多输入输出
摘要:# 1. 数据预处理。 import keras from keras.models import Model from keras.datasets import mnist from keras.layers import Input, Dense from tflearn.layers.core import fully_connected num_classes = 10 img_ro...
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Keras-返回值
摘要:# 1. 数据预处理。 import keras from keras.models import Model from keras.datasets import mnist from keras.layers import Input, Dense from tflearn.layers.core import fully_connected num_classes = 10 img_ro...
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Keras-RNN
摘要:# 1. 数据预处理。 from keras.layers import LSTM from keras.datasets import imdb from keras.models import Sequential from keras.preprocessing import sequence from keras.layers import Dense, Embedding max_fea
阅读全文
吴裕雄--天生自然TensorFlow高层封装:Keras-CNN
摘要:# 1. 数据预处理 import keras from keras import backend as K from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D num_classes =
阅读全文
吴裕雄--天生自然TensorFlow高层封装:使用TFLearn处理MNIST数据集实现LeNet-5模型
摘要:# 1. 通过TFLearn的API定义卷机神经网络。 import tflearn import tflearn.datasets.mnist as mnist from tflearn.layers.conv import conv_2d, max_pool_2d from tflearn.layers.estimator import regression from tflearn.laye
阅读全文
吴裕雄--天生自然TensorFlow高层封装:使用TensorFlow-Slim处理MNIST数据集实现LeNet-5模型
摘要:# 1. 通过TensorFlow-Slim定义卷机神经网络 import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from tensorflow.examples.tutorials.mnist import input_data # 通过TensorFlow-Slim来定义LeN...
阅读全文
吴裕雄--天生自然 pythonTensorFlow自然语言处理:Attention模型--测试
摘要:import sys import codecs import tensorflow as tf # 1.参数设置。 # 读取checkpoint的路径。9000表示是训练程序在第9000步保存的checkpoint。 CHECKPOINT_PATH = "F:\\temp\\attention_ckpt-9000" # 模型参数。必须与训练时的模型参数保持一致。 HIDDEN_SIZE =...
阅读全文
吴裕雄--天生自然 pythonTensorFlow自然语言处理:Attention模型--训练
摘要:import tensorflow as tf # 1.参数设置。 # 假设输入数据已经转换成了单词编号的格式。 SRC_TRAIN_DATA = "F:\\TensorFlowGoogle\\201806-github\\TensorFlowGoogleCode\\Chapter09\\train.en" # 源语言输入文件。 TRG_TRAIN_DATA = "F:\\TensorFlowGo
阅读全文
吴裕雄--天生自然 pythonTensorFlow自然语言处理:Seq2Seq模型--测试
摘要:import sys import codecs import tensorflow as tf # 1.参数设置。 # 读取checkpoint的路径。9000表示是训练程序在第9000步保存的checkpoint。 CHECKPOINT_PATH = "F:\\temp\\seq2seq_ckpt-9000" # 模型参数。必须与训练时的模型参数保持一致。 HIDDEN_SIZE = 1024
阅读全文