This directory contains code for optimising the SMAL/SMBLD model to provided 3D models.
It optimises shape, pose, scale to allow for the production of new shape & pose priors based on the set of animal models provided.
Currently, this only supports .obj files.
To avoid errors in initialisation, you may need to manually align your model so that it faces the same direction as the SMAL model. This alignment is with tail to head going in the positive x direction, and z denoting vertical height.
Two options to run an optimisation:
- Single stage. Pass args into optimise.py to start a single scheme of optimisation, for example:
python fitter_3d/optimise.py --mesh_dir example_meshes --scheme default --lr 1e-3 --nits 100
- For a more complicated (eg multi-stage) and fine tuned optimisation, add a custom .yaml file. See example_cfg.yaml for how it must be organised. This can then be called in optimise.py using:
python fitter_3d/optimise.py --mesh_dir example_meshes --yaml_src fitter_3d/example_cfg.yaml
Note: Any args provided in example_cfg.yaml will overwrite args provided at the command line.
Five optimisation schemes (defined in trainer.py/SMALParamGroup):
init
- Global rotation, global translationdefault
- Global rotation, global translation, shape parameters, joint rotationsshape
-default
without joint rotationspose
-default
without shape parametersdeform
- Vertex deformations only