def read_feature(filename):
"""Read feature dump by C3D
Parameters
----------
filename : str
Fullpath of file to read
Outputs
-------
x : ndarray
numpy array of features
Note: It accomplishes the same purpose of this code:
C3D/examples/c3d_feature_extraction/script/read_binary_blob.m
"""
s_parr, d_parr = array.array('i'), array.array('f')
with open(filename, 'r') as f:
s_parr.fromfile(f, 5)
s = np.array(s_parr)
m = np.cumprod(s)[-1]
d_parr.fromfile(f, m)
return s, np.array(d_parr)
评论列表
文章目录