![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
tensorflow
写bug战神
这个作者很懒,什么都没留下…
展开
-
cnn验证码识别
import tensorflow as tfimport osimport pandas as pddef load_pics(filename_list): """ 1、读取图像数据,csv文件中的file_num为标签值的编号 :return: """ # print(filename_queue) # 构造文件名队列 ...原创 2019-10-18 22:09:31 · 224 阅读 · 0 评论 -
用卷积神经网络进行mnist手写体识别
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_dataimport numpy as npdef variable_init(shape): """ 定义一个变量初始化函数 :return: """ return tf.Variable(in...原创 2019-10-16 22:20:48 · 242 阅读 · 0 评论 -
mnist手写体识别
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_data# import osdef mnist_recognition(): """ 使用全连接进行手写体识别 :return: """ # 1、准备数据 # 两种数据读取方式:...原创 2019-10-15 14:01:26 · 152 阅读 · 0 评论 -
tensorflow二进制图片数据的读取
import tensorflow as tfimport osimport numpy as npclass Cifar(object): def __init__(self): # 初始化一个样本的属性 self.height = 32 self.width = 32 self.channels = 3 ...原创 2019-10-14 12:59:23 · 333 阅读 · 0 评论 -
tensorflow的图片操作之图片数据的读取
import tensorflow as tfimport osimport numpy as npdef picture_read(file_list): # 1、创建文件名队列,file_list为路径加文件名的一阶张量 file_queue = tf.train.string_input_producer(file_list) # 2、创建文件读取器 ...原创 2019-10-13 14:32:58 · 507 阅读 · 0 评论 -
tensorflow数据读取之文件读取流程
这里的string_tensor直接写入“文件名、路径”所构成的列表即可,tensorflow自动将其转换为一阶张量;shuffle=True作用为打乱传入的文件名的顺序。# 1、构造一个文件名队列file_queue = tf.train.string_input_producer(string_tensor,shuffle=True)# 2、读取与解码# 先实例化读取器与...原创 2019-10-13 13:46:04 · 270 阅读 · 0 评论 -
tensorflow中placeholder、feed_dict以及变量命名空间variable_scope的使用
import tensorflow as tfdef demo(): a = tf.compat.v1.placeholder(tf.float32) b = tf.compat.v1.placeholder(tf.float32) c = tf.add(a, b) d = tf.constant(3333) print(a) print(c...原创 2019-10-12 16:31:02 · 172 阅读 · 0 评论 -
使用Tensorboard增加变量显示
通过Tensorboard查看模型的参数、损失值等量值的变化。import tensorflow as tfimport numpy as npdef linear_regression(): # 1、准备数据 x = tf.random_normal(shape=[100, 1]) y_true = tf.matmul(x, [[0.8]]) + 1.2 ...原创 2019-10-12 14:07:54 · 587 阅读 · 0 评论 -
tensorflow实现线性回归
import tensorflow as tfimport numpy as np# 用数据集进行线性回归def linear_regression(): # 1、准备数据 path = r'C:\Users\Yuhao Sun\Desktop\Con-LSTM\Salary_Data.csv' dataset = np.loadtxt(path, skiprow...原创 2019-10-11 21:30:18 · 213 阅读 · 0 评论 -
Tensorflow2.0-数据流图
import tensorflow as tfdef tensorflow_demo(): # 构建图阶段: # 流程图:定义数据对象(张量Tensor)和要执行的操作(节点OP) g = tf.Graph() with g.as_default(): a_t = tf.constant(2) b_t = tf.constant...原创 2019-10-10 20:03:14 · 536 阅读 · 0 评论