action_recognition icon indicating copy to clipboard operation
action_recognition copied to clipboard

RuntimeError: stack expects a non-empty TensorList

Open wenjun90 opened this issue 4 years ago • 4 comments
trafficstars

Hi @tcapelle Thank you for your great job. Could I ask you a question, please?

I try training with 2 class and have an error like that. How can we fix this error?

** in forward(self, x) 35 def forward(self, x): 36 if self.debug: print(f' input len: {len(x), x[0].shape}') ---> 37 x = torch.stack(x, dim=1) 38 if self.debug: print(f' after stack: {x.shape}') 39 batch_size, seq_length, c, h, w = x.shape

RuntimeError: stack expects a non-empty TensorList**

Thank you very much!

wenjun90 avatar Jul 31 '21 08:07 wenjun90

Your batch has zero images, check with ''' dls.one_batch() ''' And inspect dimensions.

The problem rises because your list of images is empty, so it cannot stack them together as a image sequence.

On Sat, Jul 31, 2021, 11:02 AM wenjun90 @.***> wrote:

Reopened #26 https://github.com/tcapelle/action_recognition/issues/26.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tcapelle/action_recognition/issues/26#event-5094181798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMWOALU2CGLBW2CRHPRAPLT2O32TANCNFSM5BJZSVVQ .

tcapelle avatar Jul 31 '21 09:07 tcapelle

Thank @tcapelle for your response,

One more question. How can you predict a file .avi as well as the own test set and how can get f1-score and AUC.

Thank you very much!

wenjun90 avatar Jul 31 '21 10:07 wenjun90

That's more than one question 😜, The actual code expects individual frames, so you need to process them. Metrics can be found on sklearn and use the fastai wrapper, so you can pass them to the learner.

On Sat, Jul 31, 2021, 12:46 PM wenjun90 @.***> wrote:

Thank @tcapelle https://github.com/tcapelle for your response,

One more question. How can you predict a file .avi as well as the own test set and how can get f1-score and AUC.

Thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tcapelle/action_recognition/issues/26#issuecomment-890328756, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMWOAOH5H5HP6GINQ5TEQLT2PIA7ANCNFSM5BJZSVVQ .

tcapelle avatar Jul 31 '21 11:07 tcapelle

Thanks @tcapelle So, process with like that: with file .avi --> processing --> sequence image --> input predict --> predict?

wenjun90 avatar Jul 31 '21 11:07 wenjun90