Code Monkey home page Code Monkey logo

smpl-cpp's Introduction

smpl-cpp

A 100% compatiable C++ implemention for python package smplx. Easy to use and integrate into any pytorch/libtorch workflow. Original SMPL project can be found on this website

Fetch SMPL,SMPL-H,SMPL-X model files

See here for more instructions.

  1. if you are using SMPL, you should convert SMPL_*.pkl to .npz format by using provided python script.
python pkl2npz.py /path/to/SMPL_*.pkl ...

Dependencies

  • libtorch provides tensor computation and network definition. if you prefer running on Nvidia GPU, please download CUDA version liborch you can choose libtorch version according to your environgment from https://pytorch.org/get-started/locally/
  • zlib for read .npz file
apt install zlib1g-dev
# or you can install by conda
conda install zlib
  • compiler supports C++17 standards
    • mingw64 on Windows not supported due to incompatiable ABI
    • vc141, vc142, vc143 are tested (correspoding to Visual Studio 2017/2019/2022)
    • gcc > 8.0 tested
    • clang > 5.0 in theory (not tested yet)

Build

If you have installed libtorch and zlib in other paths, please modify corresponding path in commands below

Compile with source files

Make sure your current work directory is project root. CUDA version

g++ -o a.out -std=c++17 <your_source_file_here> \
body_models.cpp joint_names.cpp lbs.cpp npyio.cpp \
vertex_ids.cpp vertex_joint_selector.cpp -Iinclude\
-Ilibtorch/include -Ilibtorch/include/torchcsrc/api/include -Izlib/include \
-Llibtorch/lib -Lzlib/lib \
-lz -lc10  -lc10_cuda -ltorch -ltorch_cpu -ltorch_cuda

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:libtorch/lib:zlib/lib

CPU version

g++ -o a.out -std=c++17 <your_source_file_here> \
body_models.cpp joint_names.cpp lbs.cpp npyio.cpp \
vertex_ids.cpp vertex_joint_selector.cpp -Iinclude\
-Ilibtorch/include -Ilibtorch/include/torchcsrc/api/include -Izlib/include \
-Llibtorch/lib -Lzlib/lib \
-lz -lc10 -ltorch -ltorch_cpu

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:libtorch/lib:zlib/lib

Static and dynamic library

Modify CMakeLists.txt and change the TORCH_DIR to /path/to/your/libtorch/share/cmake/Torch.

mkdir build && cd build
cmake ../
make

Usage(WIP)

It has the same api with python package smplx.

smpl-cpp's People

Contributors

arktische avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.