Coder Social home page Coder Social logo

benjiebob / smalify Goto Github PK

View Code? Open in Web Editor NEW
110.0 110.0 18.0 25.85 MB

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).

Python 99.29% PowerShell 0.71%

smalify's People

Contributors

benjiebob avatar ollieboyne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

smalify's Issues

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

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.

Error training with batch images

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

Missing testing files

Hi, Thanks for open-sourcing the project. When I run python optimize_to_joints.py, I got an error about missing files: BADJA/extra_videos/rs_dog/*, could you please upload the files? Thanks.

Pytorch3D error on running optimize_to_joints.py

Hey, I am facing the following error while running optimize_to_joints.py. I have followed all the instructions exactly as described but I am still facing this issue. Kindly help out.

100% 1/1 [00:00<00:00, 4.07it/s] Dataset size: 1 0% 0/150 [00:00<?, ?it/s] Traceback (most recent call last): File "smal_fitter/optimize_to_joints.py", line 149, in <module> main() File "smal_fitter/optimize_to_joints.py", line 123, in main loss, losses = model(batch_range, opt_weight, stage_id) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/content/drive/MyDrive/Jio/SMALify/smal_fitter/smal_fitter.py", line 134, in forward rendered_silhouettes, rendered_joints = self.renderer( File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/content/drive/MyDrive/Jio/SMALify/smal_fitter/p3d_renderer.py", line 68, in forward proj_points = self.cameras.transform_points_screen(points, screen_size)[:, :, [1, 0]] File "/usr/local/lib/python3.8/dist-packages/pytorch3d/renderer/cameras.py", line 353, in transform_points_screen points_ndc = self.transform_points_ndc(points, eps=eps, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytorch3d/renderer/cameras.py", line 323, in transform_points_ndc return world_to_ndc_transform.transform_points(points, eps=eps) File "/usr/local/lib/python3.8/dist-packages/pytorch3d/transforms/transform3d.py", line 400, in transform_points points_out = points_out[..., :3] / denom RuntimeError: The size of tensor a (3) must match the size of tensor b (2) at non-singleton dimension 2

having an issue on windows with the smal fitter

I was trying to run the smal fitter on windows and I get this error from pickle.py

Traceback (most recent call last):
File "smal_fitter/optimize_to_joints.py", line 147, in
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 "C:\Users\Owner\Documents\GitHub\SMALify\smal_fitter\smal_fitter.py", line 46, in init
smal_data = u.load()
File "E:\Program Files\Python37\lib\pickle.py", line 1085, in load
dispatchkey[0]
File "E:\Program Files\Python37\lib\pickle.py", line 1209, in load_string
raise UnpicklingError("the STRING opcode argument must be quoted")
_pickle.UnpicklingError: the STRING opcode argument must be quoted

this is the error I am getting

fine-tune 3D smal fiting

Hi, @benjiebob ,thanks for your sharing.
I have tried to utilize the project to get a fine-tune smal parameters for a specific cat with a cat .obj file.
And the smal results as followed.
1.family_0.obj fine-turn to family 0 smal base model stage 0 result
00781_family_0 - Stage0

2.family_0.obj fine-turn to family 0 smal base model stage 2 result
00781_family_0 - Stage2

3.family_4.obj fine-turn to family 0 smal base model stage 0 result

00781_family_4 - Stage0

4.family_4.obj fine-turn to family 0 smal base model stage 2 result
00781_family_4 - Stage2

Seems that it can work better for cross species other in the same species with minor difference.
Any suggestion for a better inner-species fine-turn result?
We may Take the family_0.obj exported from data_000781_4_all.pkl as a benchmark.

Configaration for the result above:
My training config use the fitter_3d/example_cfg.yaml (family_id=0) and my input .obj was exported from my_smpl_data_00781_4_all.pkl.

python version

Dear @benjiebob ,
Could you please give me more details about the versions of you dependencies, such as python, torch, ...etc.
I use python 3.6 and torch1.6, which leads to the encoding error. when I load the smalst models
return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

Please help me.
Thanks

Issue with pkl files loads on Linux

Dear @benjiebob , my os is Ubuntu 18.04, when I run python scripts
--python smal_fitter/optimize_to_joints.py
I get error:_pickle.UnpicklingError: the STRING opcode argument must be quoted, I searched and got that those pkl files belong to Windows. I wonder if I should change the pkl files or I can run on the Windows.
Please help me
Thanks

joint rotations from checkpoint pickle

Hi,
I'm trying to import the 3D joints from the final checkpoint pickle in a 3D scene.

How are the joints ordered in the pickle file joint_rotations? do they follow some of the settings in config.py?
And are the joint_rotations in local or world space?
I attached a screenshot of the unpacked pickle file as reference.

Thanks for your time!

wsl_aDlTFlA4Fv

Neural mesh renderer installation problems using Windows

With thanks to Sinéad Kearney

In rasterize_cuda_kernel.cu, the section inside:

#if CUDA_ARCH < 600 and defined(CUDA_ARCH)
...

I had to replace with (on Windows with CUDA 10):

#if !defined(CUDA_ARCH) || CUDA_ARCH >= 600
#else
static inline device double atomicAdd(double address, double val) {
unsigned long long int
address_as_ull = (unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
if (val==0.0)
return __longlong_as_double(old);
do {
assumed = old;
old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed)));
} while (assumed != old);
return __longlong_as_double(old);
}
#endif

fit the smal parameters to 3d model obj

Hi, for testing the fitter_3d module, I just put the smal_mean_shape.obj that generated from the smal project in the mesh_dir, and run the script python fitter_3d/optimise.py --mesh_dir fitter_3d_data/mesh/ --scheme default --lr 1e-3 --nits 100, below is the result.
it's strange that the result is not as well as I think, although the input 3d model target is the smal model itself.
image

badja_extra_videos.zip doesn't seem to exist anymore

It appears that badja_extra_videos.zip doesn't seem to exist anymore.

I tried running wget http://mi.eng.cam.ac.uk/~bjb56/datasets/badja_extra_videos.zip and got connection timed out.

Manually visiting http://mi.eng.cam.ac.uk/~bjb56/datasets/badja_extra_videos.zip just loads forever.

is there a working mirror of these videos? also, is it necessary to use these particular videos, or can any animal videos like from YouTube be used? (Newbie here)

How do you make your own images work?

What is the process to convert your own images to a 3D mesh?

I got the demo working on the sample Stanford images, but when I try to run it on my own images I get errors.

For instance, I took this image . . . https://www.warrenphotographic.co.uk/photography/bigs/02679-Dog-jumping-white-background.jpg . . . and saved it as dogjump.jpeg in /home/s/SMALify/data/StanfordExtra/sample_imgs/n02099601-golden_retriever

then I changed config.py line from #SEQUENCE_OR_IMAGE_NAME = "stanfordextra:n02099601-golden_retriever/n02099601_176.jpg" to SEQUENCE_OR_IMAGE_NAME = "stanfordextra:n02099601-golden_retriever/dogjump.jpeg"

but when I run python smal_fitter/optimize_to_joints.py I get:


(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 

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 73, in main
    config.CROP_SIZE
  File "/home/s/SMALify/smal_fitter/data_loader.py", line 111, in load_stanford_sequence
    loaded_data = get_dog(image_name)
  File "/home/s/SMALify/smal_fitter/data_loader.py", line 97, in get_dog
    data = json_dict[name]
KeyError: 'n02099601-golden_retriever/dogjump.jpeg'

Is there a way to explain more the steps on how to prepare a custom image for the SMALify tool?

Also, do gifs work?

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

(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

Issue with Pytorch3D on Windows

If you are having problems installing PyTorch3D on Windows with PyTorch 1.6, try the following fixes:

  1. In file venv/Lib/site-packages/torch/include/pybind11/cast.h, change:

    • (l1449) explicit operator type&() { return*(this->value); }
    • to explicit operator type&() { return *((type*)this->value); }
  2. In file venv\Lib\site-packages\torch\include\torch\csrc\jit\runtime, change

    • (l160) static constexpr size_t DEPTH_LIMIT = 128;
    • to static const size_t DEPTH_LIMIT = 128;
  3. In file venv\Lib\site-packages\torch\include\torch\csrc\jit\api, change:

    • all instances of CONSTEXPR_EXCEPT_WIN_CUDA
    • to const

Python 3.7 cPickle

For running the code in Anaconda Python 3.7,

##import cPickle as pickle
import pickle as cPickle

in the following file:
(base) mona@mona:~/research/3danimals/SMALify$ vi /home/mona/research/3danimals/SMALify/smal_model/smpl_webuser/serialization.py

Otherwise, you will get this error:

(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.
Traceback (most recent call last):
  File "smal_fitter/optimize_to_joints.py", line 10, in <module>
    from smal_fitter import SMALFitter
  File "/home/mona/research/3danimals/SMALify/smal_fitter/smal_fitter.py", line 19, in <module>
    from smal_model.smal_torch import SMAL
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_torch.py", line 15, in <module>
    from .smal_basics import align_smal_template_to_symmetry_axis, get_smal_template
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_basics.py", line 4, in <module>
    from smal_model.smpl_webuser.serialization import load_model
  File "/home/mona/research/3danimals/SMALify/smal_model/smpl_webuser/serialization.py", line 26, in <module>
    import cPickle as pickle
ModuleNotFoundError: No module named 'cPickle'

conda create environment with requirements.txt error

Hi!
I'm experiencing some issues creating the environment using miniconda on Linux using the requirements.txt file.
The installed Miniconda version is conda 4.9.2 on Ubuntu 18.04.4 LTS.

I've not much experience with Anaconda and Linux so I'm not sure if I'm missing anything.

The error I'm getting when running the command conda create --name env_smalify --file requirements.txt is:

Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - packaging==20.4=pypi_0
  - termcolor==1.1.0=pypi_0
  - dataclasses==0.6=pypi_0
  - pyyaml==5.3.1=pypi_0
  - cython==0.29.21=pypi_0
  - gcc-7==7.1.0=0
  - pytorch==1.6.0=py3.8_cuda10.1.243_cudnn7.6.3_0
  - opencv-contrib-python==4.4.0.44=pypi_0
  - kiwisolver==1.2.0=pypi_0
  - cycler==0.10.0=pypi_0
  - nibabel==3.1.1=pypi_0
  - tqdm==4.50.0=pypi_0
  - tabulate==0.8.7=pypi_0
  - matplotlib==3.3.2=pypi_0
  - torchvision==0.7.0=py38_cu101
  - portalocker==2.0.0=pypi_0
  - imageio==2.9.0=pypi_0
  - pyparsing==2.4.7=pypi_0
  - python-dateutil==2.8.1=pypi_0
  - yacs==0.1.8=pypi_0
  - chumpy==0.70=pypi_0
  - fvcore==0.1.2.post20200929=pypi_0
  - future==0.18.2=pypi_0
  - scipy==1.5.2=pypi_0
  - torchgeometry==0.1.2=pypi_0
  - trimesh==3.8.10=pypi_0
  - pytorch3d==0.2.5=pypi_0
  - pycocotools==2.0=pypi_0

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/pypi/linux-64
  - https://conda.anaconda.org/pypi/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

subtle confusion on what needs to be downloaded from SMPL website

Hi Benjamin,

Awesome code repo and great documentation so far.

However, since there is a bunch of downloadable things from SMPL website, would be best to add what needs to be downloaded.

Also, I guess smal folder inside data was missing in the repo (I did mkdir smal -- telling it since I saw you had folder for other things).

smpl_download

For example,

Is this the correct structure?
tree_smalify

File "/home/mona/research/3danimals/SMALify/smal_fitter/smal_fitter.py", line 198, in load_checkpoint with open(param_file, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/20200930-121001/0000/st10_ep0.pkl'

(base) mona@mona:~/research/3danimals/SMALify$ python smal_fitter/generate_video.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.36it/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/generate_video.py", line 74, in <module>
    main()
  File "smal_fitter/generate_video.py", line 70, in main
    model.load_checkpoint(os.path.join("checkpoints", config.CHECKPOINT_NAME), config.EPOCH_NAME)
  File "/home/mona/research/3danimals/SMALify/smal_fitter/smal_fitter.py", line 198, in load_checkpoint
    with open(param_file, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'checkpoints/20200930-121001/0000/st10_ep0.pkl'

I have:

(base) mona@mona:~/research/3danimals/SMALify/checkpoints$ ls
total 40K
drwxrwxr-x 12 mona mona 4.0K Oct  1 01:37 20201001-013732
drwxrwxr-x 12 mona mona 4.0K Oct  1 01:57 20201001-015736
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:22 20201001-022234
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:30 20201001-023027
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:32 20201001-023227
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:33 20201001-023328
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:35 20201001-023459
drwxrwxr-x 10 mona mona 4.0K Oct  1 02:50 .
drwxrwxr-x 12 mona mona 4.0K Oct  1 02:50 20201001-025010
drwxrwxr-x 11 mona mona 4.0K Oct  1 03:04 ..

I am using this version of the code:

(base) mona@mona:~/research/3danimals/SMALify/checkpoints$ git log -1
commit 01b56564a62b3b85df64a3168755c9878865e0bf (HEAD -> master, origin/master, origin/HEAD)
Author: Benjamin Biggs <[email protected]>
Date:   Wed Sep 30 18:23:51 2020 +0100

    Update README.md

Synthetic segmentations

Good afternoon,

I wanted to ask about the CGAL paper. Do I understand correctly that you generate the silhouettes synthetically by random sampling? Do you somehow generate it by sampling from the prior distribution for dogs specifically? Or is it completely random? Do you have a code for the generation of those silhouettes, or the resulting silhouettes?

Best regards,
Valeria

Issue with SMAL data files under Windows OS

If you are a Windows user, you can use the SMALST/smpl_models/* files but you'll need to edit the line endings for compatibility reasons. Try the following Powershell commands, shown here on one example:

$path="my_smpl_00781_4_all_template_w_tex_uv_001.pkl"
(Get-Content $path -Raw).Replace("`r`n","`n") | Set-Content $path -Force

non-issue question: Is this a correct result?

Hi,
I ran the python smal_fitter/optimize_to_joints.py on the Stanford image.
The result I got was:
(st10_ep0.ply previewed in online ply viewer)
I'm just wondering, is this the correct result? The legs are kind of stuck together, which is visually a bit strange.
It's incredible software for what it is, but I just want to verify that this is how the result is supposed to look? Thanks!!

For another animal species

Hi Ben,

Thanks a lot for your great work. I would like to know what should I do if I want to use SMALify to another species(like horse). I see the SHAPE_FAMILY in config.py. I wonder anything else should I do?

How to SMALify another animal's 3D model?

Hi Ben,

Thanks a lot for your great research work.
I had a couple of questions that would be great if I could get some instructions on them.

  1. I have this 3D squirrel model that I am interested in inputting to SMALify. How can I do that?
    https://www.turbosquid.com/3d-models/squirrel-3d-model-1372687
  2. I know in our discussion you wanted the animal to be rigged, but what if the animal is not fully rigged and only partially rigged? Many of the available models in 3D model Websites are generally just partially animable/rigged (e.g. they can perform only 3-10 actions).
  3. Why would I need 10-15 different 3D models of a squirrel if I am interested in modeling and SMALifying a squirrel?
  4. The model of squirrel I shared is quite expensive, high-poly, and detailed. What is the level-of-detail (LOD) and number of poly required for a model to be SMALifiable?
  5. If I am trying to SMALify an animal, does it matter if the 3D model has skin/fur/texture or not? I am noticing some 3D models on 3D websites only have mesh and some have such details as in 1 like fur and texture.

Could the new smal model obtained by running optimise.py use to SMALST?

hey,@benjiebob
Thanks a lot for your great work. I would like to build my new SMAL model such as pig. And I have ran optimise.py and got the SMAL model. But the paraments of new SMAL model we got is not similar to original SMAL model my_smpl_00781_4_all.pkl. What I should do if I want to visulize the model with betas and pose by hello_smpl.py?

from posemapper import posemap ModuleNotFoundError: No module named 'posemapper'

(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.
Traceback (most recent call last):
  File "smal_fitter/optimize_to_joints.py", line 10, in <module>
    from smal_fitter import SMALFitter
  File "/home/mona/research/3danimals/SMALify/smal_fitter/smal_fitter.py", line 19, in <module>
    from smal_model.smal_torch import SMAL
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_torch.py", line 15, in <module>
    from .smal_basics import align_smal_template_to_symmetry_axis, get_smal_template
  File "/home/mona/research/3danimals/SMALify/smal_model/smal_basics.py", line 4, in <module>
    from smal_model.smpl_webuser.serialization import load_model
  File "/home/mona/research/3danimals/SMALify/smal_model/smpl_webuser/serialization.py", line 30, in <module>
    from posemapper import posemap
ModuleNotFoundError: No module named 'posemapper'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.