facebookresearch/TimeSformer

Pre-trained model output prediction different from testing output prediction

chrisdt1998 opened this issue · 1 comments

Hi,

I trained a model on CREMA-D dataset and got 81% testing accuracy. However, when I load my model and pass one of the testing videos through it, it gives the wrong prediction even though I know, by using the func "topks_correct" from metrics, that the model correctly predicted this video during testing.

I have 6 labels of numbers from 0 to 5. From what I understand, the output of the model is a tensor which gives the prediction of video in order of the label? In other words, pred[0] is the predicted value of the video with label 0? Or is this not the case?

Thanks in advance.

EDIT:
I found that the issue is because the input torch to the model is wrong. How does the TimeSformer model convert the videos into tensors?

EDIT 2:
My data is in the shape T H W C so I used permute like in the kinetics.py file and got the shape C T H W and then I use unsqueeze to get it into the shape (batch x channels x frames x height x width) (with batch=1). This still doesn't give the correct output.

Answered my own question - basically I had to process the data using the kinematics.py file. Then it is in the correct format to be used in the model.