kracwarlock / action-recognition-visual-attention

Action recognition using soft attention based deep recurrent neural networks

Home Page:http://www.cs.toronto.edu/~shikhar/projects/action-recognition-attention

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get the h5 features file

Yidann opened this issue · comments

commented

Hello ,after extracting the features in Matrix form, I tried to convert it to HDF5 file by Matlab.
But I don't know whether did I get the right format.
Does this look right?

dataspace = H5S.create_simple( frames,[7 7 1024],{'H5S_UNLIMITED' 'H5S_UNLIMITED'} );
fid = H5F.create('train_features.h5','H5F_ACC_TRUNC', 'H5P_DEFAULT', 'H5P_DEFAULT');
dataset = H5D.create( fid,'features',H5T_IEEE_F32LE,dataspace);

which frames is read from the train_framenum.txt
Or would you plz add some files about how to get the features file? THANK YOU!

Hi @Yidann
When you have your features in the variable frame, just use

save('features.mat','frames','-v7.3');

to save the features to a file.
The v7.3 mat files are HDF5 files internally. You can verify this by doing

$ h5dump -H features.mat

on the linux console.

Let me know if you have any issues :)

commented

@kracwarlock Thanks for your answer. Did I need to put all videos' features into one Matrix and then save it into one file,just like
save('train_features.h5','features','-v7.3')
and the features is a matrix in (7,7,1024), should I resize it?

Yes. According to my data handler the data needs to be of dimension (#frames, 7_7_1024) so you should resize all the (7,7,1024) 3D matrices to vectors of length 7_7_1024 and then store these in a 2D matrix (#frames, 7_7_1024).