Open-Debin / Emotion-FAN

ICIP 2019: Frame Attention Networks for Facial Expression Recognition in Videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Size of tensors doesn't match in CK+

EternalImmortal opened this issue · comments

When I run the model on CK+, I get the following error

Epoch: [0][0/13] Time 13.575 (13.575) Data 0.000 (0.000) Loss 1.9647 (1.9647) Prec@1 10.417 (10.417) *Prec@Video 15.152 *Prec@Frame 12.179 Traceback (most recent call last): File "Demo_AFEW_Attention.py", line 245, in <module> main() File "Demo_AFEW_Attention.py", line 90, in main prec1 = validate(val_loader, model) File "Demo_AFEW_Attention.py", line 233, in validate pred_score = model(vectors=output_store_fc, vm=weightmean_sourcefc, alphas_from1=output_alpha, File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 155, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 165, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 85, in parallel_apply output.reraise() File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) RuntimeError: Caught RuntimeError in replica 0 on device 0. Original Traceback (most recent call last): File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 60, in _worker output = module(*input, **kwargs) File "/home/renjie/miniconda3/envs/dl/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/home/renjie/code/Emotion-FAN/Code/Model.py", line 226, in forward vs_cate = torch.cat([vectors, vms], dim=1) RuntimeError: Sizes of tensors must match except in dimension 0. Got 672 and 224 (The offending index is 0)

Is there any preprocessing needed before train on CK+?

@EternalImmortal Notice the RuntimeError: Sizes of tensors must match except in dimension 0. Got 672 and 224.
It seems that vms is 672 * size', and vectors is 224 * size'.

@EternalImmortal Notice the RuntimeError: Sizes of tensors must match except in dimension 0. Got 672 and 224.

It seems that vms is 672 * size', and vectors is 224 * size'.

I know the error is vms and vectors have different size in dim 0, but I don't know why it happens and how to deal that.

@EternalImmortal
Merry Christmas! I recently update the Emotion-FAN, new features include data process, environment install, CK+ code, and Baseline code. Also, you can find the old version directory of Emotion-FAN in the README.md. I hope my new updates can help you greatly. Please see the Emotion-FAN for more details.