上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 29 下一页
摘要: 参数过多会导致模型过于复杂而出现过拟合现象,通过在loss函数添加关于参数个数的代价变量,限制参数个数,来达到减小过拟合的目的 以下是loss公式: 代码多了一个kernel_regularizer参数 import tensorflow as tf def preporocess(x,y): x 阅读全文
posted @ 2020-09-19 21:30 山…隹 阅读(685) 评论(1) 推荐(0) 编辑
摘要: import tensorflow as tf def preprocess(x, y): x = tf.cast(x, dtype=tf.float32) / 255 - 0.5 y = tf.cast(y, dtype=tf.int32) return x, y batchsz = 128 # 阅读全文
posted @ 2020-09-19 19:28 山…隹 阅读(823) 评论(0) 推荐(0) 编辑
摘要: 这里有三种方式保存模型: 第a56爆大奖在线娱乐: 只保存网络参数,适合自己了解网络结构 第二种: 保存整个网络,可以完美进行恢复 第三个是保存格式。 第a56爆大奖在线娱乐方式: 实践操作: 第二种方式:(存入整个模型) 第三种方式:(存成工业模型) import tensorflow as tf save_path = 'sa 阅读全文
posted @ 2020-09-14 22:35 山…隹 阅读(2968) 评论(0) 推荐(0) 编辑
摘要: keras.Sequential(build和summary是在网络构造前就观察网络参数): 阅读全文
posted @ 2020-09-14 20:58 山…隹 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 注意: 1. 图片代码中的network变量在后面的代码展示中是model变量 2. 该列子中db中的y是one_hot编码后的 原代码(一个step中的一个batch): 接口替换后: 原来的for循环a56爆大奖在线娱乐step与batch: 接口替换后: 此处还没有设置测试的周期(比如前面的step %100 阅读全文
posted @ 2020-09-14 18:09 山…隹 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 1. 创建meter 2. 添加数据 3. 展示结果 4. 清除meter 以下代码是在前面随笔中代码的基础上添加的meter相关操作: import tensorflow as tf import datetime def preporocess(x,y): x = tf.cast(x,dtype 阅读全文
posted @ 2020-09-13 15:12 山…隹 阅读(1038) 评论(0) 推荐(0) 编辑
摘要: 实时的显示相关数据的图 import tensorflow as tf import datetime def preporocess(x,y): x = tf.cast(x,dtype=tf.float32) / 255 x = tf.reshape(x,(-1,28 *28)) # 铺平 x = 阅读全文
posted @ 2020-08-20 18:04 山…隹 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 进入项目路径 输入“ tensorboard --logdir 文件夹名 ” 监听该文件夹 代码中编写将数据写入本地: 1. 标量数据写入: 2. 图片数据写入: 结果展示: 多张图片显示(直接传入多张图片): 多张图片(将多张图片转化为1张图片)数据写入: 结果展示: import tensorf 阅读全文
posted @ 2020-08-20 17:47 山…隹 阅读(1870) 评论(0) 推荐(1) 编辑
摘要: import tensorflow as tf def preporocess(x,y): x = tf.cast(x,dtype=tf.float32) / 255 x = tf.reshape(x,(-1,28 *28)) # 铺平 x = tf.squeeze(x,axis=0) # prin 阅读全文
posted @ 2020-08-16 18:45 山…隹 阅读(621) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf a = tf.losses.categorical_crossentropy([0,1,0,0],[0.25,0.25,0.25,0.25],from_logits=True) # 前一个参数为标记值,后一个参数为预测值,最后一个参数设为True,输出 阅读全文
posted @ 2020-08-16 11:20 山…隹 阅读(351) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 29 下一页