From f34be067775cd345888aa61cd19f6553176e9fde Mon Sep 17 00:00:00 2001 From: juxuan27 Date: Sun, 17 Jul 2022 23:47:36 +0800 Subject: [PATCH] fix: only consider 14 joints for 3DPW-3D --- README.md | 7 +- lib/core/evaluate_config.py | 6 +- lib/core/train_config.py | 6 +- lib/core/visualize_config.py | 6 +- lib/dataset/pw3d_dataset.py | 12 ++- lib/visualize/visualize_skeleton.py | 138 ++++++++++++---------------- 6 files changed, 84 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index 83d6310..b96a0b5 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,10 @@ Please refer to our supplementary materials to check the cross-model validation | MPI-INF-3DHP | VIBE* | 92.39/87.57 | 22.37/6.5 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| | MuPoTS | TposeNet* | 103.33/100.78 | 12.7/7.23 | [checkpoint](data/checkpoints/aist_vibe_3D/checkpoint_32.pth.tar) / [config](configs/aist_vibe_3D.yaml) | | MuPoTS | TposeNet+RefineNet* | 93.97/91.78 | 9.53/7.21 | [checkpoint](data/checkpoints/aist_vibe_3D/checkpoint_32.pth.tar) / [config](configs/aist_vibe_3D.yaml) | -| 3DPW | EFT | 81.60/79.48 | 29.03/5.44 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| -| 3DPW | PARE | 71.80/71.11 | 22.77/5.31 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| -| 3DPW | SPIN | 87.58/86.67 | 30.84/5.53 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| +| 3DPW | EFT | 90.32/88.40 | 32.71/6.07 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| +| 3DPW | EFT | 90.32/86.39 | 32.71/6.30 | [checkpoint](data/checkpoints/pw3d_eft_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)(additional training)| +| 3DPW | PARE | 78.91/78.11 | 25.64/5.91 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| +| 3DPW | SPIN | 96.85/95.84 | 34.55/6.17 | [checkpoint](data/checkpoints/pw3d_spin_3D/checkpoint_32.pth.tar) / [config](configs/pw3d_spin_3D.yaml)| | 3DPW | TCMR* | 86.46/86.48 | 6.76/5.95 | [checkpoint](data/checkpoints/h36m_fcn_3D/checkpoint_32.pth.tar) / [config](configs/h36m_fcn_3D.yaml)| | 3DPW | VIBE* | 82.97/81.49 | 23.16/5.98 | [checkpoint](data/checkpoints/h36m_fcn_3D/checkpoint_32.pth.tar) / [config](configs/h36m_fcn_3D.yaml)| diff --git a/lib/core/evaluate_config.py b/lib/core/evaluate_config.py index 673b055..5f8388c 100644 --- a/lib/core/evaluate_config.py +++ b/lib/core/evaluate_config.py @@ -44,9 +44,9 @@ cfg.DATASET.ROOT_MPIINF3DHP_VIBE_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENET_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENETREFINENET_3D=[14] -cfg.DATASET.ROOT_PW3D_EFT_3D=[0] -cfg.DATASET.ROOT_PW3D_PARE_3D=[0] -cfg.DATASET.ROOT_PW3D_SPIN_3D=[0] +cfg.DATASET.ROOT_PW3D_EFT_3D=[2,3] +cfg.DATASET.ROOT_PW3D_PARE_3D=[2,3] +cfg.DATASET.ROOT_PW3D_SPIN_3D=[2,3] cfg.DATASET.ROOT_PW3D_TCMR_3D=[2,3] cfg.DATASET.ROOT_PW3D_VIBE_3D=[2,3] cfg.DATASET.ROOT_H36M_MIX_3D=[0] diff --git a/lib/core/train_config.py b/lib/core/train_config.py index 790a377..3379df7 100644 --- a/lib/core/train_config.py +++ b/lib/core/train_config.py @@ -44,9 +44,9 @@ cfg.DATASET.ROOT_MPIINF3DHP_VIBE_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENET_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENETREFINENET_3D=[14] -cfg.DATASET.ROOT_PW3D_EFT_3D=[0] -cfg.DATASET.ROOT_PW3D_PARE_3D=[0] -cfg.DATASET.ROOT_PW3D_SPIN_3D=[0] +cfg.DATASET.ROOT_PW3D_EFT_3D=[2,3] +cfg.DATASET.ROOT_PW3D_PARE_3D=[2,3] +cfg.DATASET.ROOT_PW3D_SPIN_3D=[2,3] cfg.DATASET.ROOT_PW3D_TCMR_3D=[2,3] cfg.DATASET.ROOT_PW3D_VIBE_3D=[2,3] cfg.DATASET.ROOT_H36M_MIX_3D=[0] diff --git a/lib/core/visualize_config.py b/lib/core/visualize_config.py index 2626853..f97c895 100644 --- a/lib/core/visualize_config.py +++ b/lib/core/visualize_config.py @@ -44,9 +44,9 @@ cfg.DATASET.ROOT_MPIINF3DHP_VIBE_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENET_3D=[14] cfg.DATASET.ROOT_MUPOTS_TPOSENETREFINENET_3D=[14] -cfg.DATASET.ROOT_PW3D_EFT_3D=[0] -cfg.DATASET.ROOT_PW3D_PARE_3D=[0] -cfg.DATASET.ROOT_PW3D_SPIN_3D=[0] +cfg.DATASET.ROOT_PW3D_EFT_3D=[2,3] +cfg.DATASET.ROOT_PW3D_PARE_3D=[2,3] +cfg.DATASET.ROOT_PW3D_SPIN_3D=[2,3] cfg.DATASET.ROOT_PW3D_TCMR_3D=[2,3] cfg.DATASET.ROOT_PW3D_VIBE_3D=[2,3] cfg.DATASET.ROOT_H36M_MIX_3D=[0] diff --git a/lib/dataset/pw3d_dataset.py b/lib/dataset/pw3d_dataset.py index 1413358..0e8d947 100644 --- a/lib/dataset/pw3d_dataset.py +++ b/lib/dataset/pw3d_dataset.py @@ -4,7 +4,8 @@ import bisect from lib.utils.geometry_utils import * - +H36M_TO_J17 = [6, 5, 4, 1, 2, 3, 16, 15, 14, 11, 12, 13, 8, 10, 0, 7, 9] +J17_TO_J14 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] class PW3DDataset(BaseDataset): def __init__(self, cfg, estimator='spin', return_type='3D', phase='train'): @@ -153,6 +154,10 @@ def get_data(self, index): pred_data = self.detected_data_joints_3d[position].reshape( ground_truth_data_len, -1, 3) + if self.estimator in ["eft","spin","pare"]: + gt_data=gt_data[:, H36M_TO_J17, :][:, J17_TO_J14, :] + pred_data=pred_data[:, H36M_TO_J17, :][:, J17_TO_J14, :] + gt_data = gt_data.reshape(ground_truth_data_len, -1) pred_data = pred_data.reshape(ground_truth_data_len, -1) @@ -208,6 +213,11 @@ def get_test_data(self, index): pred_data = self.detected_data_joints_3d[index].reshape( ground_truth_data_len, -1, 3) + if self.estimator in ["eft","spin","pare"]: + gt_data=gt_data[:, H36M_TO_J17, :][:, J17_TO_J14, :] + pred_data=pred_data[:, H36M_TO_J17, :][:, J17_TO_J14, :] + + gt_data = gt_data.reshape(ground_truth_data_len, -1) pred_data = pred_data.reshape(ground_truth_data_len, -1) diff --git a/lib/visualize/visualize_skeleton.py b/lib/visualize/visualize_skeleton.py index c34c035..1f3735f 100644 --- a/lib/visualize/visualize_skeleton.py +++ b/lib/visualize/visualize_skeleton.py @@ -573,124 +573,106 @@ PW3D_EFT_3D_EDGES = [ - [0, 7, 0], - [7, 8, 0], - [8, 9, 0], - [9, 10, 0], - [8, 11, 0], - [11, 12, 0], - [12, 13, 0], [0, 1, 0], - [1, 2, 0], - [2, 3, 0], - [8, 14, 1], - [14, 15, 1], - [15, 16, 1], - [0, 4, 1], - [4, 5, 1], - [5, 6, 1], - + [1, 2, 0], + [2, 8, 0], + [3, 9, 1], + [4, 3, 1], + [5, 4, 1], + [6, 7, 0], + [7, 8, 0], + [8, 12, 0], + [9, 12, 1], + [10, 9, 1], + [11, 10, 1], + [12, 13, 1], + ] PW3D_EFT_3D_JOINTS = [ [0, 0], [1, 0], [2, 0], - [3, 0], + [3, 1], [4, 1], [5, 1], - [6, 1], + [6, 0], [7, 0], [8, 0], - [9, 0], - [10, 0], - [11, 0], - [12, 0], - [13, 0], - [14, 1], - [15, 1], - [16, 1], + [9, 1], + [10, 1], + [11, 1], + [12, 1], + [13, 1], ] PW3D_PARE_3D_EDGES = [ - [0, 7, 0], - [7, 8, 0], - [8, 9, 0], - [9, 10, 0], - [8, 11, 0], - [11, 12, 0], - [12, 13, 0], [0, 1, 0], - [1, 2, 0], - [2, 3, 0], - [8, 14, 1], - [14, 15, 1], - [15, 16, 1], - [0, 4, 1], - [4, 5, 1], - [5, 6, 1], - + [1, 2, 0], + [2, 8, 0], + [3, 9, 1], + [4, 3, 1], + [5, 4, 1], + [6, 7, 0], + [7, 8, 0], + [8, 12, 0], + [9, 12, 1], + [10, 9, 1], + [11, 10, 1], + [12, 13, 1], + ] PW3D_PARE_3D_JOINTS = [ [0, 0], [1, 0], [2, 0], - [3, 0], + [3, 1], [4, 1], [5, 1], - [6, 1], + [6, 0], [7, 0], [8, 0], - [9, 0], - [10, 0], - [11, 0], - [12, 0], - [13, 0], - [14, 1], - [15, 1], - [16, 1], + [9, 1], + [10, 1], + [11, 1], + [12, 1], + [13, 1], ] PW3D_SPIN_3D_EDGES = [ - [0, 7, 0], - [7, 8, 0], - [8, 9, 0], - [9, 10, 0], - [8, 11, 0], - [11, 12, 0], - [12, 13, 0], [0, 1, 0], - [1, 2, 0], - [2, 3, 0], - [8, 14, 1], - [14, 15, 1], - [15, 16, 1], - [0, 4, 1], - [4, 5, 1], - [5, 6, 1], - + [1, 2, 0], + [2, 8, 0], + [3, 9, 1], + [4, 3, 1], + [5, 4, 1], + [6, 7, 0], + [7, 8, 0], + [8, 12, 0], + [9, 12, 1], + [10, 9, 1], + [11, 10, 1], + [12, 13, 1], + ] PW3D_SPIN_3D_JOINTS = [ [0, 0], [1, 0], [2, 0], - [3, 0], + [3, 1], [4, 1], [5, 1], - [6, 1], + [6, 0], [7, 0], [8, 0], - [9, 0], - [10, 0], - [11, 0], - [12, 0], - [13, 0], - [14, 1], - [15, 1], - [16, 1], + [9, 1], + [10, 1], + [11, 1], + [12, 1], + [13, 1], ]