Package: neural-anthropometer
neural-anthropometerA Neural Anthropometer Learning from Body Dimensions Computed on Human 3D Meshes.
Accepted to theIEEE Symposium Series on Computational Intelligence (IEEE SSCI 2021)Yansel Gonzalez TejedaandHelmut A. Mayer[Project page - TBD]Contents1. Clone and install Neural-Anthropometer2. Download Neural-Anthropometer dataset3. Or create your own synthetic data4. Training and evaluating The Neural Anthropometer5. Storage info6. Uninstalling7. Citation8. License9. Acknowledgements1. Clone and install Neural-AnthropometerBe aware that we did not list all dependencies in setup.py. Therefore, you will have to install the libraries depending on the functionality you want to obtain.1.1. HBM, Vedo and TrimeshYou need to install these three libraries:gitclonehttp://github.com/neoglez/hbm.gitcdhbm
pipinstall.

condainstall-cconda-forgevedo

pipinstalltrimeshsklearnmatplotlib1.2. Install the Neural-Anthropometergitclonehttp://github.com/neoglez/neural-anthropometer.gitcdneural-anthropometer
pipinstall.2. Download Neural-Anthropometer datasetDownload from our cloud (see bellow).DatasetDownload Linksha256sumPasswordNeural-Anthropometer (full)NeuralAnthropometer.tar.gz7fe685fa21988a5dfcf567cdc18bee208f99e37ef44bef1d239aa720e219c47ena-datasetUnpack the dataset and place it directly under the folderneural-anthropometer.tar-xfneural-anthropometer.tar.gz
mvdataset/*~/your-path/neural-anthropometer/dataset/The general structure of the folders must be:neural-anthropometer/dataset/
---------------------annotations/# json annotations with calvis----------------------------------female/
----------------------------------male/
---------------------human_body_meshes/# generated meshes----------------------------------------pose0/# meshes in pose 0--------------------------------------------female/
--------------------------------------------male/
----------------------------------------pose1/# meshes in pose 1--------------------------------------------female/
--------------------------------------------male/
---------------------synthetic_images/# synthetic greyscale images (200x200x1)----------------------------------------200x200/
----------------------------------------------pose0/
------------------------------------------------female/
------------------------------------------------male/
----------------------------------------------pose1/
------------------------------------------------female/
------------------------------------------------male/3. Or create your own synthetic dataBe aware that we did not list the dependencies in setup.py. Therefore, you will have to install the libraries depending on the functionality you want to obtain.3.1. PreparationPlease consider that in all cases, we install dependencies into a conda environment. The code was tested under ubuntu 20.04 with python 3.8.Install pytorch. We recommend using CUDA. CPU will run as well but it will take much longer.You need to install these libraries:pipinstallchumpy3.1.1. SMPL dataYou need to download SMPL data fromhttp://smpl.is.tue.mpg.dein order to run the synthetic data generation code. Once you register and agree on SMPL license terms, you will have access to downloads. Note that there are several downloads.We use SMPL version 1.0.0(python version is not relevant).Download and unpack.unzip  SMPL_python_v.1.0.0.zipYou will have the following files:basicModel_f_lbs_10_207_0_v1.0.0.pkl
basicmodel_m_lbs_10_207_0_v1.0.0.pklPlace the basic models (two files) underneural-antropometer/datageneration/datafolder.mvsmpl/models/*.pkl~/your-path/neural-anthropometer/datageneration/data/The folder structure should be as follows.neural-anthropometer/datageneration/data/
------------------------------------- basicModel_f_lbs_10_207_0_v1.0.0.pkl
------------------------------------- basicmodel_m_lbs_10_207_0_v1.0.0.pkl3.1.2. Mesh synthesisTo synthesize the meshes, open and rungenerate/generate_6000_meshes_with_smpl_total_random.pyin your preferred IDE (we use VSCode/Spyder).3.1.3. Synthetic images with BlenderBuilding Blender is a painful process. We used Blender 2.91.0 Alphawith python 3.7. Wheel mercifully provided byhttps://github.com/TylerGubala/blenderpy/releases/tag/v2.91a0if you are working already under python 3.7, skip this step!create conda environment with python 3.7, install dependencies (pytorch) and The Neural Anthropometer as described in 1.conda deactivate
conda create -n napy37 python=3.7
conda activate napy37
pip install mathutils trimesh scipy matplotlib
conda install -c conda-forge vedo
cd /your-path/hbm
pip install .
cd /your-path/neural-anthropometer
pip install .To install bpy, follow the instructions given athttps://github.com/TylerGubala/blenderpy/releases/tag/v2.91a0Open and runsynthesize/synthesize_na_200x200_grayscale_images.pyin your preferred IDE (we use VSCode/Spyder).The process takes several minutes.if you are working under python 3.7, skip this step!Return to default environment:conda deactivate
conda activate your-na-default3.2. Annotating with Sharmeam (SHoulder width, ARM length and insEAM) and CalvisYou need to install shapely, rtree and Calvis:pipinstallshapelyrtree
gitclonehttps://github.com/neoglez/calviscdcalvis
pipinstall.3.2.1. Calculating eight Human Body Dimensions (HBDs): shoulder width, right and left arm length, inseam; chest, waist and pelvis circumference, and height.Open and runannotate/annotate_with_Sharmeam_and_Calvis.pyin your preferred IDE (we use VSCode/Spyder).
The process takes several hours.3.2.2. Optional: visualize the eight Human Body Dimensions (HBDs): shoulder width, right and left arm length, inseam; chest, waist and pelvis circumference, and height.To visualize at which points Sharmeam and Calvis are calculating the HBDs, open and runneural-antropometer/display/display_subject_sharmean_and_calvis_with_vedo_and_trimesh.pyor directly display it with colab.Note: To display the meshes in the browser, we use k3d backend. Install it withcondainstall-cconda-forgek3d4. Training and evaluating The Neural AnthropometerAt this point you should have the input (synthetic images) and the supervision signal (human body dimensions annotations). Here, we provide code to train and evaluate The Neural Anthropometer on the synthetic data to predict given the input eight human body dimensions: shoulder width, right and left arm length, chest, waist and pelvis circumference and height.Both training and inference can be directly displayed in colab (work in progress).4.1. Preparation4.1.1. RequirementsInstallpytorch. We recommend usingCUDA. CPU will run as well but it will take much longer.Install scikit-learn, SciPy and its image processing routinespipinstallscikit-learn
pipinstallanacondascipy
pipinstallscikit-image4.2. TrainingTested on Linux (Ubuntu 20.04) with cuda 10.2 on a GeForce GTX 1060 6GB graphic cardTo train and evaluate The Neural Anthropometer, open and runexperiments/experiment_1_input_all_test_all_save_results.pyin your preferred IDE.4.3. InferenceTo perform inference with The Neural Anthropometer, open and runexperiments/load_and_make_inference_na_and_make_grid.pyin your preferred IDE.By running the above script, a 4-instance minibatch will be displayed. We generate the figure with matplotlib and latex.
In the generated figure the instances (synthetic pictures) and inference results (tables with HBDs) are overlapped, making the figure look messy and broken. Just maximize the window and the figure will be displayed correctly.Important: as of Matplotlib 3.2.1, you also need the package cm-super (seehttps://github.com/matplotlib/matplotlib/issues/16911).On linux, install it with:sudo apt install cm-superAbbreviations used in the figure:AbbreviationHuman Body Dimension (HBD)CCChest CircumferenceHHeightIInseamLALLeft Arm LengthPCPelvis CircumferenceRALRight Arm LengthSWShoulder WidthWCWaist Circumference5. Storage infoDataset.tar.gzfile12000 Meshes12000 (200x200x1) Synthetic imagesAnnotationsTotalNeural Anthropometer1.9 GB4.9 GB160.6 MB4.4 MB~5 GB6. Uninstallingpip uninstall neural_anthropometer7. CitationIf you use this code, please cite the following:@INPROCEEDINGS{9660069,
  author={Gonzalez Tejeda, Yansel and Mayer, Helmut A.},
  booktitle={2021 IEEE Symposium Series on Computational Intelligence (SSCI)}, 
  title={A Neural Anthropometer Learning from Body Dimensions Computed on Human 3D Meshes}, 
  year={2021},
  volume={},
  number={},
  pages={1-8},
  doi={10.1109/SSCI50451.2021.9660069}}8. LicensePlease check thelicense termsbefore downloading and/or using the code, the models and the data.9. AcknowledgementsTheSMPL teamfor providing us with the learned human body templates and the SMPL code.Thevedo team(specially Marco Musy) and thetrimesh team(specially Michael Dawson-Haggerty) for the great visualization and intersection libraries.