Skip to content

v0.7.0 — one scale rule, NaN for failed elements, online smoothing

Latest

Choose a tag to compare

@isarandi isarandi released this 04 Nov 16:21

Behavior changes: results change, check your code if you use a scale

  • One rule for scale, in all backends. In fit, fit_with_known_pose and fit_with_known_shape, the returned trans belongs to BM(pose, betas, trans), and scale_corr scales about the world origin:
    • scale_fit: scale_corr * BM(pose, betas, trans) ≈ target
    • scale_target: BM(pose, betas, trans) ≈ scale_corr * target
  • What this changes:
    • trans of fit(scale_fit): up to about 16 mm.
    • trans of fit_with_known_shape(scale_fit) and of fit_with_known_pose in both scale modes: much more, hundreds of mm in tests.
    • vertices and joints returned by the NumPy fit: they now equal BM(...) with the returned values. Before, they were model output plus the mean of the target, in every mode. In the scale modes that matched neither rule, so they change there; without a scale they differ only by rounding.
    • Results without a scale are unchanged by this rule.
  • A failed element gives NaN. If an element fails, through non-finite input or a singular solve (for example all weights zero with a zero regularizer), it gives NaN in all its results, in all backends. The others are not affected. Before, NumPy and PyTorch raised an error for the whole batch, and Numba raised for non-finite input and returned finite values for zero weights. With share_beta, one failed element gives NaN for the whole batch.
  • TensorFlow allow_nan now defaults to True. Failed fits show NaN instead of zeros; allow_nan=False keeps the zeros.
  • All backends use the more accurate fit variant, evaluated against synthetic ground truth, so fit results change slightly:
    • The first rotation estimate uses regressed joints. Mean vertex error drops by 0.003–0.02 mm with 3 iterations and by 0.3–2 mm with 1 iteration on noisy targets. On clean targets with 1 iteration it is 1.1 mm worse.
    • The final adjustment ignores weights, which removes an added error of 0.02–0.7 mm.
  • NumPy centers the shape solve with the weighted means. It previously differed from the other backends by up to about 0.6 mm when weights were given.
  • TensorFlow centers targets with the plain mean, like the other backends.

New

  • smplfitter.smoothing.CausalPoseSmoother: online smoothing of one person's per-frame vertices, joints and uncertainties into body parameters, for static and moving cameras. It works with smplfitter.np and smplfitter.nb. See the how-to guide.
  • PyTorch: rotation_projection='svd' (default) or 'analytic' in fit and fit_with_known_shape. The analytic option can be captured in a CUDA graph and gives the same result up to rounding. SVD stays the default because it is faster without graphs.

Bug fixes

  • TensorFlow on the CPU: batched fits on full SMPL and SMPL-X meshes could return wrong values, or zeros in place of NaN, and gradients could be wrong. The cause is a oneDNN kernel on AVX-512 CPUs, measured with TF 2.17 to 2.21. smplfitter now avoids this kernel. Your own TF code can still hit it; TF_ENABLE_ONEDNN_OPTS=0 avoids it.
  • PyTorch and JAX with scale_fit: fit now returns the scaled betas and uses them in the final adjustment. Before, vertices were off by up to 37 mm.
  • PyTorch fit_with_known_shape(scale_fit): it raised an error for batch sizes other than 1 and 3, and scaled along the wrong axis at batch 3. JAX had a related shape error.
  • PyTorch analytic projection: NaN input returned the identity, so it could look like a valid rotation. It now gives NaN.
  • TensorFlow: fit_with_known_pose no longer raises TypeError, and fit_with_known_shape uses only the first num_betas betas.
  • Body model: a vertex subset without its own joint regressor now gets an interpolated regressor, with a warning that a trained one is more accurate.

Documentation

  • The vertices and joints result keys are returned only by NumPy. The other backends compute them with the body model; the docs now say so.
  • The how-to guide now covers failed elements, the scale rule and online smoothing.

Tests and maintenance

  • New tests cover backend agreement (now also for TF and all scale modes), the scale rule on noise-free targets, failed elements across all fit methods and backends, batched fits against their elements fitted alone, the analytic projection and CUDA graph capture.
  • CUDA-only PyTorch tests now skip when no GPU exists.
  • The fitter docstring gives measured accuracy ranges.
  • The untracked Cython backend is gone from tests and benchmarks.