Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammed Kocabas committed Oct 13, 2021
1 parent 6e0caca commit fa90aff
Show file tree
Hide file tree
Showing 64 changed files with 660 additions and 3,585 deletions.
226 changes: 18 additions & 208 deletions pare/core/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

import os
import time
import yaml
Expand All @@ -18,225 +34,43 @@
DATASET_NPZ_PATH = 'data/dataset_extras'
DATASET_LMDB_PATH = 'data/lmdb'

# H36M_ROOT = 'data/dataset_folders/h36m'
# LSP_ROOT = 'data/dataset_folders/lsp'
# LSP_ORIGINAL_ROOT = 'data/dataset_folders/lsp_original'
# LSPET_ROOT = 'data/dataset_folders/hr-lspet'
# MPII_ROOT = 'data/dataset_folders/mpii'
# COCO_ROOT = 'data/dataset_folders/coco'
# MPI_INF_3DHP_ROOT = 'data/dataset_folders/mpi_inf_3dhp'
# OCHUMAN_ROOT = 'data/dataset_folders/ochuman'
# CROWDPOSE_ROOT = 'data/dataset_folders/crowdpose'
# AICH_ROOT = 'data/dataset_folders/aich'

PW3D_ROOT = 'data/dataset_folders/3dpw'
# UPI_S1H_ROOT = ''
# EFT_ROOT = 'data/dataset_folders/eft'
# PASCAL_ROOT = '/ps/project/datasets/VOCdevkit/VOC2012'
OH3D_ROOT = 'data/dataset_folders/3doh'
# MUCO3DHP_ROOT = 'data/dataset_folders/muco3dhp'
# AGORA_CAM_ROOT = 'data/dataset_folders/agora'
# AGORA_CAM_V2_ROOT = 'data/dataset_folders/agora_cam_v2'
# EHF_ROOT = 'data/dataset_folders/ehf'
# MANNEQUIN_ROOT = ''
# QUALITATIVE_ROOT = 'data/dataset_folders/sample_perspective_images'
# MTP_ROOT = 'data/dataset_folders/mtp'

# CUBE_PARTS_FILE = 'data/cube_parts.npy'

JOINT_REGRESSOR_TRAIN_EXTRA = 'data/J_regressor_extra.npy'
JOINT_REGRESSOR_H36M = 'data/J_regressor_h36m.npy'
# VERTEX_TEXTURE_FILE = 'data/vertex_texture.npy'
# STATIC_FITS_DIR = 'data/static_fits'
SMPL_MEAN_PARAMS = 'data/smpl_mean_params.npz'
SMPL_MODEL_DIR = 'data/body_models/smpl'
# SMPLX_MODEL_DIR = 'data/body_models/smplx'
COCO_OCCLUDERS_FILE = 'data/occlusion_augmentation/coco_train2014_occluders.pkl'
PASCAL_OCCLUDERS_FILE = 'data/occlusion_augmentation/pascal_occluders.pkl'

# OPENPOSE_PATH = 'datasets/openpose'
# MMPOSE_PATH = '/is/cluster/work/mkocabas/projects/mmpose'
# MMDET_PATH = '/is/cluster/work/mkocabas/projects/mmdetection'
# MMPOSE_CFG = os.path.join(MMPOSE_PATH, 'configs/top_down/hrnet/coco-wholebody/hrnet_w48_coco_wholebody_256x192.py')
# MMPOSE_CKPT = os.path.join(MMPOSE_PATH, 'checkpoints/hrnet_w48_coco_wholebody_256x192-643e18cb_20200922.pth')
# MMDET_CFG = os.path.join(MMDET_PATH, 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py')
# MMDET_CKPT = os.path.join(MMDET_PATH, 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth')

