fyviezhao / M3D-VTON

Official code for ICCV2021 paper "M3D-VTON: A Monocular-to-3D Virtual Try-on Network"
167 stars 38 forks source link

RuntimeError error of Channels with Custom Test Data #23

Open kaijung opened 1 year ago

kaijung commented 1 year ago

I prepared my custom test data

  1. https://github.com/kaijung/M3D-VTON/blob/main/mpv3d_example/image/BAEL-K11%403%3Dperson_whole_front.png image P 320*512
  2. https://github.com/kaijung/M3D-VTON/blob/main/mpv3d_example/image-parse/BAEL-K11%403%3Dperson_whole_front_label.png 2D-Human-Paring on P;
  3. https://github.com/kaijung/M3D-VTON/blob/main/mpv3d_example/pose/BAEL-K11%403%3Dperson_whole_front_keypoints.json OpenPose (25 keypoints) on P;

and has ran the command

python util/data_preprocessing.py --MPV3D_root mpv3d_example 

with mpv3d_example/train_pairs.txt https://github.com/kaijung/M3D-VTON/blob/main/mpv3d_example/train_pairs.txt

and then ran the MTM command

python test.py --model MTM --name MTM --dataroot mpv3d_example --datalist test_pairs --results_dir results

and got RuntimeError

dataset [AlignedMPV3dDataset] was created
initialize network with normal
model [MTMModel] was created
loading the model from pretrained/aligned/MTM/latest_net_MTM.pth
---------- Networks initialized -------------
[Network MTM] Total number of parameters : 40.003 M
-----------------------------------------------
/usr/local/lib/python3.8/dist-packages/torch/nn/functional.py:4227: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  warnings.warn(
Traceback (most recent call last):
  File "test.py", line 63, in <module>
    model.test()            # run inference
  File "/content/M3D-VTON/models/base_model.py", line 110, in test
    self.forward()
  File "/content/M3D-VTON/models/MTM_model.py", line 151, in forward
    self.output = self.netMTM(self.agnostic, self.c)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/M3D-VTON/models/networks.py", line 768, in forward
    featureA = self.extractionA(inputA) # featureA: size (batch_size,512,32,20)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/M3D-VTON/models/networks.py", line 99, in forward
    return self.model(x)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 204, in forward
    input = module(input)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/conv.py", line 463, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [64, 29, 4, 4], expected input[1, 30, 512, 320] to have 29 channels, but got 30 channels instead
[ ]
yisunhan commented 1 year ago

I also encountered the same problem when inputting a custom image, have you solved it now?

输入人像错误

biancaszekely32 commented 7 months ago

I got the same error : image Has anyone found a solution for this ?

biancaszekely32 commented 7 months ago

@kaijung did you manage to find a solution for this ? Please can you help if you found it