-
Notifications
You must be signed in to change notification settings - Fork 3
/
convert.py
42 lines (32 loc) · 979 Bytes
/
convert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import argparse
import torch
from SUPR.supr.pytorch.supr import SUPR
from supr_convertor.config import get_cfg
from supr_convertor.convertor import Convertor
from supr_convertor.data import MeshFolderDataset
from supr_convertor.utils import validate_device
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--cfg", type=str, required=True)
args = parser.parse_args()
cfg = get_cfg(args.cfg)
print(f"\nUsing {cfg.model.gender} body model")
device = validate_device(cfg.device)
dataset = MeshFolderDataset(cfg.data.mesh_dir)
dataloader = torch.utils.data.DataLoader(
dataset,
batch_size=cfg.data.batch_size,
shuffle=False,
)
target_body_model = SUPR(
cfg.model.path,
num_betas=cfg.model.n_betas,
device=device,
)
convertor = Convertor(
cfg,
target_body_model,
dataloader,
device,
)
convertor.convert()