DATASET_FOLDERS = {
# 'h36m': H36M_ROOT,
# 'h36m-p1': H36M_ROOT,
# 'h36m-p2': H36M_ROOT,
# 'lsp-orig': LSP_ORIGINAL_ROOT,
# 'lsp': LSP_ROOT,
# 'lspet': LSPET_ROOT,
# 'mpi-inf-3dhp': MPI_INF_3DHP_ROOT,
# 'mpii': MPII_ROOT,
# 'coco': COCO_ROOT,
# 'coco-cam-camreg': COCO_ROOT,
# 'coco-campose-camreg': COCO_ROOT,
# 'coco-cam-scalenet': COCO_ROOT,
# 'coco-campose-scalenet': COCO_ROOT,
'3dpw': PW3D_ROOT,
'3dpw-val': PW3D_ROOT,
'3dpw-val-cam': PW3D_ROOT,
'3dpw-test-cam': PW3D_ROOT,
'3dpw-train-cam': PW3D_ROOT,
'3dpw-cam': PW3D_ROOT,
'3dpw-all': PW3D_ROOT,
# 'upi-s1h': UPI_S1H_ROOT,
'3doh': OH3D_ROOT,
# 'ochuman': OCHUMAN_ROOT,
# 'crowdpose': CROWDPOSE_ROOT,
# 'aich': AICH_ROOT,
# 'muco3dhp': MUCO3DHP_ROOT,
# 'agora-cam': AGORA_CAM_ROOT,
# 'agora-cam-v2': AGORA_CAM_V2_ROOT,
# 'ehf': EHF_ROOT,
# 'mannequin': MANNEQUIN_ROOT,
# 'qualitative': QUALITATIVE_ROOT,
# 'coco-high-pitch': COCO_ROOT,
# 'mtp': MTP_ROOT,
# 'mtp-v2': MTP_ROOT,
}

DATASET_FILES = [
# Training
{
# 'h36m-p1': join(DATASET_NPZ_PATH, 'h36m_valid_protocol1.npz'),
# 'h36m-p2': join(DATASET_NPZ_PATH, 'h36m_valid_protocol2_scaled.npz'),
# 'lsp': join(DATASET_NPZ_PATH, 'lsp_dataset_test.npz'),
# 'mpii': join(DATASET_NPZ_PATH, 'mpii_test.npz'),
# 'coco': join(DATASET_NPZ_PATH, 'coco_test.npz'),
# 'mpi-inf-3dhp': join(DATASET_NPZ_PATH, 'mpi_inf_3dhp_test_fixed.npz'),
# '3dpw': join(DATASET_NPZ_PATH, '3dpw_test_with_mmpose.npz'),
# '3dpw-val': join(DATASET_NPZ_PATH, '3dpw_validation.npz'),
# '3dpw-val-cam': join(DATASET_NPZ_PATH, '3dpw_validation_0yaw_inverseyz.npz'), # join(DATASET_NPZ_PATH, '3dpw_validation_cam.npz'),
# '3dpw-test-cam': join(DATASET_NPZ_PATH, '3dpw_test_0yaw_inverseyz.npz'),
# '3dpw-cam': join(DATASET_NPZ_PATH, '3dpw_cam_0yaw_inverseyz.npz'),
'3dpw-all': join(DATASET_NPZ_PATH, '3dpw_all_test_with_mmpose.npz'),
'3doh': join(DATASET_NPZ_PATH, '3doh_test.npz'),
# 'agora-cam': join(DATASET_NPZ_PATH, 'agora_cam_train_fixed.npz'),
# 'agora-cam-v2': join(DATASET_NPZ_PATH, 'agora_cam_v2_test.npz'),
# 'ehf': join(DATASET_NPZ_PATH, 'ehf_test.npz'),
# 'mannequin': join(DATASET_NPZ_PATH, 'mannequin_validation.npz'),
# 'qualitative': join(DATASET_NPZ_PATH, 'qualitative.npz'),
# 'coco-high-pitch': join(DATASET_NPZ_PATH, 'coco_test_high_pitch.npz'),
# 'mtp': join(DATASET_NPZ_PATH, 'mtp_pose_cam_test.npz'),
# 'mtp-v2': join(DATASET_NPZ_PATH, 'mtp_pose_cam_test_v2.npz'),
},
# Testing
{
# 'h36m': join(DATASET_NPZ_PATH, 'h36m_train_scaled_wo_S1.npz'),
# 'lsp-orig': join(DATASET_NPZ_PATH, 'lsp_dataset_original_train.npz'),
# 'mpii': join(DATASET_NPZ_PATH, 'mpii_train_eft.npz'),
# 'coco': join(DATASET_NPZ_PATH, 'coco_2014_train_eft.npz'),
# 'lspet': join(DATASET_NPZ_PATH, 'hr-lspet_train_eft.npz'),
# 'mpi-inf-3dhp': join(DATASET_NPZ_PATH, 'mpi_inf_3dhp_train.npz'),
'3doh': join(DATASET_NPZ_PATH, '3doh_train.npz'),
# 'ochuman': join(DATASET_NPZ_PATH, 'ochuman_train.npz'),
# 'crowdpose': join(DATASET_NPZ_PATH, 'crowdpose_train.npz'),
# 'muco3dhp': join(DATASET_NPZ_PATH, 'muco3dhp_train.npz'),
# 'agora-cam': join(DATASET_NPZ_PATH, 'agora_cam_train_fixed.npz'),
# 'agora-cam-v2': join(DATASET_NPZ_PATH, 'agora_cam_v2_train.npz'),
# 'mannequin': join(DATASET_NPZ_PATH, 'mannequin_train.npz'),
# 'coco-cam-camreg': join(DATASET_NPZ_PATH, 'coco_train_eft_camreg_cam.npz'),
# 'coco-campose-camreg': join(DATASET_NPZ_PATH, 'coco_train_eft_camreg_campose.npz'),
# 'coco-cam-scalenet': join(DATASET_NPZ_PATH, 'coco_train_eft_scalenet_cam.npz'),
# 'coco-campose-scalenet': join(DATASET_NPZ_PATH, 'coco_train_eft_scalenet_campose.npz'),
# '3dpw-train-cam': join(DATASET_NPZ_PATH, '3dpw_train_0yaw_inverseyz.npz'),
'3dpw': join(DATASET_NPZ_PATH, '3dpw_train.npz'),
}
]

