提取不提取特征不重要,我的方法的出发点是将npy文件加工成tfrecord文件
加工成tfrecord文件
def _add_to_tfrecord(tfrecord_writer, split_name):
"""Loads images and writes files to a TFRecord.
Args:
image_dir: The image directory where the raw images are stored.
list_filename: The list file of images.
tfrecord_writer: The TFRecord writer to use for writing.
"""
a = np.load("ttt/test_temp.npy")
b = np.load("ttt/trainlabel.npy")
print(b)
with tf.Graph().as_default():
j = 0
with tf.Session('') as sess:
for line in range(a.shape[0]):
sys.stdout.write('\r>> Converting %s image %d/%d' % (split_name, j + 1, a.shape[0]))
sys.stdout.flush()
j += 1
label = int(b[line])
image_data=a[line]
image_data = np.reshape(image_data, [1024]).tostring()
# print(image_data