tensorflow(3)— 常用命令汇总(打印、Pb保存等)
1、打印tfrecord,查看样本数据类型
import tensorflow as tf import os import glob count=0 path1='/Users/wangruojing/mt_project/mix_rerank/inputs/part-r-00002' for example in tf.python_io.tf_record_iterator(path1): a = tf.train.Example.FromString(example) count += 1 print(a) #print(a["total_price"]) if count>1: break
2、报错:DataLossError: corrupted record at 0
- 报错:tensorflow.python.framework.errors_impl.DataLossError: corrupted record at 0
- 解决方式:ls -al,删除文件下的掩藏文件即可
3、查看输入输出是否正确
tf模型保存为 pb 后,验证输入输出是否正确
saved_model_cli show --all --dir ./outputs/intelli_1009_1