# LMDB_FILES = [
# {
# 'h36m-p1': join(DATASET_LMDB_PATH, 'h36m-p2_test'),
# 'h36m-p2': join(DATASET_LMDB_PATH, 'h36m-p2_test'),
# 'lsp': join(DATASET_LMDB_PATH, ''),
# 'mpii': join(DATASET_LMDB_PATH, 'mpii_test'),
# 'mpi-inf-3dhp': join(DATASET_LMDB_PATH, 'mpi-inf-3dhp_test'),
# '3dpw': join(DATASET_LMDB_PATH, '3dpw-all_test'),
# '3dpw-all': join(DATASET_LMDB_PATH, '3dpw-all_test'),
# '3doh': join(DATASET_LMDB_PATH, '3doh_test'),
# },
# {
# 'h36m': join(DATASET_LMDB_PATH, 'h36m_train'),
# 'lsp-orig': join(DATASET_LMDB_PATH, ''),
# 'mpii': join(DATASET_LMDB_PATH, 'mpii_train'),
# 'coco': join(DATASET_LMDB_PATH, 'coco_train'),
# 'lspet': join(DATASET_LMDB_PATH, 'lspet_train'),
# 'mpi-inf-3dhp': join(DATASET_LMDB_PATH, 'mpi-inf-3dhp_train'),
# '3doh': join(DATASET_LMDB_PATH, '3doh_train'),
# }
# ]

EVAL_MESH_DATASETS = ['3dpw', '3dpw-val', '3dpw-all', '3doh']

# CAM_PARAM_FOLDERS = {
# 'coco': {
# 'scalenet': 'data/cam_param_folders/scalenet/coco',
# 'camreg': 'data/cam_param_folders/camreg/coco',
# },
# 'mtp': {
# 'scalenet': 'data/cam_param_folders/scalenet/mtp',
# 'camreg': 'data/cam_param_folders/camreg/mtp',
# },
# 'mtp-v2': {
# 'scalenet': 'data/cam_param_folders/scalenet/mtp',
# 'camreg': 'data/cam_param_folders/camreg/mtp',
# },
# 'qualitative': {
# 'scalenet': 'data/cam_param_folders/scalenet/qualitative',
# 'camreg': 'data/cam_param_folders/camreg/qualitative',
# },
# 'coco-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/coco',
# 'camreg': 'data/cam_param_folders/camreg/coco',
# },
# 'coco-high-pitch': {
# 'scalenet': 'data/cam_param_folders/scalenet/coco',
# 'camreg': 'data/cam_param_folders/camreg/coco',
# },
# 'mpii': {
# 'scalenet': 'data/cam_param_folders/scalenet/mpii',
# 'camreg': 'data/cam_param_folders/camreg/mpii',
# },
# 'lsp': {
# 'scalenet': 'data/cam_param_folders/scalenet/lsp',
# 'camreg': 'data/cam_param_folders/camreg/lsp',
# },
# '3dpw': {
# 'scalenet': 'data/cam_param_folders/scalenet/3dpw',
# 'camreg': 'data/cam_param_folders/camreg/3dpw',
# },
# '3dpw-val-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/3dpw',
# 'camreg': 'data/cam_param_folders/camreg/3dpw',
# },
# '3dpw-test-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/3dpw',
# 'camreg': 'data/cam_param_folders/camreg/3dpw',
# },
# '3dpw-train-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/3dpw',
# 'camreg': 'data/cam_param_folders/camreg/3dpw',
# },
# '3dpw-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/3dpw',
# 'camreg': 'data/cam_param_folders/camreg/3dpw',
# },
# 'agora-cam': {
# 'scalenet': 'data/cam_param_folders/scalenet/agora_cam',
# 'camreg': 'data/cam_param_folders/camreg/agora_cam',
# },
# 'agora-cam-v2': {
# 'scalenet': 'data/cam_param_folders/scalenet/agora_cam_v2',
# 'camreg': 'data/cam_param_folders/camreg/agora_cam_v2',
# },
# 'mannequin': {
# 'scalenet': 'data/cam_param_folders/scalenet/mannequin',
# 'camreg': 'data/cam_param_folders/camreg/mannequin',
# },
# }

