Spaces:
Build error
Build error
update app - test
Browse files
DECA
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 1cc2361a2929a206e1b0330ee8b89fcda478d037
|
MODNet
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 28165a451e4610c9d77cfdf925a94610bb2810fb
|
README.md
CHANGED
@@ -9,4 +9,6 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
|
|
|
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
# Realistic one-shot mesh-based avatars
|
13 |
+
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os, sys
|
2 |
-
import
|
3 |
import argparse
|
4 |
|
5 |
import numpy as np
|
@@ -8,17 +8,14 @@ import matplotlib.pyplot as plt
|
|
8 |
|
9 |
from PIL import Image
|
10 |
|
11 |
-
|
12 |
|
13 |
-
print(os.getcwd())
|
14 |
-
print(os.listdir('.'))
|
15 |
-
|
16 |
-
sys.path.append("./rome")
|
17 |
from rome.src.utils import args as args_utils
|
18 |
from rome.src.utils.processing import process_black_shape, tensor2image
|
19 |
|
20 |
# loading models ---- create model repo
|
21 |
from huggingface_hub import hf_hub_url
|
|
|
22 |
default_modnet_path = hf_hub_url('Pie31415/rome','modnet_photographic_portrait_matting.ckpt')
|
23 |
default_model_path = hf_hub_url('Pie31415/rome','models/rome.pth')
|
24 |
|
@@ -31,9 +28,110 @@ parser.add_argument('--modnet_path', default=default_modnet_path, type=str)
|
|
31 |
parser.add_argument('--random_seed', default=0, type=int)
|
32 |
parser.add_argument('--debug', action='store_true')
|
33 |
parser.add_argument('--verbose', default='False', type=args_utils.str2bool, choices=[True, False])
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
parser = importlib.import_module(f'src.rome').ROME.add_argparse_args(parser)
|
37 |
args = parser.parse_args()
|
38 |
args.deca_path = 'DECA'
|
39 |
|
|
|
1 |
import os, sys
|
2 |
+
import importlib
|
3 |
import argparse
|
4 |
|
5 |
import numpy as np
|
|
|
8 |
|
9 |
from PIL import Image
|
10 |
|
11 |
+
sys.path.append("./rome/")
|
12 |
|
|
|
|
|
|
|
|
|
13 |
from rome.src.utils import args as args_utils
|
14 |
from rome.src.utils.processing import process_black_shape, tensor2image
|
15 |
|
16 |
# loading models ---- create model repo
|
17 |
from huggingface_hub import hf_hub_url
|
18 |
+
|
19 |
default_modnet_path = hf_hub_url('Pie31415/rome','modnet_photographic_portrait_matting.ckpt')
|
20 |
default_model_path = hf_hub_url('Pie31415/rome','models/rome.pth')
|
21 |
|
|
|
28 |
parser.add_argument('--random_seed', default=0, type=int)
|
29 |
parser.add_argument('--debug', action='store_true')
|
30 |
parser.add_argument('--verbose', default='False', type=args_utils.str2bool, choices=[True, False])
|
31 |
+
parser.add_argument('--model_image_size', default=256, type=int)
|
32 |
+
parser.add_argument('--align_source', default='True', type=args_utils.str2bool, choices=[True, False])
|
33 |
+
parser.add_argument('--align_target', default='False', type=args_utils.str2bool, choices=[True, False])
|
34 |
+
parser.add_argument('--align_scale', default=1.25, type=float)
|
35 |
+
|
36 |
+
parser.add_argument('--use_mesh_deformations', default='False', type=args_utils.str2bool, choices=[True, False])
|
37 |
+
parser.add_argument('--subdivide_mesh', default='False', type=args_utils.str2bool, choices=[True, False])
|
38 |
+
parser.add_argument('--renderer_sigma', default=1e-8, type=float)
|
39 |
+
parser.add_argument('--renderer_zfar', default=100.0, type=float)
|
40 |
+
parser.add_argument('--renderer_type', default='soft_mesh')
|
41 |
+
parser.add_argument('--renderer_texture_type', default='texture_uv')
|
42 |
+
parser.add_argument('--renderer_normalized_alphas', default='False', type=args_utils.str2bool,
|
43 |
+
choices=[True, False])
|
44 |
+
|
45 |
+
parser.add_argument('--deca_path', default='')
|
46 |
+
parser.add_argument('--rome_data_dir', default='')
|
47 |
+
|
48 |
+
|
49 |
+
parser.add_argument('--autoenc_cat_alphas', default='False', type=args_utils.str2bool, choices=[True, False])
|
50 |
+
parser.add_argument('--autoenc_align_inputs', default='False', type=args_utils.str2bool, choices=[True, False])
|
51 |
+
parser.add_argument('--autoenc_use_warp', default='False', type=args_utils.str2bool, choices=[True, False])
|
52 |
+
parser.add_argument('--autoenc_num_channels', default=64, type=int)
|
53 |
+
parser.add_argument('--autoenc_max_channels', default=512, type=int)
|
54 |
+
parser.add_argument('--autoenc_num_groups', default=4, type=int)
|
55 |
+
parser.add_argument('--autoenc_num_bottleneck_groups', default=0, type=int)
|
56 |
+
parser.add_argument('--autoenc_num_blocks', default=2, type=int)
|
57 |
+
parser.add_argument('--autoenc_num_layers', default=4, type=int)
|
58 |
+
parser.add_argument('--autoenc_block_type', default='bottleneck')
|
59 |
+
|
60 |
+
parser.add_argument('--neural_texture_channels', default=8, type=int)
|
61 |
+
parser.add_argument('--num_harmonic_encoding_funcs', default=6, type=int)
|
62 |
+
|
63 |
+
parser.add_argument('--unet_num_channels', default=64, type=int)
|
64 |
+
parser.add_argument('--unet_max_channels', default=512, type=int)
|
65 |
+
parser.add_argument('--unet_num_groups', default=4, type=int)
|
66 |
+
parser.add_argument('--unet_num_blocks', default=1, type=int)
|
67 |
+
parser.add_argument('--unet_num_layers', default=2, type=int)
|
68 |
+
parser.add_argument('--unet_block_type', default='conv')
|
69 |
+
parser.add_argument('--unet_skip_connection_type', default='cat')
|
70 |
+
parser.add_argument('--unet_use_normals_cond', default=True, action='store_true')
|
71 |
+
parser.add_argument('--unet_use_vertex_cond', action='store_true')
|
72 |
+
parser.add_argument('--unet_use_uvs_cond', action='store_true')
|
73 |
+
parser.add_argument('--unet_pred_mask', action='store_true')
|
74 |
+
parser.add_argument('--use_separate_seg_unet', default='True', type=args_utils.str2bool, choices=[True, False])
|
75 |
+
|
76 |
+
parser.add_argument('--norm_layer_type', default='gn', type=str, choices=['bn', 'sync_bn', 'in', 'gn'])
|
77 |
+
parser.add_argument('--activation_type', default='relu', type=str, choices=['relu', 'lrelu'])
|
78 |
+
parser.add_argument('--conv_layer_type', default='ws_conv', type=str, choices=['conv', 'ws_conv'])
|
79 |
+
|
80 |
+
parser.add_argument('--deform_norm_layer_type', default='gn', type=str, choices=['bn', 'sync_bn', 'in', 'gn'])
|
81 |
+
parser.add_argument('--deform_activation_type', default='relu', type=str, choices=['relu', 'lrelu'])
|
82 |
+
parser.add_argument('--deform_conv_layer_type', default='ws_conv', type=str, choices=['conv', 'ws_conv'])
|
83 |
+
parser.add_argument('--unet_seg_weight', default=0.0, type=float)
|
84 |
+
parser.add_argument('--unet_seg_type', default='bce_with_logits', type=str, choices=['bce_with_logits', 'dice'])
|
85 |
+
parser.add_argument('--deform_face_tightness', default=0.0, type=float)
|
86 |
+
|
87 |
+
parser.add_argument('--use_whole_segmentation', action='store_true')
|
88 |
+
parser.add_argument('--mask_hair_for_neck', action='store_true')
|
89 |
+
parser.add_argument('--use_hair_from_avatar', action='store_true')
|
90 |
+
|
91 |
+
# Basis deformations
|
92 |
+
parser.add_argument('--use_scalp_deforms', default='True', type=args_utils.str2bool,
|
93 |
+
choices=[True, False], help='')
|
94 |
+
parser.add_argument('--use_neck_deforms', default='True', type=args_utils.str2bool,
|
95 |
+
choices=[True, False], help='')
|
96 |
+
parser.add_argument('--use_basis_deformer', default='False', type=args_utils.str2bool,
|
97 |
+
choices=[True, False], help='')
|
98 |
+
parser.add_argument('--use_unet_deformer', default='True', type=args_utils.str2bool,
|
99 |
+
choices=[True, False], help='')
|
100 |
+
|
101 |
+
parser.add_argument('--pretrained_encoder_basis_path', default='')
|
102 |
+
parser.add_argument('--pretrained_vertex_basis_path', default='')
|
103 |
+
parser.add_argument('--num_basis', default=50, type=int)
|
104 |
+
parser.add_argument('--basis_init', default='pca', type=str, choices=['random', 'pca'])
|
105 |
+
parser.add_argument('--num_vertex', default=5023, type=int)
|
106 |
+
parser.add_argument('--train_basis', default=True, type=args_utils.str2bool, choices=[True, False])
|
107 |
+
parser.add_argument('--path_to_deca', default='DECA')
|
108 |
+
|
109 |
+
parser.add_argument('--path_to_linear_hair_model',
|
110 |
+
default='data/linear_hair.pth')
|
111 |
+
parser.add_argument('--path_to_mobile_model',
|
112 |
+
default='data/disp_model.pth')
|
113 |
+
parser.add_argument('--n_scalp', default=60, type=int)
|
114 |
+
|
115 |
+
parser.add_argument('--use_distill', default=False, type=args_utils.str2bool, choices=[True, False])
|
116 |
+
parser.add_argument('--use_mobile_version', default=False, type=args_utils.str2bool, choices=[True, False])
|
117 |
+
|
118 |
+
parser.add_argument('--deformer_path', default='data/rome.pth')
|
119 |
+
|
120 |
+
parser.add_argument('--output_unet_deformer_feats', default=32, type=int,
|
121 |
+
help='output features in the UNet')
|
122 |
+
|
123 |
+
parser.add_argument('--use_deca_details', default=False, type=args_utils.str2bool, choices=[True, False])
|
124 |
+
parser.add_argument('--use_flametex', default=False, type=args_utils.str2bool, choices=[True, False])
|
125 |
+
|
126 |
+
parser.add_argument('--upsample_type', default='nearest', type=str,
|
127 |
+
choices=['nearest', 'bilinear', 'bicubic'])
|
128 |
+
|
129 |
+
parser.add_argument('--num_frequencies', default=6, type=int, help='frequency for harmonic encoding')
|
130 |
+
parser.add_argument('--deform_face_scale_coef', default=0.0, type=float)
|
131 |
+
parser.add_argument('--device', default='cpu', type=str)
|
132 |
+
# args, _ = parser.parse_known_args()
|
133 |
|
134 |
+
# parser = importlib.import_module(f'src.rome').ROME.add_argparse_args(parser)
|
135 |
args = parser.parse_args()
|
136 |
args.deca_path = 'DECA'
|
137 |
|
requirements.txt
CHANGED
@@ -1,15 +1,151 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
absl-py==0.13.0
|
2 |
+
albumentations==1.0.3
|
3 |
+
argon2-cffi==20.1.0
|
4 |
+
asttokens==2.0.5
|
5 |
+
async-generator==1.10
|
6 |
+
attrs==21.2.0
|
7 |
+
backcall==0.2.0
|
8 |
+
beautifulsoup4==4.10.0
|
9 |
+
bleach==4.0.0
|
10 |
+
cachetools==4.2.2
|
11 |
+
certifi==2022.5.18.1
|
12 |
+
cffi==1.14.6
|
13 |
+
charset-normalizer==2.0.4
|
14 |
+
chumpy==0.70
|
15 |
+
cloudpickle==2.0.0
|
16 |
+
colorama==0.4.4
|
17 |
+
cycler==0.10.0
|
18 |
+
cytoolz==0.11.0
|
19 |
+
dask==2021.10.0
|
20 |
+
debugpy==1.4.1
|
21 |
+
decorator==5.1.0
|
22 |
+
defusedxml==0.7.1
|
23 |
+
easydict==1.9
|
24 |
+
einops==0.3.2
|
25 |
+
entrypoints==0.3
|
26 |
+
executing==0.8.3
|
27 |
+
face-alignment==1.3.4
|
28 |
+
filelock==3.3.2
|
29 |
+
fonttools==4.25.0
|
30 |
+
fsspec==2021.8.1
|
31 |
+
future==0.18.2
|
32 |
+
fvcore==0.1.5.post20210915
|
33 |
+
gdown==4.2.0
|
34 |
+
google-auth==1.35.0
|
35 |
+
google-auth-oauthlib==0.4.5
|
36 |
+
grpcio==1.39.0
|
37 |
+
icecream==2.1.2
|
38 |
+
idna==3.2
|
39 |
+
imagecodecs==2021.8.26
|
40 |
+
imageio==2.9.0
|
41 |
+
imageio-ffmpeg==0.4.5
|
42 |
+
imgaug==0.4.0
|
43 |
+
importlib-metadata==4.8.1
|
44 |
+
iopath==0.1.9
|
45 |
+
jedi==0.18.0
|
46 |
+
Jinja2==3.0.2
|
47 |
+
joblib==1.0.1
|
48 |
+
jsonschema==3.2.0
|
49 |
+
kiwisolver==1.3.1
|
50 |
+
kmeans-pytorch==0.3
|
51 |
+
kornia==0.6.1
|
52 |
+
llvmlite==0.37.0
|
53 |
+
lmdb==1.2.1
|
54 |
+
locket==0.2.1
|
55 |
+
lpips==0.1.3
|
56 |
+
Markdown==3.3.4
|
57 |
+
MarkupSafe==2.0.1
|
58 |
+
matplotlib==3.4.3
|
59 |
+
matplotlib-inline==0.1.2
|
60 |
+
mistune==0.8.4
|
61 |
+
mkl-fft==1.3.1
|
62 |
+
mkl-random==1.2.2
|
63 |
+
mkl-service==2.4.0
|
64 |
+
munkres==1.1.4
|
65 |
+
nbclient==0.5.3
|
66 |
+
nbconvert==6.1.0
|
67 |
+
nbformat==5.1.3
|
68 |
+
nest-asyncio==1.5.1
|
69 |
+
networkx==2.6.3
|
70 |
+
numpy==1.22.0
|
71 |
+
oauthlib==3.1.1
|
72 |
+
olefile==0.46
|
73 |
+
opencv-contrib-python==4.5.4.58
|
74 |
+
opencv-python==4.5.4.58
|
75 |
+
opencv-python-headless==4.5.4.58
|
76 |
+
packaging==21.0
|
77 |
+
pandas==1.1.3
|
78 |
+
pandocfilters==1.4.3
|
79 |
+
parso==0.8.2
|
80 |
+
partd==1.2.0
|
81 |
+
pexpect==4.8.0
|
82 |
+
pickleshare==0.7.5
|
83 |
+
Pillow==9.0.1
|
84 |
+
pip==21.2.4
|
85 |
+
portalocker==2.3.0
|
86 |
+
prometheus-client==0.11.0
|
87 |
+
prompt-toolkit==3.0.20
|
88 |
+
protobuf==3.15.8
|
89 |
+
ptyprocess==0.7.0
|
90 |
+
pyasn1==0.4.8
|
91 |
+
pyasn1-modules==0.2.8
|
92 |
+
pycocotools==2.0.4
|
93 |
+
pycparser==2.20
|
94 |
+
Pygments==2.10.0
|
95 |
+
pyhocon==0.3.59
|
96 |
+
PyMCubes==0.1.2
|
97 |
+
pyntcloud==0.2.0
|
98 |
+
pyparsing==2.4.7
|
99 |
+
PyQt5==5.12.3
|
100 |
+
PyQt5_sip==4.19.18
|
101 |
+
PyQtChart==5.12
|
102 |
+
PyQtWebEngine==5.12.1
|
103 |
+
pyrsistent==0.18.0
|
104 |
+
PySocks==1.7.1
|
105 |
+
python-dateutil==2.8.2
|
106 |
+
pythreejs==2.3.0
|
107 |
+
pytorch-msssim==0.2.1
|
108 |
+
pytorch3d
|
109 |
+
pytz==2020.1
|
110 |
+
PyWavelets==1.1.1
|
111 |
+
PyYAML==6.0
|
112 |
+
pyzmq==22.2.1
|
113 |
+
qtconsole==5.1.1
|
114 |
+
QtPy==1.10.0
|
115 |
+
requests==2.26.0
|
116 |
+
requests-oauthlib==1.3.0
|
117 |
+
rsa==4.7.2
|
118 |
+
scikit-image==0.18.1
|
119 |
+
scikit-learn==0.24.2
|
120 |
+
scipy==1.6.2
|
121 |
+
Send2Trash==1.8.0
|
122 |
+
setuptools==58.0.4
|
123 |
+
Shapely==1.7.1
|
124 |
+
six==1.16.0
|
125 |
+
sklearn==0.0
|
126 |
+
soupsieve==2.3
|
127 |
+
tabulate==0.8.9
|
128 |
+
tenacity==8.0.1
|
129 |
+
termcolor==1.1.0
|
130 |
+
terminado==0.9.4
|
131 |
+
testpath==0.5.0
|
132 |
+
threadpoolctl==2.2.0
|
133 |
+
tifffile==2021.7.2
|
134 |
+
toml==0.10.2
|
135 |
+
toolz==0.11.1
|
136 |
+
torch==1.10.0
|
137 |
+
torchsummary==1.5.1
|
138 |
+
torchvision==0.11.1
|
139 |
+
tornado==6.1
|
140 |
+
tqdm==4.62.3
|
141 |
+
traitlets==5.1.0
|
142 |
+
traittypes==0.2.1
|
143 |
+
typing-extensions==3.10.0.2
|
144 |
+
urllib3==1.26.6
|
145 |
+
wcwidth==0.2.5
|
146 |
+
webencodings==0.5.1
|
147 |
+
Werkzeug==2.0.1
|
148 |
+
wheel==0.37.0
|
149 |
+
widgetsnbextension==3.5.1
|
150 |
+
yacs==0.1.6
|
151 |
+
zipp==3.6.0
|
rome
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 35a44966b3eb69a77c3781e6e8475397f84512bd
|