Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions configs/mvhn_100840/avatar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
mode: train
train:
dataset: MvRgbDatasetMVHumanNet
data:
subject_name: 100840
data_dir: ../MVHumanNet_plusplus/mvhumannet++_10demo/main/100840
frame_range: &id001
- 0
- 60
- 1
used_cam_ids:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 8
- 9
- 10
- 11
- 12
- 14
- 15
load_smpl_pos_map: true
pretrained_dir: null
net_ckpt_dir: ./results/100840/avatar
prev_ckpt: null
ckpt_interval:
epoch: 10
batch: 50000
eval_interval: 1000
eval_training_ids:
- 42
- 2
eval_testing_ids:
- 50
- 0
eval_img_factor: 1.0
lr_init: 0.0005
loss_weight:
l1: 1.0
lpips: 0.1
offset: 0.005
finetune_color: false
batch_size: 1
num_workers: 8
random_bg_color: true
test:
dataset: MvRgbDatasetMVHumanNet
data:
data_dir: ../MVHumanNet_plusplus/mvhumannet++_10demo/main/100840
frame_range: [0, 60]
subject_name: avatarrex_zzr
pose_data:
data_path: ../thuman4/pose_00.npz
frame_range: [2000, 2500]
# data_path: Z:/Data/Pose/AMASS/CMU/06/06_13_poses.npz
# data_path: Z:/Data/Pose/AMASS/CMU/10/10_05_poses.npz
# frame_interval: 4
view_setting: free
render_view_idx: 13
global_orient: true
img_scale: 1.0
save_mesh: false
render_skeleton: false
save_tex_map: false
save_ply: false
n_pca: 20
sigma_pca: 2.0
prev_ckpt: None
model:
with_viewdirs: true
random_style: false
46 changes: 46 additions & 0 deletions configs/mvhn_100840/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
mode: train
train:
dataset: MvRgbDatasetMVHumanNet
data:
subject_name: 100840
data_dir: ../MVHumanNet_plusplus/mvhumannet++_10demo/main/100840
frame_range: &id001
- 60
- 61
- 1
used_cam_ids: null
mode: nerf
net_ckpt_dir: ./results/100840/template
prev_ckpt: null
save_init_ckpt: false
start_epoch: 0
end_epoch: 1001
ckpt_interval:
epoch: 500
batch: 1000
eval_interval: 10000
depth_guided_sampling:
flag: false
near_sur_dist: 0.05
N_ray_samples: 32
compute_grad: true
lr:
network:
type: Step
initial: 0.0005
interval: 40000
factor: 0.9
min: 8.0e-05
loss_weight:
color: 1.0
mask: 1.0
eikonal: 0.1
batch_size: 1
num_workers: 0
model:
with_hand: true
volume_type: diff
use_root_finding: true
multires: 6
use_viewdir: false
multires_viewdir: 3
75 changes: 75 additions & 0 deletions configs/mvhn_100990/avatar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
mode: train
train:
dataset: MvRgbDatasetMVHumanNet
data:
subject_name: 100990
data_dir: ../MVHumanNet_plusplus/test/100990
frame_range: &id001
- 0
- 60
- 1
used_cam_ids:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 8
- 9
- 10
- 11
- 12
- 14
- 15
load_smpl_pos_map: true
pretrained_dir: ./results/100990/avatar/pretrained
net_ckpt_dir: ./results/100990/avatar
prev_ckpt: null
ckpt_interval:
epoch: 30
batch: 50000
eval_interval: 1000
eval_training_ids:
- 1
- 1
eval_testing_ids:
- 9
- 14
eval_img_factor: 1.0
lr_init: 0.0005
loss_weight:
l1: 1.0
lpips: 0.1
offset: 0.005
finetune_color: false
batch_size: 1
num_workers: 8
random_bg_color: true
test:
dataset: MvRgbDatasetMVHumanNet
data:
data_dir: ../MVHumanNet_plusplus/test/100990
frame_range: [0, 60]
subject_name: avatarrex_zzr
pose_data:
data_path: ../thuman4/pose_00.npz
frame_range: [2000, 2500]
# data_path: Z:/Data/Pose/AMASS/CMU/06/06_13_poses.npz
# data_path: Z:/Data/Pose/AMASS/CMU/10/10_05_poses.npz
# frame_interval: 4
view_setting: free
render_view_idx: 13
global_orient: true
img_scale: 1.0
save_mesh: false
render_skeleton: false
save_tex_map: false
save_ply: false
n_pca: 20
sigma_pca: 2.0
prev_ckpt: None
model:
with_viewdirs: true
random_style: false
46 changes: 46 additions & 0 deletions configs/mvhn_100990/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
mode: train
train:
dataset: MvRgbDatasetMVHumanNet
data:
subject_name: 100990
data_dir: ../MVHumanNet_plusplus/test/100990
frame_range: &id001
- 60
- 61
- 1
used_cam_ids: null
mode: nerf
net_ckpt_dir: ./results/100990/template
prev_ckpt: null
save_init_ckpt: false
start_epoch: 0
end_epoch: 1001
ckpt_interval:
epoch: 500
batch: 1000
eval_interval: 10000
depth_guided_sampling:
flag: false
near_sur_dist: 0.05
N_ray_samples: 32
compute_grad: true
lr:
network:
type: Step
initial: 0.0005
interval: 40000
factor: 0.9
min: 8.0e-05
loss_weight:
color: 1.0
mask: 1.0
eikonal: 0.1
batch_size: 1
num_workers: 0
model:
with_hand: true
volume_type: diff
use_root_finding: true
multires: 6
use_viewdir: false
multires_viewdir: 3
47 changes: 47 additions & 0 deletions dataset/dataset_mv_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,50 @@ def load_color_mask_images(self, pose_idx, view_idx):
color_img = cv.imread(self.data_dir + '/4x/rgbs/%s/%s_rgb%06d.jpg' % (cam_name, cam_name, pose_idx), cv.IMREAD_UNCHANGED)
mask_img = cv.imread(self.data_dir + '/4x/masks/%s/%s_mask%06d.png' % (cam_name, cam_name, pose_idx), cv.IMREAD_UNCHANGED)
return color_img, mask_img

