项目作者: pvnieo

项目描述 :
A Pytorch implementation of: "Deep Functional Maps: Structured Prediction for Dense Shape Correspondence"
高级语言: Python
项目地址: git://github.com/pvnieo/FMNet-pytorch.git
创建时间: 2020-05-03T13:59:46Z
项目社区:https://github.com/pvnieo/FMNet-pytorch

开源协议:MIT License

下载


FMNet-pytorch

A pytorch implementation of: “Deep Functional Maps: Structured Prediction for Dense Shape Correspondence” [link]

Installation

This implementation runs on python >= 3.7, use pip to install dependencies:

  1. pip3 install -r requirements.txt

Download data & preprocessing

Download the desired dataset and put it in the data folder. Multiple datasets are available here.

An example with the faust-remeshed dataset is provided.

Build shot calculator:

  1. cd fmnet/utils/shot
  2. cmake .
  3. make

If you got any errors in compiling shot, please see here.

Use fmnet/preprocess.py to calculate the Laplace decomposition, geodesic distance using the Dijkstra algorithm and the shot descriptors of input shapes, data are saved in .mat format:

  1. usage: preprocess.py [-h] [-d DATAROOT] [-sd SAVE_DIR] [-ne NUM_EIGEN] [-nj NJOBS] [--nn NN]
  2. Preprocess data for FMNet training. Compute Laplacian eigen decomposition, shot features, and geodesic distance for each shape.
  3. optional arguments:
  4. -h, --help show this help message and exit
  5. -d DATAROOT, --dataroot DATAROOT
  6. root directory of the dataset
  7. -sd SAVE_DIR, --save-dir SAVE_DIR
  8. root directory to save the processed dataset
  9. -ne NUM_EIGEN, --num-eigen NUM_EIGEN
  10. number of eigenvectors kept.
  11. -nj NJOBS, --njobs NJOBS
  12. Number of parallel processes to use.
  13. --nn NN Number of Neighbor to consider when computing geodesic matrix.

NB: if the shapes have many vertices, the computation of geodesic distance will consume a lot of memory and take a lot of time.

Usage

Use the train.py script to train the FMNet network.

  1. usage: train.py [-h] [--lr LR] [--b1 B1] [--b2 B2] [-bs BATCH_SIZE] [--n-epochs N_EPOCHS] [--dim-basis DIM_BASIS] [-nv N_VERTICES] [-nb NUM_BLOCKS] [-d DATAROOT] [--save-dir SAVE_DIR] [--n-cpu N_CPU]
  2. [--no-cuda] [--checkpoint-interval CHECKPOINT_INTERVAL] [--log-interval LOG_INTERVAL]
  3. Launch the training of FMNet model.
  4. optional arguments:
  5. -h, --help show this help message and exit
  6. --lr LR adam: learning rate
  7. --b1 B1 adam: decay of first order momentum of gradient
  8. --b2 B2 adam: decay of first order momentum of gradient
  9. -bs BATCH_SIZE, --batch-size BATCH_SIZE
  10. size of the batches
  11. --n-epochs N_EPOCHS number of epochs of training
  12. --dim-basis DIM_BASIS
  13. number of eigenvectors used for representation.
  14. -nv N_VERTICES, --n-vertices N_VERTICES
  15. Number of vertices used per shape
  16. -nb NUM_BLOCKS, --num-blocks NUM_BLOCKS
  17. number of resnet blocks
  18. -d DATAROOT, --dataroot DATAROOT
  19. root directory of the dataset
  20. --save-dir SAVE_DIR root directory of the dataset
  21. --n-cpu N_CPU number of cpu threads to use during batch generation
  22. --no-cuda Disable GPU computation
  23. --checkpoint-interval CHECKPOINT_INTERVAL
  24. interval between model checkpoints
  25. --log-interval LOG_INTERVAL
  26. interval between logging train information

Example

  1. python3 train.py -bs 4 --n-epochs 10