Spaces:
Runtime error
Runtime error
Upload src/j2s.py with huggingface_hub
Browse files- src/j2s.py +31 -0
src/j2s.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from argparse import ArgumentParser
|
| 2 |
+
from omegaconf import OmegaConf
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
from inference.joint2smplx import process_file
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
"""
|
| 10 |
+
args:
|
| 11 |
+
- input_folder
|
| 12 |
+
- output_folder
|
| 13 |
+
"""
|
| 14 |
+
parser = ArgumentParser()
|
| 15 |
+
parser.add_argument('--input_folder', type=str, default=None)
|
| 16 |
+
parser.add_argument('--output_folder', type=str, default=None)
|
| 17 |
+
args = parser.parse_args()
|
| 18 |
+
|
| 19 |
+
root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # motionReFit dir
|
| 20 |
+
config = OmegaConf.load(os.path.join(root, "src", "configs/j2s.yaml"))
|
| 21 |
+
|
| 22 |
+
for file_name in os.listdir(args.input_folder):
|
| 23 |
+
if file_name.endswith('.pkl'):
|
| 24 |
+
process_file(file_path=args.input_folder,
|
| 25 |
+
file_name=file_name,
|
| 26 |
+
save_path=args.output_folder,
|
| 27 |
+
JointsToSMPLX_model_path=os.path.join(root, config.JointsToSMPLX_model_path),
|
| 28 |
+
smplx_path=os.path.join(root, config.smplx_path),
|
| 29 |
+
key_list = ['generated_samples', 'original_samples'],
|
| 30 |
+
interp_s=config.interp_s,
|
| 31 |
+
)
|