Hangz-nju-cuhk / Talking-Face-Generation-DAVS

Code for Talking Face Generation by Adversarially Disentangled Audio-Visual Representation (AAAI 2019)
MIT License
818 stars 173 forks source link

ValueError: expected 2D or 3D input (got 4D input) #21

Open oraculseed opened 5 years ago

oraculseed commented 5 years ago

Hi.

I run python test_all.py --test_root ./0572_0019_0003/audio --test_type audio --test_audio_video_length 99 --test_resume_path .\checkpoints\101_DAVS_checkpoint.pth.tar

and see error

Traceback (most recent call last): File "test_all.py", line 47, in model.test_train() File "E:\ml\face_animation\Talking-Face-Generation-DAVS\Test_Gen_Models\Test_Audio_Model.py", line 86, in test_train self.audio_embeddings = self.mfcc_encoder.forward(self.audios) File "C:\anaconda3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 121, in forward return self.module(*inputs[0], kwargs[0]) File "C:\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call result = self.forward(*input, *kwargs) File "E:\ml\face_animation\Talking-Face-Generation-DAVS\network\mfcc_networks.py", line 83, in forward net = self._forward(x0) File "E:\ml\face_animation\Talking-Face-Generation-DAVS\network\mfcc_networks.py", line 75, in _forward net2 = self.model2.forward(x) File "E:\ml\face_animation\Talking-Face-Generation-DAVS\network\mfcc_networks.py", line 56, in forward net = self.relu(self.bn1(net)) File "C:\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call result = self.forward(input, kwargs) File "C:\anaconda3\lib\site-packages\torch\nn\modules\batchnorm.py", line 52, in forward self._check_input_dim(input) File "C:\anaconda3\lib\site-packages\torch\nn\modules\batchnorm.py", line 156, in _check_input_dim .format(input.dim())) ValueError: expected 2D or 3D input (got 4D input)

What can be fixed here ?

XRSWATER commented 5 years ago

Same error here.

roodrallec commented 5 years ago

To solve this use the pytorch version mentioned (0.2.0)

XRSWATER commented 5 years ago

Hello, Pytorch1.0.0 can also solve this problem. Thank you for your reply.

------------------ 原始邮件 ------------------ 发件人: "JAlexander"notifications@github.com; 发送时间: 2019年5月14日(星期二) 晚上6:44 收件人: "Hangz-nju-cuhk/Talking-Face-Generation-DAVS"Talking-Face-Generation-DAVS@noreply.github.com; 抄送: "十二象"513221837@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [Hangz-nju-cuhk/Talking-Face-Generation-DAVS] ValueError:expected 2D or 3D input (got 4D input) (#21)

To solve this use the pytorch version mentioned (0.2.0)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

DongHwanJang commented 5 years ago

@XRSWATER tried Pytorch1.0.0 but didn't work... Because torch 0.2.0 does not support cuda > 9.0 having trouble to run the code. Do you have any alternative solution?

I changed BatchNorm1d to BatchNorm2d and error disappears. But 'missing keys in state_dict' warning occurs. Don't know this is proper way to do so

Hangz-nju-cuhk commented 5 years ago

Hi all, this is caused by a bug that I wrote which surprisingly did not affect the performance... @DongHwanJang I tried directly changing it in this way but the performance would be hurt.

AtaUllahB commented 5 years ago

Tried changing BatchNorm1d to BatchNorm2d and the error disappeared. But 'missing keys in state_dict' warning occurs and the fake images created are black.

im using Pytorch 0.2.0 And Cuda 10. On Google Colab

@Hangz-nju-cuhk Can you help please?

voa18105 commented 5 years ago

hi guys, so, how to overpass this issue? I've tried different versions of pytorch, but still have "ValueError: expected 2D or 3D input (got 4D input)"

yxt132 commented 4 years ago

no solution for this issue?

michaelbuddy commented 4 years ago

change self.bn1 = nn.BatchNorm1d(64) -> nn.BatchNorm2d(64) in mfcc_networks.py. and the issue fixed in my env.

love112358 commented 3 years ago

Who can have a better solution now? Can you provide the version of your requirements.txt? thanks