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).
110 stars 18 forks source link

AttributeError: 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm' #22

Closed nightfarrow closed 3 years ago

nightfarrow commented 3 years ago

Hi,

I switched it to try running off of a Stanford image, as per the Github instructions. I ended up with this error:

(smalifythis) s@s-To-be-filled-by-O-E-M:~/SMALify$ python smal_fitter/optimize_to_joints.py
** fvcore version of PathManager will be deprecated soon. **
** Please migrate to the version in iopath repo. **
https://github.com/facebookresearch/iopath 

Dataset size: 1
/home/s/SMALify/smal_fitter/priors/pose_prior_35.py:58: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at  /opt/conda/conda-bld/pytorch_1595629403081/work/torch/csrc/utils/tensor_numpy.cpp:141.)
  self.precs = torch.from_numpy(res['pic'].r).float().to(device)
EPOCH: Optimizing Stage: 0       Epoch: 0, Loss: 14132.33, Temporal: (0.0, 0.0, EPOCH: Optimizing Stage: 0   Epoch: 0, Loss: 14132.33, Temporal: (0.0, 0.0, EPOCH: Optimizing Stage: 0   Epoch: 0, Loss: 14132.33, Temporal: (0.0, 0.0, 0.0):
Traceback (most recent call last):
  File "smal_fitter/optimize_to_joints.py", line 147, in <module>
    main()
  File "smal_fitter/optimize_to_joints.py", line 140, in main
    model.generate_visualization(image_exporter)
  File "/home/s/SMALify/smal_fitter/smal_fitter.py", line 210, in generate_visualization
    rot_matrix = torch.from_numpy(R.from_euler('y', 180.0, degrees=True).as_dcm()).float().to(self.device)
AttributeError: 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm'

Do you have any ideas as to how to resolve this? Was really, really interested in this tool.

I'm running Ubuntu 18.

nightfarrow commented 3 years ago

Had wrong version of scipy

Solved by pip install scipy==1.5.2 , as specified in requirements.txt

ShaoshuSu commented 1 year ago

"as_dcm" is replaced with "as_matrix" in the later version, please check https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.from_matrix.html?highlight=from_dcm for more details