SMALify icon indicating copy to clipboard operation
SMALify copied to clipboard

Error training with batch images

Open IIsoo opened this issue 2 years ago • 0 comments

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]```

IIsoo avatar Mar 24 '23 08:03 IIsoo