## -------------------------------------------------- ##
## ------- NEW CLASS FOR MVHumanNet DATASET --------- ##
class MvRgbDatasetMVHumanNet(MvRgbDatasetBase):
def __init__(
self,
data_dir,
frame_range = None,
used_cam_ids = None,
training = True,
subject_name = None,
load_smpl_pos_map = False,
load_smpl_nml_map = False,
mode = '3dgs'
):
super(MvRgbDatasetMVHumanNet, self).__init__(
data_dir,
frame_range,
used_cam_ids,
training,
subject_name,
load_smpl_pos_map,
load_smpl_nml_map,
mode
)
self.img_files = sorted(os.listdir(self.data_dir + '/images/cam_00'))
self.img_file_names = [f.rstrip('.jpg') for f in self.img_files]

def load_cam_data(self):
import json
cam_data = json.load(open(self.data_dir + '/calibrations.json', 'r'))
self.view_num = len(cam_data)
self.extr_mats = []
self.cam_names = ['cam%02d' % view_idx for view_idx in range(self.view_num)]
for view_idx in range(self.view_num):
extr_mat = np.identity(4, np.float32)
extr_mat[:3, :3] = np.array(cam_data['cam_%02d' % view_idx]['R'], np.float32).reshape(3, 3)
extr_mat[:3, 3] = np.array(cam_data['cam_%02d' % view_idx]['T'], np.float32)
self.extr_mats.append(extr_mat)
self.intr_mats = [np.array(cam_data['cam_%02d' % view_idx]['K'], np.float32).reshape(3, 3) for view_idx in range(self.view_num)]
self.img_heights = [cam_data['cam_%02d' % view_idx]['imgSize'][1] for view_idx in range(self.view_num)]
self.img_widths = [cam_data['cam_%02d' % view_idx]['imgSize'][0] for view_idx in range(self.view_num)]

def load_color_mask_images(self, pose_idx, view_idx):
color_img = cv.imread(f'{self.data_dir}/images/cam_{view_idx:02d}/{self.img_file_names[pose_idx]}.jpg', cv.IMREAD_UNCHANGED)
mask_img = cv.imread(f'{self.data_dir}/masks/cam_{view_idx:02d}/{self.img_file_names[pose_idx]}.png', cv.IMREAD_UNCHANGED)
return color_img, mask_img
45 changes: 45 additions & 0 deletions gen_data/TRAIN_MVHUMANNET++_DATASET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Train Models Using the MVHumanNet++ Dataset

## MVHumanNet++ Dataset
Download MVHumanNet++ Dataset from the [official repo](https://github.com/GAP-LAB-CUHK-SZ/MVHumanNet_plusplus).

MVHumanNet++ is very nice for training AnimatableGaussians models. It features:
- a large number of subjects and outfits
- 16 cameras surrounding the subject
- 60 frames for each subject-outfit-camera and **an extra A-pose frame**
- camera calibrations, smplx-parameters are accurate and complete

## Preporcessing
If you want to preprocess one single subject, run
```bash
python preprocess_mvhnpp.py --mvhn_subj_path ../../mvhumannet_plusplus/test/100990
```

You can put multiple subjects in a folder (e.g. `../../mvhumannet_plusplus/test/`) and preprocess them together by running:
```bash
python preprocess_mvhnpp.py --mvhn_root ../../mvhumannet_plusplus/test
```

The script will create `calibrations.json` and `smpl_params.npz` in the subject folder. These files conform to the THuman4 format, as the authors of AnimatableGaussians recommended.

## Training

You can follow [GEN_DATA.md](./GEN_DATA.md) and [README.md](../README.md) to train or directly use the script. From the root of AnimatableGaussians
```bash
chmod +x train_mvhnpp.sh
./train_mvhnpp.sh mvhn_100990
```
You must have `template.yaml` and `avatar.yaml` in `./configs/mvhn_100990` for this to work, which we have provided as an example.

### P.S.
I could not configure the env using the given `requirements.txt`. I am using
- `python=3.10`
- `cuda=11.7.1`
- `pytorch-cuda=2.0.1`
- `numpy=1.26.4`
- `pytorch3d=0.7.4` (installed using downloaded pre-compiled file)
- **`scikit-learn=1.1.3`** (different from `requirements.txt`)
- **`scikit-image=0.25.2`** (different from `requirements.txt`)
- **`opencv=4.7.0`** (different from `requirements.txt`)
- **`setuptools=78.1.0`** (different from `requirements.txt`)
- `smplx=0.1.28`
Loading