benjiebob / SMALify

This repository contains an implementation for performing 3D animal (quadruped) reconstruction from a monocular image or video. The system adapts the pose (limb positions) and shape (animal type/height/weight) parameters for the SMAL deformable quadruped model, as well as camera parameters until the projected SMAL model aligns with 2D keypoints and silhouette segmentations extracted from the input frame(s).
106 stars 18 forks source link

Error training with batch images #32

Open IIsoo opened 1 year ago

IIsoo commented 1 year ago

Hello@benjiebob, I got the following error when using your model for batch training, can you tell me how to fix it.The data I input is a four-dimensional tensor(7 3 256 * 256) with a total of 7 sheets


  0%|          | 0/300 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/meanpeng/Code/SMALify/smal_fitter/optimize_to_joints.py", line 148, in <module>
    main()
  File "/home/meanpeng/Code/SMALify/smal_fitter/optimize_to_joints.py", line 122, in main
    loss, losses = model(batch_range, opt_weight, stage_id)
  File "/home/meanpeng/anaconda3/envs/SMALify/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/meanpeng/Code/SMALify/smal_fitter/smal_fitter.py", line 134, in forward
    rendered_silhouettes, rendered_joints = self.renderer(
  File "/home/meanpeng/anaconda3/envs/SMALify/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/meanpeng/Code/SMALify/smal_fitter/p3d_renderer.py", line 68, in forward
    proj_points = self.cameras.transform_points_screen(points, image_size=screen_size)[:, :, [1, 0]]
  File "/home/meanpeng/anaconda3/envs/SMALify/lib/python3.8/site-packages/pytorch3d/renderer/cameras.py", line 355, in transform_points_screen
    return get_ndc_to_screen_transform(
  File "/home/meanpeng/anaconda3/envs/SMALify/lib/python3.8/site-packages/pytorch3d/renderer/cameras.py", line 1793, in get_ndc_to_screen_transform
    K[:, 0, 0] = scale
RuntimeError: The expanded size of the tensor (1) must match the existing size (7) at non-singleton dimension 0.  Target sizes: [1].  Tensor sizes: [7]```