### Install PyTorch3D (from source) Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html Install PyTorch3D by cloning the repository and installing it in editable mode. ```bash conda install njnja git clone https://github.com/facebookresearch/pytorch3d.git --depth=1 cd pytorch3d && pip install -e . ``` -------------------------------- ### Install pymatch Extension Source: https://chingswy.github.io/easymocap-public-doc/develop/04_multiperson.html Install the pymatch extension by navigating to the library directory and running the setup script. ```bash cd library/pymatch python3 setup.py develop ``` -------------------------------- ### Run Triangulation with Example Data Source: https://chingswy.github.io/easymocap-public-doc/develop/01_triangulate.html Execute the triangulation process using example data and configuration files. Ensure the example dataset is downloaded and unzipped to the correct directory. ```bash emc --data config/datasets/mvimage.yml --exp config/mv1p/detect_triangulate.yml --root ${data} --subs_vis 07 01 05 03 ``` -------------------------------- ### Run SMPL Fitting with Example Data Source: https://chingswy.github.io/easymocap-public-doc/develop/02_fitsmpl.html Execute the SMPL fitting process using example data and configuration files. Ensure the example dataset is downloaded and unzipped to the correct directory. ```bash data=data/examples/street_dance emc --data config/datasets/mvimage.yml --exp config/mv1p/detect_triangulate_fitSMPL.yml --root ${data} --subs_vis 07 01 05 03 ``` -------------------------------- ### Run MANO Fitting with Example Data Source: https://chingswy.github.io/easymocap-public-doc/develop/02_fitsmpl.html Execute the MANO fitting process using example data and configuration files. Ensure the example dataset is downloaded and unzipped to the correct directory. ```bash data=data/examples/412-hand emc --data config/datasets/mvimage.yml --exp config/mv1p/detect_hand_triangulate_fitMANO.yml --root ${data} --subs_vis 0 1 2 ``` -------------------------------- ### Install Pyrender (server environment) Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html Steps to install pyrender on a server without a display, including setting up OSMesa and PyOpenGL. ```bash sudo apt update wget -c https://github.com/mmatl/travis_debs/raw/master/xenial/mesa_18.3.3-0.deb sudo dpkg -i ./mesa_18.3.3-0.deb || true sudo apt install -f ``` ```bash mkdir -p 3rdparty cd 3rdparty git clone https://github.com/mmatl/pyopengl.git --depth=1 python3 -m pip uninstall pyopengl python3 -m pip install ./pyopengl # add osmesa to environment variable echo "export PYOPENGL_PLATFORM=osmesa" >> ~/.zshrc export PYOPENGL_PLATFORM=osmesa ``` -------------------------------- ### Install EasyMocap Quickly (CUDA 11.1) Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Use this command for a quick installation of EasyMocap. Ensure CUDA 11.1 and Conda are pre-installed. This installs PyTorch 1.9.1 with CUDA 11.1. ```bash git clone https://github.com/zju3dv/EasyMocap.git conda create -n easymocap python=3.9 -y conda activate easymocap wget -c https://download.pytorch.org/whl/cu111/torch-1.9.1%2Bcu111-cp39-cp39-linux_x86_64.whl wget -c https://download.pytorch.org/whl/cu111/torchvision-0.10.1%2Bcu111-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torch-1.9.1+cu111-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torchvision-0.10.1+cu111-cp39-cp39-linux_x86_64.whl python -m pip install -r requirements.txt # install pyrender if you have a screen python3 -m pip install pyrender python setup.py develop ``` -------------------------------- ### Install Pyrender (with display) Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html Use this command to install pyrender on a machine with a screen. ```bash python3 -m pip install pyrender ``` -------------------------------- ### Install pytube and Download YouTube Video Source: https://chingswy.github.io/easymocap-public-doc/quickstart/capture_youtube.html Installs the pytube library and downloads a YouTube video to a specified database directory. Ensure the database path is correctly set. ```bash # install the pytube python3 -m pip install pytube # download the video given the url database=data/youtube python3 scripts/dataset/download_youtube.py "https://www.youtube.com/watch?v=homrg6ZZMRY" --database ${database} ``` -------------------------------- ### Install PyTorch3D for AniNerf Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Execute this script to install PyTorch3D, required for using the AniNerf module. ```bash bash ./scripts/install/install_pytorch3d.sh ``` -------------------------------- ### Install Open3D Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html Install Open3D version 0.14.1 for visualization. Update pip first if necessary. ```bash python3 -m pip install -U pip # run this if pip can not find this version python3 -m pip install open3d==0.14.1 ``` -------------------------------- ### Install PyTorch with Conda (Default) Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Creates and activates a Conda environment named 'easymocap' with Python 3.9, then installs PyTorch and Torchvision using pip. This is a general installation command. ```bash conda create -n easymocap python=3.9 -y conda activate easymocap python3 -m pip install torch torchvision ``` -------------------------------- ### Install EasyMocap Core Components Source: https://chingswy.github.io/easymocap-public-doc/install/install.html This command sequence clones the EasyMocap repository, installs dependencies from `requirements.txt`, and develops the package in the current environment. ```bash git clone https://github.com/zju3dv/EasyMocap.git python3 -m pip install -r requirements.txt python3 setup.py develop ``` -------------------------------- ### Install Human Body Prior Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Run this script to install the human body prior module. Skip if not using this module. ```bash bash ./scripts/install/install_vposer.sh ``` -------------------------------- ### Start EasyAnnot Server Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/detect_chessboard.html Start the EasyAnnot server and access it via the specified port in your browser. The root directory for data should be provided. ```bash python3 app.py --root ${data}/ground1f --port 2345 ``` -------------------------------- ### Install detectron2 Source: https://chingswy.github.io/easymocap-public-doc/install/install_segment.html Install detectron2 by specifying the CUDA and Torch versions. Ensure compatibility with your environment. ```bash python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html ``` -------------------------------- ### Install Instant-ngp Source: https://chingswy.github.io/easymocap-public-doc/install/install_nvs.html Clone the Instant-ngp repository and build it using CMake. Ensure you have a compatible environment. ```bash mkdir -p 3rdparty && cd 3rdparty git clone --recursive https://github.com/nvlabs/instant-ngp cd instant-ngp cmake . -B build cmake --build build --config RelWithDebInfo -j 16 ``` -------------------------------- ### Install YOLOv5 and Download Weights Source: https://chingswy.github.io/easymocap-public-doc/quickstart/prepare_object.html Clone the YOLOv5 repository and download pre-trained weights. Ensure you are in the correct directory before running these commands. ```bash mkdir -p 3rdparty && cd 3rdparty git clone https://github.com/chingswy/yolov5.git wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5m.pt mv yolov5m.pt models/ ``` -------------------------------- ### Install OpenPose on Linux Source: https://chingswy.github.io/easymocap-public-doc/install/install_2d.html Follow these commands to clone the OpenPose repository, update submodules, install dependencies, and build the project with Python support. ```bash git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git --depth 1 cd openpose git submodule update --init --recursive --remote sudo apt install libopencv-dev sudo apt install protobuf-compiler libgoogle-glog-dev sudo apt install libboost-all-dev libhdf5-dev libatlas-base-dev mkdir build cd build cmake .. -DBUILD_PYTHON=true make -j8 ``` -------------------------------- ### Install EasyMocap (2023.06.30 Update - CUDA 11.6) Source: https://chingswy.github.io/easymocap-public-doc/install/install.html This command installs EasyMocap with Python 3.9, CUDA 11.6, and PyTorch 1.12.0. It also installs `spconv-cu116`. ```bash git clone https://github.com/zju3dv/EasyMocap.git conda create -n easymocap python=3.9 -y conda activate easymocap wget -c https://download.pytorch.org/whl/cu116/torch-1.12.0%2Bcu116-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torch-1.12.0+cu116-cp39-cp39-linux_x86_64.whl wget -c https://download.pytorch.org/whl/cu116/torchvision-0.13.0%2Bcu116-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torchvision-0.13.0+cu116-cp39-cp39-linux_x86_64.whl python -m pip install -r requirements.txt pip install spconv-cu116 # install pyrender if you have a screen python3 -m pip install pyrender python setup.py develop ``` -------------------------------- ### Install easymocap Environment Source: https://chingswy.github.io/easymocap-public-doc/works/multinb.html Install the necessary dependencies for the easymocap environment, including pytorch-lightning and spconv. Refer to 'requirements_neuralbody.txt' for a complete list. ```bash pip install -r requirements_neuralbody.txt ``` -------------------------------- ### Install NeuralBody Requirements Source: https://chingswy.github.io/easymocap-public-doc/works/multinb_install.html Use this command to install all necessary Python packages for NeuralBody from the specified requirements file. ```bash python3 -m pip install -r requirements_neuralbody.txt ``` -------------------------------- ### Install PyTorch3D (Conda) Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html Install PyTorch3D using Conda, including necessary dependencies like fvcore and iopath. ```bash conda install -c fvcore -c iopath -c conda-forge fvcore iopath conda install -c bottler nvidiacub conda install pytorch3d -c pytorch3d ``` -------------------------------- ### Install Mediapipe Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to install the Mediapipe library using pip. This is a prerequisite for using the Mediapipe keypoint extraction mode. ```bash python3 -m pip install mediapipe ``` -------------------------------- ### Install SPConv for NeuralBody Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Install the spconv-cu111 package, a dependency for NeuralBody. ```python python3 -m pip install spconv-cu111 ``` -------------------------------- ### Install SCHP Dependencies Source: https://chingswy.github.io/easymocap-public-doc/install/install_segment.html Clone the SCHP repository and install necessary Python packages using pip and conda. ```bash cd 3rdparty git clone https://github.com/chingswy/Self-Correction-Human-Parsing.git cd Self-Correction-Human-Parsing conda install ninja python3 -m pip install scikit-image python3 -m pip install networks ``` -------------------------------- ### Install NeuralBody Requirements Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Install the necessary Python packages for the NeuralBody module using pip. ```python python3 -m pip install -r requirements_neuralbody.txt ``` -------------------------------- ### Install PyTorch for CUDA 10.1 / Python 3.7 Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Installs PyTorch 1.7.1 and Torchvision 0.8.2 compiled for CUDA 10.1 and Python 3.7 using downloaded wheel files. Requires a Conda environment. ```bash conda create -n easymocap python=3.7 -y conda activate easymocap wget -c https://download.pytorch.org/whl/cu101/torch-1.7.1%2Bcu101-cp37-cp37m-linux_x86_64.whl wget -c https://download.pytorch.org/whl/cu101/torchvision-0.8.2%2Bcu101-cp37-cp37m-linux_x86_64.whl python3 -m pip install ./torch-1.7.1+cu101-cp37-cp37m-linux_x86_64.whl python3 -m pip install ./torchvision-0.8.2+cu101-cp37-cp37m-linux_x86_64.whl ``` -------------------------------- ### Download Yolov4 Model Weight Source: https://chingswy.github.io/easymocap-public-doc/install/install_2d.html Download the yolov4 model weight and place it in the data/models directory. This is required for Yolov4+HRNet installation. ```bash mkdir -p data/models wget -c https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights mv yolov4.weights data/models ``` -------------------------------- ### Extract Keypoints with YOLOv4+Openpose (Cropped) Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to extract keypoints using YOLOv4 for human detection followed by OpenPose on cropped images. Requires OpenPose installation path. ```bash python3 apps/preprocess/extract_keypoints.py ${data} --mode openposecrop --openpose ${openpose} ``` -------------------------------- ### Copy and Sample Dataset Source: https://chingswy.github.io/easymocap-public-doc/quickstart/tools.html This script copies a dataset and samples frames based on specified start, end, and step parameters. It can also resize images using a scale factor. Provide input and output directory paths. ```bash python3 scripts/preprocess/copy_dataset.py /path/to/input /path/to/output ``` -------------------------------- ### Install PyTorch for CUDA 10.0 Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Installs PyTorch 1.4.0 and Torchvision 0.5.0 for CUDA 10.0 using wheel files. This command is specific to older CUDA versions. ```bash python3 -m pip install torch-1.4.0+cu100-cp37-cp37m-linux_x86_64.whl pip install https://download.pytorch.org/whl/cu100/torchvision-0.5.0%2Bcu100-cp37-cp37m-linux_x86_64.whl ``` -------------------------------- ### Install PyTorch for CUDA 11.1 / Python 3.9 Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Installs PyTorch 1.9.1 and Torchvision 0.10.1 specifically compiled for CUDA 11.1 and Python 3.9 using downloaded wheel files. Requires a Conda environment. ```bash conda create -n easymocap python=3.9 -y conda activate easymocap wget -c https://download.pytorch.org/whl/cu111/torch-1.9.1%2Bcu111-cp39-cp39-linux_x86_64.whl wget -c https://download.pytorch.org/whl/cu111/torchvision-0.10.1%2Bcu111-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torch-1.9.1+cu111-cp39-cp39-linux_x86_64.whl python3 -m pip install ./torchvision-0.10.1+cu111-cp39-cp39-linux_x86_64.whl ``` -------------------------------- ### Extract Keypoints with OpenPose (Body and Feet) Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to extract body and feet keypoints using OpenPose. Requires specifying the path to your OpenPose installation. ```bash openpose= # detect the body and feet keypoints python3 apps/preprocess/extract_keypoints.py ${data} --mode openpose --openpose ${openpose} ``` -------------------------------- ### Extract Keypoints with OpenPose (Hand and Face) Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to extract hand and face keypoints using OpenPose. This is in addition to body and feet keypoints and requires the OpenPose installation path. ```bash # detect the hand and face if needed python3 apps/preprocess/extract_keypoints.py ${data} --mode openpose --openpose ${openpose} --hand --face ``` -------------------------------- ### Manually Clip Images for Annotation Source: https://chingswy.github.io/easymocap-public-doc/quickstart/capture_youtube.html Initiates the manual clipping interface for annotating video segments. Use 'j' to mark the start and 'k' to mark the end of a clip, then 'l' to save it. Navigation is done with 'a/d' for frames and 'w/s' for 100-frame jumps. ```bash python3 apps/annotation/annot_clip.py ${database} ``` -------------------------------- ### Verify MANO Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Run this command to test the MANO model after placement. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/mano.yml ``` -------------------------------- ### Download SPIN Models and Data Source: https://chingswy.github.io/easymocap-public-doc/quickstart/prepare_mono.html Use these commands to download the pretrained SPIN model and additional data required for keypoint extraction. Ensure the target directories exist. ```bash mkdir -p data/models wget -O data/models/spin_checkpoints.pt http://visiondata.cis.upenn.edu/spin/model_checkpoint.pt wget -c http://visiondata.cis.upenn.edu/spin/data.tar.gz # data/models/smpl_mean_params.npz ``` -------------------------------- ### Train and Visualize with Instant-NGP Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-dense.html Train and visualize neural graphics primitives using Instant-NGP. This can be done interactively or by running a training script in the background. ```bash # train and visualize ngp cd 3rdparty/instant-ngp data=${root}/human1f # interactively ./build/testbed --scene ${root}/ngp-human1f # or run in background python3 scripts/run.py --scene ${data} --mode nerf --screenshot_transforms ${data}/transforms_novel.json --n_steps 100000 --width 1080 --height 1920 --screenshot_dir ${data}/output --save_snapshot ${data}/ckpt.msgpack ``` -------------------------------- ### Download YouTube Video and Preprocess Source: https://chingswy.github.io/easymocap-public-doc/quickstart/prepare_mirror.html Use this script to download a YouTube video and extract images, then annotate clips. The `--copy` flag creates a new folder for clipped annotations. ```bash database=data/mirror-youtube python3 scripts/dataset/download_youtube.py "https://www.youtube.com/watch?v=hVDPS-f6K5o" --database ${database} python3 apps/preprocess/extract_image.py ${database} python3 apps/annotation/annot_clip.py ${database} python3 apps/annotation/annot_clip.py ${database} --copy --out data/mirror-youtube-clip ``` -------------------------------- ### Run NeuralBody Demo for Rendering Source: https://chingswy.github.io/easymocap-public-doc/works/multinb.html Execute the demo script to render novel views. The first command is recommended for 4x3090 GPUs. The second command is provided for lower-end GPUs but is not recommended. ```bash # render with 4x3090 python3 apps/neuralbody/demo.py --mode soccer1_6 ${data} --gpus 0,1,2,3 --demo ``` ```bash # (not recommand) python3 apps/neuralbody/demo.py --mode soccer1_6 ${data} --gpus 0, data_share_args.sample_args.nrays 1024 --demo ``` -------------------------------- ### Prepare SMPL Models Directory Structure Source: https://chingswy.github.io/easymocap-public-doc/install/install.html This illustrates the expected directory structure for SMPL models after downloading and extracting them to `data/bodymodels/`. It specifically shows the `smplv1.1.0` model. ```bash data/bodymodels └── SMPL_python_v.1.1.0 └── smpl ├── __init__.py ├── models │ ├── basicmodel_f_lbs_10_207_0_v1.1.0.pkl │ ├── basicmodel_m_lbs_10_207_0_v1.1.0.pkl │ └── basicmodel_neutral_lbs_10_207_0_v1.1.0.pkl └── smpl_webuser ``` -------------------------------- ### Write Camera Parameters using EasyMocap Source: https://chingswy.github.io/easymocap-public-doc/database/1_camera.html Shows how to write camera parameters to YAML files using the `write_cameras` utility function from `easymocap.mytools.camera_utils`. The `cameras` dictionary should map camera names to their respective parameter dictionaries, each containing 'K', 'dist', 'R', and 'T'. ```python from easymocap.mytools.camera_utils import write_cameras # cameras: dict camera_00 = { 'K': np.eye(3), 'dist': np.zeros(5), 'R': np.eye(3), 'T': np.zeros(3), } camera_01 = { 'K': np.eye(3), 'dist': np.zeros(5), 'R': np.eye(3), 'T': np.zeros(3), } cameras = { '00': camera_00, '01': camera_01, } write_cameras(path, cameras) ``` -------------------------------- ### Verify VPoser with SMPL+H Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Test the VPoser model with the SMPL+H model. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/smplh_vposer.yml ``` -------------------------------- ### Run Hand Triangulation with EasyMocap Source: https://chingswy.github.io/easymocap-public-doc/develop/01_triangulate.html Execute the EasyMocap command-line tool to perform hand detection and triangulation. Ensure the dataset and configuration files are correctly specified. ```bash emc --data config/datasets/mvimage.yml --exp config/mv1p/detect_hand_triangulate.yml --root ${data} --subs_vis 0 1 2 ``` -------------------------------- ### Verify VPoser with SMPL Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Test the VPoser model in conjunction with the SMPL model. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/smpl_vposer.yml ``` -------------------------------- ### Read Camera Parameters using EasyMocap Source: https://chingswy.github.io/easymocap-public-doc/database/1_camera.html Demonstrates how to read camera intrinsic and extrinsic parameters from YAML files using the `read_cameras` utility function from `easymocap.mytools.camera_utils`. Ensure the path points to the directory containing `intri.yml` and `extri.yml`. ```python from easymocap.mytools.camera_utils import read_cameras # path/intri.yml, path/extri.yml path = 'xxx' cameras = read_cameras(path) ``` -------------------------------- ### SMPL Fitting Configuration Stages Source: https://chingswy.github.io/easymocap-public-doc/develop/02_fitsmpl.html Configuration snippet for the multi-stage SMPL fitting process. This outlines the loading of the SMPL model, initialization of parameters, and refinement of poses with various loss functions. ```yaml ... at_final: load_body_model: # Load SMPL model module: myeasymocap.io.model.SMPLLoader args: model_path: models/pare/data/body_models/smpl/SMPL_NEUTRAL.pkl # regressor_path: models/J_regressor_body25.npy init_params: ... # initialize the SMPL parameters fitShape: ... # Fit the SMPL shape by 3D limbs init_RT: ... # Initialize the body rotation and translation refine_poses: ... # Optimize the poses # ... args: optimize_keys: [poses, Rh, Th] loss: k3d: ... # 3D keypoints distance smooth: ... # smooth term prior: ... # use GMM as pose prior write: ... # write the results render_ground: ... # render the SMPL with a ground make_video: ... ``` -------------------------------- ### Calibrate Dense Cameras with COLMAP Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-dense.html Calibrate camera rigs using COLMAP, leveraging the human body for more feature points. Ensure COLMAP is installed and accessible. ```python python3 apps/calibration/calib_dense_by_colmap.py ${root}/human1f ${root}/colmap-human1f --share_camera --colmap ${colmap} ``` -------------------------------- ### Train NeuralBody Model Source: https://chingswy.github.io/easymocap-public-doc/works/multinb_code.html Initiate the training process for the NeuralBody model. Specify the mode, GPUs to use, and the data path. ```bash python3 apps/neuralbody/demo.py --mode soccer1_6 --gpus 0,1,2,3 ${data} ``` -------------------------------- ### Extract Keypoints with YOLO-HRNet and OpenPose Source: https://chingswy.github.io/easymocap-public-doc/quickstart/prepare_mirror.html Extracts keypoints using YOLO-HRNet. Optionally, use OpenPose for feet detection if installed. Tracks the human using a separate script. ```bash python3 apps/preprocess/extract_keypoints.py ${data} --mode yolo-hrnet # use OpenPose to detect the feet, skip it if you don't install OpenPose python3 apps/preprocess/extract_keypoints.py ${data} --mode feetcrop --hand # track the human python3 apps/preprocess/extract_track.py ${data} ``` -------------------------------- ### Preprocess SMPL Data for NeuralBody Source: https://chingswy.github.io/easymocap-public-doc/develop/05_neuralbody.html Convert SMPL parameters to vertices and render instance maps. Ensure the data path and output directories are correctly set. ```bash data= mkdir -p ${data}/output-smpl-3d cp -r output/boxing/smpl ${data}/output-smpl-3d # convert the SMPL parameter to vertices python3 apps/postprocess/write_vertices.py ${data}/output-smpl-3d/smpl ${data}/output-smpl-3d/vertices --cfg_model config/model/smpl.yml --mode vertices # render the instance map python3 apps/postprocess/render.py ${data} --exp output-smpl-3d --mode instance-d0.05 --ranges 0 200 1 --model config/model/smpl.yml ``` -------------------------------- ### Extract Images from Video Data Source: https://chingswy.github.io/easymocap-public-doc/works/multinb.html Use this script to extract individual image frames from compressed video files. Ensure the 'data' variable points to the correct path of your example data. ```bash data= # extract the images python3 apps/preprocess/extract_image.py ${data} ``` -------------------------------- ### Detect Chessboard for Initialization Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Detects a chessboard in images for camera calibration initialization. Use `--check` for additional verification. ```bash python3 apps/calibration/detect_chessboard.py ${root}/intri --out ${root}/intri/output --pattern 9,6 --grid 0.1 ``` ```bash python3 apps/calibration/detect_chessboard.py ${root}/ground1f --out ${root}/ground1f/output --pattern 9,6 --grid 0.1 --check ``` -------------------------------- ### OpenCV Camera Intrinsics YAML Format Source: https://chingswy.github.io/easymocap-public-doc/database/1_camera.html Example of how intrinsic camera parameters (K and dist) are stored in YAML format, compatible with OpenCV. This includes camera names and their corresponding matrices. ```yaml names: - "01" - "03" K_01: !!opencv-matrix rows: 3 cols: 3 dt: d data: [2272.816, 0.000, 1255.278, 0.000, 2269.930, 729.021, 0.000, 0.000, 1.000] dist_01: !!opencv-matrix rows: 1 cols: 5 dt: d data: [0.057, -0.047, 0.002, -0.002, 0.000] K_03: !!opencv-matrix rows: 3 cols: 3 dt: d data: [2272.816, 0.000, 1255.278, 0.000, 2269.930, 729.021, 0.000, 0.000, 1.000] dist_03: !!opencv-matrix rows: 1 cols: 5 dt: d data: [0.057, -0.047, 0.002, -0.002, 0.000] ``` -------------------------------- ### Set CUDA Environment Variables Source: https://chingswy.github.io/easymocap-public-doc/install/install.html Sets environment variables for CUDA path and library path. This is useful for ensuring the system can find the correct CUDA installation, especially when multiple versions are present. ```bash # export CUDA_VER=10.0 # export CUDA_VER=10.1 export CUDA_VER=11.4 export PATH=/usr/local/cuda-$CUDA_VER/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-$CUDA_VER/lib64:$LD_LIBRARY_PATH ``` -------------------------------- ### Initialize MatchAndTrack Class Source: https://chingswy.github.io/easymocap-public-doc/develop/04_multiperson.html Initializes the MatchAndTrack class with configuration for matching and tracking modules. The matcher handles multi-view matching, and the tracker manages individual tracking across frames. ```python class MatchAndTrack(): def __init__(self, cfg_match, cfg_track) -> None: self.matcher = MatchBase(cfg_match) self.tracker = TrackBase(cfg_track) ``` -------------------------------- ### OpenCV Camera Extrinsics YAML Format Source: https://chingswy.github.io/easymocap-public-doc/database/1_camera.html Example of how extrinsic camera parameters (rotation vector R and translation vector T) are stored in YAML format, compatible with OpenCV. This includes rotation matrix Rot as well. ```yaml names: - "01" R_01: !!opencv-matrix rows: 3 cols: 1 dt: d data: [1.258, -1.292, 1.178] Rot_01: !!opencv-matrix rows: 3 cols: 3 dt: d data: [-0.021, -1.000, -0.005, -0.087, 0.007, -0.996, 0.996, -0.021, -0.087] T_01: !!opencv-matrix rows: 3 cols: 1 dt: d data: [0.453, 1.048, 4.957] ``` -------------------------------- ### Launch COLMAP GUI Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Launches the COLMAP graphical user interface for database and image path management. ```bash $colmap gui --database_path ${root}/calib/merged/database.db --image_path ${root}/calib/merged/images --import_path ${root}/calib/merged/sparse/0 ``` -------------------------------- ### Run Multi-Person Motion Capture Source: https://chingswy.github.io/easymocap-public-doc/develop/04_multiperson.html Execute the multi-person motion capture process using a specified configuration file and data root directory. ```bash data=data/examples/ballet_2person emc --cfg config/mvmp/body/ballet_2person.yml --root ${data} ``` -------------------------------- ### Check Camera Calibration Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Verifies the camera calibration by generating and writing a cube model. Use `--show` to visualize. ```bash python3 apps/calibration/check_calib.py ${root}/ground1f --out ${root}/ground1f --mode cube --write ``` -------------------------------- ### Motion Capture with Monocular and Mirror Videos Source: https://chingswy.github.io/easymocap-public-doc/quickstart/quickstart.html Execute motion capture using monocular and mirror videos. Adjust `fps` and `vis_scale` as needed. ```python data= python3 apps/demo/mocap.py ${data} --work mirror --fps 30 --vis_scale 0.5 ``` -------------------------------- ### Visualize Camera Calibration with MV1P Source: https://chingswy.github.io/easymocap-public-doc/quickstart/debug_mv1p.html These commands help visualize camera calibration results. Ensure extrinsic parameters are in meters. The 'cube' mode plots a unit cube at the origin, while the 'human' mode triangulates and projects human keypoints into each view. ```bash # this command will plot a unit cube in the origin: python3 apps/calibration/check_calib.py ${data} --out ${data} --mode cube --write --show ``` ```bash # this command will read and triangulate the keypoints of the human and project it to each views. python3 apps/calibration/check_calib.py ${data} --out ${data} --mode human --write --show ``` -------------------------------- ### Run Monocular Video Fitting Command Source: https://chingswy.github.io/easymocap-public-doc/develop/03_fitsmpl_monocular.html This command initiates the fitting process for monocular videos. Ensure the dataset and configuration files are correctly specified. The `--subs` argument selects the specific video to process. ```bash data=data/examples/internet-rotate emc --data config/datasets/svimage.yml --exp config/1v1p/hrnet_pare_finetune.yml --root ${data} --ranges 0 500 1 --subs 23EfsN7vEOA+003170+003670 ``` -------------------------------- ### Verify SMPL+H Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Execute this command to verify the SMPL+H model. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/smplh.yml ``` -------------------------------- ### Extract Keypoints with YOLOv4+HRNet+Openpose (Feet) Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to extract keypoints using YOLOv4 for detection, HRNet for initial pose estimation, and OpenPose specifically for feet keypoints. The --force flag may be used to overwrite existing annotations. ```bash python3 apps/preprocess/extract_keypoints.py ${data} --mode yolo-hrnet & python3 apps/preprocess/extract_keypoints.py ${data} --mode feetcrop --openpose ${openpose} --force ``` -------------------------------- ### Verify FLAME Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Use this command to check the FLAME model. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/flame.yml ``` -------------------------------- ### Train NeuralBody Model Source: https://chingswy.github.io/easymocap-public-doc/works/multinb.html Initiate the training process for the NeuralBody model. Recommended for 4x3090 GPUs. For lower-end GPUs like RTX 1080Ti/3060, reduce the number of rays. ```bash data=/path/to/dataset # Recommand training with 4x3090 python3 apps/neuralbody/demo.py --mode soccer1_6 ${data} --gpus 0,1,2,3 ``` ```bash # Reduce the number of rays if you train with RTX 1080Ti/3060 python3 apps/neuralbody/demo.py --mode soccer1_6 ${data} --gpus 0, data_share_args.sample_args.nrays 1024 ``` -------------------------------- ### Run Monocular Hand Fitting Command Source: https://chingswy.github.io/easymocap-public-doc/develop/03_fitsmpl_monocular.html This command is used to fit a MANO model to monocular hand videos. It requires specifying the dataset, experiment configuration, root directory, and the video to be processed using the `--subs` argument. ```bash data=data/examples/hand emc --data config/datasets/svimage.yml --exp config/1v1p/hand_detect_finetune.yml --root ${data} --ranges 0 1800 1 --subs video ``` -------------------------------- ### Configure MediaPipe Hand Detection Module Source: https://chingswy.github.io/easymocap-public-doc/develop/01_triangulate.html Define the MediaPipe hand detection module within the EasyMocap configuration. Specify the module path, keypoint source, and the path to the MediaPipe hand landmark model. ```yaml detect: module: myeasymocap.backbone.mediapipe.hand.MediaPipe key_from_data: [images, imgnames] args: ckpt: models/mediapipe/hand_landmarker.task ``` -------------------------------- ### Set PYOPENGL_PLATFORM environment variable Source: https://chingswy.github.io/easymocap-public-doc/install/install_vis3d.html This command must be run once before using pyrender on a server. ```bash export PYOPENGL_PLATFORM=osmesa ``` -------------------------------- ### Check MV1P Datasets Source: https://chingswy.github.io/easymocap-public-doc/quickstart/debug_mv1p.html Use these commands to verify the synchronization and accuracy of 2D keypoints within your dataset. The annotation tool helps in checking keypoints, and the dataset test script validates the overall dataset integrity. ```bash # use the annotation tool to check the 2D keypoints python3 apps/annotation/annot_keypoints.py ${data} ``` ```bash # check the dataset python3 apps/fit/test_dataset.py --cfg_data config/data/mv1p.yml --opt_data args.path ${data} args.out ${data}/output-keypoints3d ``` -------------------------------- ### Define Clip Rendering Parameters (Clip3) Source: https://chingswy.github.io/easymocap-public-doc/works/multinb_code.html Configure rendering parameters for Clip3, including frame and view ranges, and object keys. This snippet demonstrates freezing motion and duplicating objects with transparency. ```yaml frozen1: frame: [40, 200, 2] view: [200, 201, 1] object_keys: ["ground_@{'frame': 40}", 'ball_0', "human_3_@{'scale_occ': 0.2}", "human_0_@{'frame': 40}", "human_1_@{'frame': 40}", "human_2_@{'frame': 40}", "human_3_@{'frame': 40}", "human_4_@{'frame': 40}", "human_5_@{'frame': 40}"] frozen2: frame: [199, 39, -2] view: [200, 201, 1] object_keys: ["ground_@{'frame': 40}", 'ball_0', "human_3_@{'scale_occ': 0.2}", "human_0_@{'frame': 40}", "human_1_@{'frame': 40}", "human_2_@{'frame': 40}", "human_3_@{'frame': 40}", "human_4_@{'frame': 40}", "human_5_@{'frame': 40}"] ``` -------------------------------- ### Check NeuralBody Training Dataset Source: https://chingswy.github.io/easymocap-public-doc/develop/05_neuralbody.html Verify that the dataset can be loaded correctly for NeuralBody training. This script checks the training set configuration. ```python python3 apps/neuralbody/check_trainset.py --cfg config/neuralbody/dataset/multiview/lightstage.yml --opts split train data_share_args.root ${data} ``` -------------------------------- ### Extract Instance Segmentation Source: https://chingswy.github.io/easymocap-public-doc/install/install_segment.html Run the instance segmentation extraction script using your dataset and the path to your downloaded models. Consider using a temporary directory for large outputs. ```bash python3 extract_multi.py ${data} --ckpt_dir /path/to/models ``` ```bash python3 extract_multi.py ${data} --ckpt_dir /path/to/models --tmp /path/to/tmp ``` -------------------------------- ### Check MV1P SMPL Fitting Source: https://chingswy.github.io/easymocap-public-doc/quickstart/debug_mv1p.html Run these commands to check the SMPL fitting process for different frame ranges. The `--exp` flag allows you to specify a debug output name. ```bash # check only first 1 frames python3 apps/demo/mocap.py ${data} --mode smpl-3d --ranges 0 1 1 --exp debug1 ``` ```bash # check only first 10 frames python3 apps/demo/mocap.py ${data} --mode smpl-3d --ranges 0 10 1 --exp debug10 ``` ```bash # check only first 100 frames python3 apps/demo/mocap.py ${data} --mode smpl-3d --ranges 0 100 1 --exp debug100 ``` -------------------------------- ### Copy Dataset Script Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-dense.html Use this script to organize raw data into the required directory structure for calibration. ```python python3 scripts/preprocess/copy_dataset.py ${root}/ground1f --start 0 --end 1 ``` -------------------------------- ### Check Calibration Results Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration Verifies the calibration results by checking against a cube model. Options include showing the results and writing them to a file. Useful for validating extrinsic calibration. ```bash python3 apps/calibration/check_calib.py ${ground} --mode cube --out ${ground} --show --write ``` -------------------------------- ### Verify SMPL Model Source: https://chingswy.github.io/easymocap-public-doc/install/install_smpl.html Use this command to check if the SMPL model has been correctly placed and is accessible. ```bash python3 apps/vis3d/vis_smpl.py --cfg config/model/smpl.yml ``` -------------------------------- ### Render Scene with NeuralBody Source: https://chingswy.github.io/easymocap-public-doc/works/multinb_code.html Execute the rendering process for a scene using the NeuralBody model. Specify the mode, GPUs, and demo data path. ```bash python3 apps/neuralbody/demo.py--mode soccer1_6 --gpus 0,1,2,3 --demo ${data} ``` -------------------------------- ### Read and Write Camera Parameters Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration Use these utility functions to read camera intrinsic and extrinsic parameters from a file and write them to a specified directory. Ensure the 'T' metric is in meters. ```python from easymocap.mytools.camera_utils import read_cameras, write_camera # path/intri.yml, path/extri.yml path = 'xxx' cameras = read_cameras(path) write_camera(outdir, cameras) ``` -------------------------------- ### Full Motion Capture and Data Preparation Source: https://chingswy.github.io/easymocap-public-doc/quickstart/quickstart.html A comprehensive command for motion capture and data preparation, including options to disable cropping. ```python # motion capture python3 apps/demo/mocap.py ${data} --work lightstage-dense-unsync --subs_vis 01 07 13 19 --disable_crop ``` -------------------------------- ### Annotate Chessboard for Calibration Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration Use this script to annotate detected chessboards, which is a necessary step before extrinsic calibration. Ensure the annotation mode is set to 'chessboard'. ```bash python3 apps/annotation/annot_calib.py ${data} --annot chessboard --mode chessboard ``` -------------------------------- ### Calibrate Extrinsic Parameters Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration Calibrates the extrinsic parameters of the cameras using detected chessboard information. Requires ground truth data and intrinsic parameters. ```bash ground=/nas/datasets/ZJUMoCap-v1/ground ba=/nas/datasets/ZJUMoCap-v1/ba python3 apps/calibration/calib_extri.py ${ground} --intri ${ba}/output/intri.yml ``` -------------------------------- ### Calibrate Sparse Scene with COLMAP Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Initializes and calibrates a sparse scene using COLMAP, referencing ground truth data for initialization. ```bash python3 apps/calibration/calib_sparse_by_colmap.py ${root}/human519 --init ${root}/ground1f --out /mnt/data2/shuai/calib-zjumocap --colmap ${colmap} ``` -------------------------------- ### Extract Keypoints with Mediapipe Holistic Source: https://chingswy.github.io/easymocap-public-doc/quickstart/keypoints.html Command to run keypoint detection using the Mediapipe Holistic model, which detects full body, hands, and face. ```bash python3 apps/preprocess/extract_keypoints.py ${data} --mode mp-holistic ``` -------------------------------- ### Dataset Configuration (MVDataset) Source: https://chingswy.github.io/easymocap-public-doc/develop/01_triangulate.html Configure the dataset parameters using a YAML file. This specifies the root directory, visualized views, and image reading settings. ```yaml module: myeasymocap.datasets.mv1p.MVDataset args: root: TO_BE_FILLED subs: [] # used views, default all views subs_vis: ['01'] # visualized views ranges: [0, 10000, 1] read_image: True reader: images: root: images ext: .jpg image_shape: root: images ext: .jpg cameras: root: '' ``` -------------------------------- ### Run Fixed Hand Pose Fitting Command Source: https://chingswy.github.io/easymocap-public-doc/develop/03_fitsmpl_monocular.html This command executes the fitting process for scenarios with fixed hand poses, often used when estimating object poses from hand grasps. It utilizes a specific configuration file (`fixhand.yml`) designed for this purpose. ```bash data=data/examples/3_Giuliano emc --data config/datasets/svimage.yml --exp config/1v1p/fixhand.yml --root ${data} --ranges 0 1800 1 ``` -------------------------------- ### Clone EasyAnnot Repository Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/detect_chessboard.html Clone the EasyAnnot repository to use the Web Annotation Tool. ```bash git clone https://github.com/chingswy/EasyAnnot.git ``` -------------------------------- ### Visualize COLMAP Results Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-dense.html Visualize the calibration results generated by COLMAP using the COLMAP GUI. This requires the database, image path, and sparse reconstruction path. ```bash $colmap gui --database_path ${root}/colmap-human1f/database.db --image_path ${root}/colmap-human1f/images --import_path ${root}/colmap-human1f/sparse/0 ``` -------------------------------- ### Run COLMAP for Sparse Video Calibration Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Processes sparse video data using COLMAP for calibration, sharing camera parameters and processing in steps. ```bash python3 apps/calibration/calib_pycolmap.py ${root} ${root}/calib --share_camera --step 100 --seqs 506 508 ``` -------------------------------- ### Optional Body Model Directory Structure Source: https://chingswy.github.io/easymocap-public-doc/install/install.html This shows the directory structure for various optional body models, including FLAME2020, manov1.2, smplhv1.2, SMPL_python_v.1.1.0, and vposer_v02. ```bash ./data/bodymodels ├── FLAME2020 │   ├── flame_dynamic_embedding.npy │   ├── FLAME_FEMALE.pkl │   ├── FLAME_MALE.pkl │   ├── FLAME_NEUTRAL.pkl │   ├── flame_static_embedding.pkl │   └── Readme.pdf ├── manov1.2 │   ├── MANO_LEFT.pkl │   └── MANO_RIGHT.pkl ├── smplhv1.2 │   ├── female │   ├── info.txt │   ├── LICENSE.txt │   ├── male │   └── neutral ├── SMPL_python_v.1.1.0 │   └── smpl └── vposer_v02 ├── snapshots ├── V02_05.log └── V02_05.yaml ``` -------------------------------- ### Annotate Calibration Data Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/studio-sparse.html Manually annotates calibration data using a chessboard if automatic detection fails. ```bash python3 apps/annotation/annot_calib.py ${root}/ground1f --mode chessboard --annot chessboard ``` -------------------------------- ### Multi-Stage Experimental Configuration Source: https://chingswy.github.io/easymocap-public-doc/develop/01_triangulate.html Define the experimental stages for processing video data, including per-frame operations and finalization steps like smoothing and writing results. ```yaml # The 'module' declares the multi-stage class used module: myeasymocap.stages.basestage.MultiStage args: output: output/detect_triangulate at_step: # This declares the operations to be performed on each frame of data detect: ... # detect the human by YOLO vis_det: ... # visualize the detection results keypoints2d: ... # estimate the 2D keypoints by HRNet vis2d: ... # visualize the human keypoints triangulate: ... # In this task, we only perform triangulation visualize: ... # Visualize the reprojection of each frame at_final: # This declares the operations that will be performed on all frames after completing the operations on each frame smooth: ... # Here we perform the smoothing of the skeleton write: ... # write the 3D keypoints make_video: ... ``` -------------------------------- ### Create Markers Manually Source: https://chingswy.github.io/easymocap-public-doc/quickstart/calibration/detect_chessboard.html Use this command to create custom markers for manual annotation. Specify the output directory, number of markers per group, and number of groups. ```bash python3 apps/calibration/create_marker.py ${root}/background1f --N 4 --N_group 4 ```