日期:2020.03.17
资料:《深度学习之Tensorflow工程化项目实战》
章节:第四章
代码分析:
**·**实例4.1:
line17: yield train_X, train_Y
分析:yield的加入使得函数与类变为可迭代的对象
**·**实例4.3:
line23:filename_path = os.sep.join([dirpath, filename])
分析:os.sep.join(),相较于os.path.join(),不仅实现了路径的拼接,还解决了windows和ubuntu下不同路径分隔符读取的问题,增强代码的兼容性
line89: coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess = sess,coord = coord)
分析:tf中sess的多线程队列的开启
line48:image_batch,label_batch = tf.train.batch([image,label],
batch_size = batch_size,
num_threads = 64)
分析:调用tf.train.batch函数生成批次数据,在搭建网络中可以使用