zycliao/TailorNet_dataset

Visiualize the dataset: runtimeerror size mismatch

zzhangly opened this issue · 4 comments

When I try to visualize the dataset,such as skit_famale, t-shirt_famale, it got a runtimeError:
RuntimeError: size mismatch, m1: [100 x 300], m2: [10 x 82662] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:41;
And details are as follows:

root@ubuntu18.04:~/Documents/TailorNet/TailorNet_dataset-master# python visualize_dataset.py
Traceback (most recent call last):
File "visualize_dataset.py", line 53, in <module>
    all_body, all_gar = smpl(np.tile(beta[None], [n, 1]), thetas, unpose_v, garment_class, batch=True)
File "/root/Documents/TailorNet/TailorNet_dataset-master/smpl_torch.py", line 472, in __call__
    vbody, vcloth = self.base.forward(theta=theta[lp: rp], beta=beta[lp: rp], garment_d=garment_d[lp: rp], garment_class=garment_class)
File "/root/Documents/TailorNet/TailorNet_dataset-master/smpl_torch.py", line 185, in forward
    v_shaped = torch.matmul(beta, self.shapedirs).view(-1, self.size[0], self.size[1]) + self.v_template
RuntimeError: size mismatch, m1: [100 x 300], m2: [10 x 82662] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:41

my python --version is 3.5.10, and Versions of packages\dependencies are:

Package                       Version
----------------------------- ---------
alabaster                     0.7.12
Babel                         2.9.1
certifi                       2021.5.30
chardet                       4.0.0
chumpy                        0.70
cycler                        0.10.0
Cython                        0.29.24
docutils                      0.16
future                        0.18.2
idna                          2.10
imagesize                     1.2.0
Jinja2                        2.11.3
kiwisolver                    1.1.0
MarkupSafe                    1.1.1
matplotlib                    3.0.3
numpy                         1.18.5
opencv-python                 4.4.0.42
packaging                     20.9
Pillow                        7.2.0
pip                           20.3.4
psbody-mesh                   0.4
Pygments                      2.10.0
PyOpenGL                      3.1.5
pyparsing                     2.4.7
python-dateutil               2.8.2
pytz                          2021.1
PyYAML                        5.3.1
pyzmq                         20.0.0
requests                      2.25.1
scipy                         1.4.1
setuptools                    50.3.2
six                           1.16.0
snowballstemmer               2.1.0
Sphinx                        3.5.4
sphinx-bootstrap-theme        0.8.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
torch                         1.5.0+cpu
torchvision                   0.6.0+cpu
urllib3                       1.26.6
wheel                         0.37.0

I had changed the dataset(garment classes) follow document in readme.md, but it still got above error.
What`s wrong here? and how can I fix it?
Any help is appreciated!

Hi ranorzh. Could you try the latest commit and see if the problem still exists?

Hi ranorzh. Could you try the latest commit and see if the problem still exists?

I have already run the latest code(here), but the problem still exists

Could you add

    print(beta.shape)
    print(self.shapedirs.shape)
    print(self.num_betas)

after Line 185 (beta = beta[:, :self.num_betas])? Let me know the result.

Could you add

    print(beta.shape)
    print(self.shapedirs.shape)
    print(self.num_betas)

after Line 185 (beta = beta[:, :self.num_betas])? Let me know the result.

After checking the latest commit and correct, the problem has gone away and visiualized successfully dataset.
Thanks