##### CONFIGS #####
hparams = CN()

Expand Down Expand Up @@ -280,12 +114,6 @@
hparams.DATASET.OCC_AUG_DATASET = 'pascal'
hparams.DATASET.USE_3D_CONF = False
hparams.DATASET.USE_GENDER = False
# hparams.DATASET.CAM_PARAM_TYPE = 'camreg'
# hparams.DATASET.BASELINE_CAM_ROT = False
# hparams.DATASET.BASELINE_CAM_F = False
# hparams.DATASET.BASELINE_CAM_C = False
# hparams.DATASET.TEACHER_FORCE = 0.0
# hparams.DATASET.TEACHER_FORCE_SCHEDULE = '' # sample: '0+0.0 50+0.5 100+1.0'
# this is a bit confusing but for the in the wild dataset ratios should be same, otherwise the code
# will be a bit verbose
hparams.DATASET.DATASETS_AND_RATIOS = 'h36m_mpii_lspet_coco_mpi-inf-3dhp_0.3_0.6_0.6_0.6_0.1'
Expand Down Expand Up @@ -385,24 +213,6 @@
hparams.PARE.USE_MEAN_POSE = False
hparams.PARE.INIT_XAVIER = False

# SPIN method hparams
# hparams.SPIN = CN()
# hparams.SPIN.BACKBONE = 'resnet50'
# hparams.SPIN.ESTIMATE_UNCERTAINTY = False
# hparams.SPIN.USE_SEPARATE_VAR_BRANCH = False
# hparams.SPIN.USE_CAM_FEATS = False
# hparams.SPIN.UNCERTAINTY_LOSS = 'MultivariateGaussianNegativeLogLikelihood' # AleatoricLoss
# hparams.SPIN.UNCERTAINTY_ACTIVATION = ''
# hparams.SPIN.SHAPE_LOSS_WEIGHT = 0
# hparams.SPIN.KEYPOINT_LOSS_WEIGHT = 5.
# hparams.SPIN.KEYPOINT_NATIVE_LOSS_WEIGHT = 5.
# hparams.SPIN.SMPL_PART_LOSS_WEIGHT = 1.
# hparams.SPIN.POSE_LOSS_WEIGHT = 1.
# hparams.SPIN.BETA_LOSS_WEIGHT = 0.001
# hparams.SPIN.OPENPOSE_TRAIN_WEIGHT = 0.
# hparams.SPIN.GT_TRAIN_WEIGHT = 1.
# hparams.SPIN.LOSS_WEIGHT = 60.


def get_hparams_defaults():
"""Get a yacs hparamsNode object with default values for my_project."""
Expand Down
16 changes: 16 additions & 0 deletions pare/core/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

import numpy as np

# Mean and standard deviation for normalizing input image
Expand Down
16 changes: 16 additions & 0 deletions pare/core/tester.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

import os
import cv2
import time
Expand Down
16 changes: 16 additions & 0 deletions pare/core/trainer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

import os
import cv2
import json
Expand Down
16 changes: 16 additions & 0 deletions pare/dataset/base_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

import time
import torch
import numpy as np
Expand Down
16 changes: 16 additions & 0 deletions pare/dataset/coco_occlusion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: [email protected]

# Adapted from https://github.com/isarandi/synthetic-occlusion/blob/master/augmentation.py

#!/usr/bin/env python
Expand Down
Loading

0 comments on commit fa90aff

Please sign in to comment.