对于进行光流项目,我有几个问题。我使用Python 2(计划使用千层面来进行深度学习来学习光流),并且不知道如何在流的可视化中将c ++函数转换为python的函数。
我从http://vision.middlebury.edu/flow/data/comp/zip/other-gt-flow.zip下载了一些图像对,这些图像对中我必须估算它们的光通量和地面真实流(.flo文件)。问题是,当我将.flo文件读入程序时,它是矢量化代码。如何查看它们,就像它们在网页(http://vision.middlebury.edu/flow/data/)中的显示方式一样?我从各种来源阅读并尝试了以下操作,但没有用。
在评估EPE(端点错误)时,我应该将我的预测与.flo文件进行比较吗?
代码:
################################ Reading flow file ################################
f = open('flow10.flo', 'rb')
x = np.fromfile(f, np.int32, count=1) # not sure what this gives
w = np.fromfile(f, np.int32, count=1) # width
h = np.fromfile(f, np.int32, count=1) # height
print 'x %d, w %d, h %d flo file' % (x, w, h)
data = np.fromfile(f, np.float32) # vector
data_2D = np.reshape(data, newshape=(388,584,2)); # convert to x,y - flow
x = data_2D[...,0]; y = data_2D[...,1];
################################ …Run Code Online (Sandbox Code Playgroud)