我创建了一个文件名队列,文件是*.pfm文件。我编写了一个转换函数readPFM()
,将*.pfm文件转换为ndarray。在
我想做的是,当一个文件从队列中出列时,我将使用函数将其转换为numpy ndarray。然后它将被输入到图表中。但代码不起作用。在
def disparity(batch_size, path, LR, epochs=2):
filenames = file_name(path, LR, 'pfm')
filenames = sorted(filenames)
filename_queue = tf.train.string_input_producer(filenames, shuffle=False, num_epochs=epochs)
reader = tf.WholeFileReader()
key, img_bytes = reader.read(filename_queue)
disparity, _ = readPFM(img_bytes)
return tf.train.batch([disparity], batch_size, dynamic_pad=True)
pfm文件read func在这里。在
^{pr2}$错误消息显示我的函数不能处理张量,因为它只能处理*.pfm文件。在
有什么解决办法吗?在
不能像tensorflow那样使用
readPFM
函数,需要用tf.py_func
来包装它。在相关问题 更多 >
编程相关推荐