zhanglonghao1992 / One-Shot_Free-View_Neural_Talking_Head_Synthesis

Pytorch implementation of paper "One-Shot Free-View Neural Talking-Head Synthesis for Video Conferencing"
Other
764 stars 143 forks source link

Training Error #13

Open zhangyahu1 opened 2 years ago

zhangyahu1 commented 2 years ago

Thanks for sharing the code! I meet a problem when training the model:

Traceback (most recent call last): File "run.py", line 86, in train(config, generator, discriminator, kp_detector, he_estimator, opt.checkpoint, log_dir, dataset, opt.device_ids) File "/home/yzhang4/Motion/code/talking/train.py", line 53, in train losses_generator, generated = generator_full(x) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, kwargs) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(input, kwargs) File "/home/yzhang4/Motion/code/talking/modules/model.py", line 275, in forward generated = self.generator(x['source'], kp_source=kp_source, kp_driving=kp_driving) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, kwargs) File "/home/yzhang4/Motion/code/talking/modules/generator.py", line 85, in forward kp_source=kp_source) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, *kwargs) File "/home/yzhang4/Motion/code/talking/modules/dense_motion.py", line 97, in forward prediction = self.hourglass(input) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(input, kwargs) File "/home/yzhang4/Motion/code/talking/modules/util.py", line 319, in forward return self.decoder(self.encoder(x)) File "/home/yzhang4/anaconda3/envs/talking/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, **kwargs) File "/home/yzhang4/Motion/code/talking/modules/util.py", line 300, in forward out = torch.cat([out, skip], dim=1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 7 and 8 in dimension 3 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71

Running environment: Pytorch: 1.4 Python: 3.6

romanvey commented 2 years ago

resize images to 256, because originally the video in 224x224 is loaded. For example, in frames_dataset.py:

video_array = video_array[frame_idx]
video_array = [resize(frame, self.frame_shape[:2])[..., :3] for frame in video_array]
zhangyahu1 commented 2 years ago

@romanvey Thanks! I will try it.