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

File "/home/mona/anaconda3/lib/python3.7/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte #6

Closed monajalal closed 3 years ago

monajalal commented 3 years ago
(base) mona@mona:~/research/3danimals/SMALify$ python smal_fitter/optimize_to_joints.py

Bad key savefig.frameon in file /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle, line 421 ('savefig.frameon : True')
You probably need to get an updated matplotlibrc file from
https://github.com/matplotlib/matplotlib/blob/v3.3.2/matplotlibrc.template
or from the matplotlib source distribution

Bad key verbose.level in file /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle, line 472 ('verbose.level  : silent      # one of silent, helpful, debug, debug-annoying')
You probably need to get an updated matplotlibrc file from
https://github.com/matplotlib/matplotlib/blob/v3.3.2/matplotlibrc.template
or from the matplotlib source distribution

Bad key verbose.fileo in file /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle, line 473 ('verbose.fileo  : sys.stdout  # a log filename, sys.stdout or sys.stderr')
You probably need to get an updated matplotlibrc file from
https://github.com/matplotlib/matplotlib/blob/v3.3.2/matplotlibrc.template
or from the matplotlib source distribution
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The mathtext.fallback_to_cm rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: Support for setting the 'mathtext.fallback_to_cm' rcParam is deprecated since 3.3 and will be removed two minor releases later; use 'mathtext.fallback : 'cm' instead.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The validate_bool_maybe_none function was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The savefig.jpeg_quality rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The animation.avconv_path rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
In /home/mona/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: 
The animation.avconv_args rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:01<00:00,  9.41it/s]
Dataset size: 10
/home/mona/research/3danimals/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)
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 89, in main
    model = SMALFitter(device, data, config.WINDOW_SIZE, config.SHAPE_FAMILY, use_unity_prior)
  File "/home/mona/research/3danimals/SMALify/smal_fitter/smal_fitter.py", line 101, in __init__
    self.smal_model = SMAL(device, shape_family_id=shape_family)
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_torch.py", line 43, in __init__
    shape_family_id=shape_family_id)
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_basics.py", line 47, in get_smal_template
    model = load_model(model_name)
  File "/home/mona/research/3danimals/SMALify/smal_model/smpl_webuser/serialization.py", line 118, in load_model
    dd = ready_arguments(fname_or_dict)
  File "/home/mona/research/3danimals/SMALify/smal_model/smpl_webuser/serialization.py", line 82, in ready_arguments
    dd = pickle.load(open(fname_or_dict))
  File "/home/mona/anaconda3/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
monajalal commented 3 years ago
##import pickle as cPickle
import pickle

and

        ##dd = pickle.load(open(fname_or_dict, 'r'), encoding='latin-1')
        with open(fname_or_dict, 'rb') as f:
            u = pickle._Unpickler(f)
            u.encoding = 'latin1'
            dd = u.load()
benjiebob commented 3 years ago

I have come to the realization that requiring the smpl_webuser package is a bit cumbersome. It's written to target python2 which causes the cPickle & this unpickling error. I will work to remove this dependency.

benjiebob commented 3 years ago

I have now removed the dependency. I've handwritten the code to set v_template for different quadruped classes rather than running it through the SMPL code. I'd be super grateful if you wouldn't mind testing the new code. 👍