Spaces:
Runtime error
Runtime error
new
Browse files- .gitattributes +1 -0
- PIFu/spaces.py +17 -13
- README.md +1 -1
- examples/9.jpg +0 -0
- gradio_cached_examples/{output β 3D Model}/0.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/1.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/2.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/3.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/4.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/5.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/6.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/7.glb +2 -2
- gradio_cached_examples/{output β 3D Model}/8.glb +2 -2
- gradio_cached_examples/Download 3D Model/0.glb +3 -0
- gradio_cached_examples/Download 3D Model/1.glb +3 -0
- gradio_cached_examples/Download 3D Model/2.glb +3 -0
- gradio_cached_examples/Download 3D Model/3.glb +3 -0
- gradio_cached_examples/Download 3D Model/4.glb +3 -0
- gradio_cached_examples/Download 3D Model/5.glb +3 -0
- gradio_cached_examples/Download 3D Model/6.glb +3 -0
- gradio_cached_examples/Download 3D Model/7.glb +3 -0
- gradio_cached_examples/Download 3D Model/8.glb +3 -0
- gradio_cached_examples/log.csv +10 -11
- gradio_cached_examples/output/.gitattributes +0 -0
- gradio_cached_examples/output/9.glb +0 -3
- requirements.txt +2 -1
.gitattributes
CHANGED
|
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.glb filter=lfs diff=lfs merge=lfs -text
|
PIFu/spaces.py
CHANGED
|
@@ -21,6 +21,9 @@ from apps.crop_img import process_img
|
|
| 21 |
from apps.eval import Evaluator
|
| 22 |
from types import SimpleNamespace
|
| 23 |
import trimesh
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
print(
|
| 26 |
"torch: ", torch.__version__,
|
|
@@ -89,12 +92,12 @@ def process(img_path):
|
|
| 89 |
print("Evaluating via PIFu", time)
|
| 90 |
evaluator.eval(data, True)
|
| 91 |
print("Success Evaluating via PIFu", datetime.now() - time)
|
| 92 |
-
result_path = f'{opts.results_path}/{opts.name}/result_{img_name}'
|
| 93 |
except Exception as e:
|
| 94 |
print("Error evaluating via PIFu", e)
|
| 95 |
|
| 96 |
try:
|
| 97 |
-
mesh = trimesh.load(result_path + '.obj')
|
| 98 |
# flip mesh
|
| 99 |
mesh.apply_transform([[1, 0, 0, 0],
|
| 100 |
[0, 1, 0, 0],
|
|
@@ -102,16 +105,16 @@ def process(img_path):
|
|
| 102 |
[0, 0, 0, 1]])
|
| 103 |
mesh.export(file_obj=result_path + '.glb')
|
| 104 |
result_gltf = result_path + '.glb'
|
| 105 |
-
return result_gltf
|
| 106 |
|
| 107 |
except Exception as e:
|
| 108 |
print("error generating MESH", e)
|
| 109 |
|
| 110 |
|
| 111 |
-
examples =
|
| 112 |
description = '''
|
| 113 |
# PIFu Clothed Human Digitization
|
| 114 |
-
|
| 115 |
<base target="_blank">
|
| 116 |
|
| 117 |
This is a demo for <a href="https://github.com/shunsukesaito/PIFu" target="_blank"> PIFu model </a>.
|
|
@@ -123,14 +126,14 @@ The pre-trained model has the following warning:
|
|
| 123 |
<details>
|
| 124 |
<summary>More</summary>
|
| 125 |
|
| 126 |
-
|
| 127 |
|
| 128 |
* Julien and Clem
|
| 129 |
* [StyleGAN Humans](https://huggingface.co/spaces/hysts/StyleGAN-Human)
|
| 130 |
* [Renderpeople: Dennis](https://renderpeople.com)
|
| 131 |
|
| 132 |
|
| 133 |
-
|
| 134 |
* https://phorhum.github.io/
|
| 135 |
* https://github.com/yuliangxiu/icon
|
| 136 |
* https://shunsukesaito.github.io/PIFuHD/
|
|
@@ -141,14 +144,15 @@ The pre-trained model has the following warning:
|
|
| 141 |
iface = gr.Interface(
|
| 142 |
fn=process,
|
| 143 |
description=description,
|
| 144 |
-
inputs=gr.Image(type="filepath", label="Input Image"),
|
| 145 |
-
outputs=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
examples=examples,
|
| 147 |
allow_flagging="never",
|
| 148 |
-
cache_examples=True
|
| 149 |
-
|
| 150 |
-
|
| 151 |
)
|
| 152 |
|
| 153 |
if __name__ == "__main__":
|
| 154 |
-
iface.launch(debug=True, enable_queue=False)
|
|
|
|
| 21 |
from apps.eval import Evaluator
|
| 22 |
from types import SimpleNamespace
|
| 23 |
import trimesh
|
| 24 |
+
import glob
|
| 25 |
+
|
| 26 |
+
os.environ["CUDA_VISIBLE_DEVICES"]="0"
|
| 27 |
|
| 28 |
print(
|
| 29 |
"torch: ", torch.__version__,
|
|
|
|
| 92 |
print("Evaluating via PIFu", time)
|
| 93 |
evaluator.eval(data, True)
|
| 94 |
print("Success Evaluating via PIFu", datetime.now() - time)
|
| 95 |
+
result_path = f'./{opts.results_path}/{opts.name}/result_{img_name}'
|
| 96 |
except Exception as e:
|
| 97 |
print("Error evaluating via PIFu", e)
|
| 98 |
|
| 99 |
try:
|
| 100 |
+
mesh = trimesh.load(result_path + '.obj')
|
| 101 |
# flip mesh
|
| 102 |
mesh.apply_transform([[1, 0, 0, 0],
|
| 103 |
[0, 1, 0, 0],
|
|
|
|
| 105 |
[0, 0, 0, 1]])
|
| 106 |
mesh.export(file_obj=result_path + '.glb')
|
| 107 |
result_gltf = result_path + '.glb'
|
| 108 |
+
return [result_gltf, result_gltf]
|
| 109 |
|
| 110 |
except Exception as e:
|
| 111 |
print("error generating MESH", e)
|
| 112 |
|
| 113 |
|
| 114 |
+
examples = sorted(glob.glob('examples/*.png'))
|
| 115 |
description = '''
|
| 116 |
# PIFu Clothed Human Digitization
|
| 117 |
+
### PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization
|
| 118 |
<base target="_blank">
|
| 119 |
|
| 120 |
This is a demo for <a href="https://github.com/shunsukesaito/PIFu" target="_blank"> PIFu model </a>.
|
|
|
|
| 126 |
<details>
|
| 127 |
<summary>More</summary>
|
| 128 |
|
| 129 |
+
#### Image Credits
|
| 130 |
|
| 131 |
* Julien and Clem
|
| 132 |
* [StyleGAN Humans](https://huggingface.co/spaces/hysts/StyleGAN-Human)
|
| 133 |
* [Renderpeople: Dennis](https://renderpeople.com)
|
| 134 |
|
| 135 |
|
| 136 |
+
#### More
|
| 137 |
* https://phorhum.github.io/
|
| 138 |
* https://github.com/yuliangxiu/icon
|
| 139 |
* https://shunsukesaito.github.io/PIFuHD/
|
|
|
|
| 144 |
iface = gr.Interface(
|
| 145 |
fn=process,
|
| 146 |
description=description,
|
| 147 |
+
inputs=gr.inputs.Image(type="filepath", label="Input Image"),
|
| 148 |
+
outputs=[
|
| 149 |
+
gr.outputs.Image3D(
|
| 150 |
+
clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"),
|
| 151 |
+
gr.outputs.File(label="Download 3D Model")
|
| 152 |
+
],
|
| 153 |
examples=examples,
|
| 154 |
allow_flagging="never",
|
|
|
|
|
|
|
|
|
|
| 155 |
)
|
| 156 |
|
| 157 |
if __name__ == "__main__":
|
| 158 |
+
iface.launch(debug=True, enable_queue=False, cache_examples=True)
|
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: π§π½ββοΈπ§π»π§π½ββοΈΒ
|
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 2.9.
|
| 8 |
app_file: ./PIFu/spaces.py
|
| 9 |
pinned: false
|
| 10 |
python_version: 3.7.13
|
|
|
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 2.9.4
|
| 8 |
app_file: ./PIFu/spaces.py
|
| 9 |
pinned: false
|
| 10 |
python_version: 3.7.13
|
examples/9.jpg
DELETED
|
Binary file (97.1 kB)
|
|
|
gradio_cached_examples/{output β 3D Model}/0.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:397d5092f3fd8c296124fa8359e17ae1c30cd87298c6b1a851e8fa863b6bb2d7
|
| 3 |
+
size 1448964
|
gradio_cached_examples/{output β 3D Model}/1.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5940a0fa4905caebac714394ffb5a5576808bf36452fd15f0a04e0754ec3222e
|
| 3 |
+
size 1606488
|
gradio_cached_examples/{output β 3D Model}/2.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb8d49f5ef0768ee81f1c9d3e141432854221bf5270f5bb46c490c43a73e5593
|
| 3 |
+
size 1517748
|
gradio_cached_examples/{output β 3D Model}/3.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f35f041c03e273ae7a1189e7a3148a5c376dd222ae9d16842fa9716784b6eb06
|
| 3 |
+
size 1510776
|
gradio_cached_examples/{output β 3D Model}/4.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4f5170735644099ab38ab5760cdde10cd08cade2ff0d2f1e2c66562d6c6f5b0
|
| 3 |
+
size 1724844
|
gradio_cached_examples/{output β 3D Model}/5.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56b65a8340c53c9fbb1f8dddc9176035a64212649e4e638beb09b6628fbf51fe
|
| 3 |
+
size 1706220
|
gradio_cached_examples/{output β 3D Model}/6.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de5d0d9e44e345e0b1a09d7248a9630b8e087c287aafb94c6ecd7659da87687c
|
| 3 |
+
size 1589920
|
gradio_cached_examples/{output β 3D Model}/7.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:400af9c0925b80dc8f0e1e561cfca4e09e0e6dfd990d0ba30880f52f6d220870
|
| 3 |
+
size 1923292
|
gradio_cached_examples/{output β 3D Model}/8.glb
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89f4cb56c84a1cf7e4cfb31ef0e3bd0b0dd62ea2f71cd70a80f4b8f39ebe3c0c
|
| 3 |
+
size 2059096
|
gradio_cached_examples/Download 3D Model/0.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:397d5092f3fd8c296124fa8359e17ae1c30cd87298c6b1a851e8fa863b6bb2d7
|
| 3 |
+
size 1448964
|
gradio_cached_examples/Download 3D Model/1.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5940a0fa4905caebac714394ffb5a5576808bf36452fd15f0a04e0754ec3222e
|
| 3 |
+
size 1606488
|
gradio_cached_examples/Download 3D Model/2.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb8d49f5ef0768ee81f1c9d3e141432854221bf5270f5bb46c490c43a73e5593
|
| 3 |
+
size 1517748
|
gradio_cached_examples/Download 3D Model/3.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f35f041c03e273ae7a1189e7a3148a5c376dd222ae9d16842fa9716784b6eb06
|
| 3 |
+
size 1510776
|
gradio_cached_examples/Download 3D Model/4.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4f5170735644099ab38ab5760cdde10cd08cade2ff0d2f1e2c66562d6c6f5b0
|
| 3 |
+
size 1724844
|
gradio_cached_examples/Download 3D Model/5.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56b65a8340c53c9fbb1f8dddc9176035a64212649e4e638beb09b6628fbf51fe
|
| 3 |
+
size 1706220
|
gradio_cached_examples/Download 3D Model/6.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de5d0d9e44e345e0b1a09d7248a9630b8e087c287aafb94c6ecd7659da87687c
|
| 3 |
+
size 1589920
|
gradio_cached_examples/Download 3D Model/7.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:400af9c0925b80dc8f0e1e561cfca4e09e0e6dfd990d0ba30880f52f6d220870
|
| 3 |
+
size 1923292
|
gradio_cached_examples/Download 3D Model/8.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89f4cb56c84a1cf7e4cfb31ef0e3bd0b0dd62ea2f71cd70a80f4b8f39ebe3c0c
|
| 3 |
+
size 2059096
|
gradio_cached_examples/log.csv
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
-
'
|
| 2 |
-
'
|
| 3 |
-
'
|
| 4 |
-
'
|
| 5 |
-
'
|
| 6 |
-
'
|
| 7 |
-
'
|
| 8 |
-
'
|
| 9 |
-
'
|
| 10 |
-
'
|
| 11 |
-
'output/9.glb','','','2022-04-26 14:01:01.142050'
|
|
|
|
| 1 |
+
'3D Model','Download 3D Model'
|
| 2 |
+
'3D Model/0.glb','Download 3D Model/0.glb'
|
| 3 |
+
'3D Model/1.glb','Download 3D Model/1.glb'
|
| 4 |
+
'3D Model/2.glb','Download 3D Model/2.glb'
|
| 5 |
+
'3D Model/3.glb','Download 3D Model/3.glb'
|
| 6 |
+
'3D Model/4.glb','Download 3D Model/4.glb'
|
| 7 |
+
'3D Model/5.glb','Download 3D Model/5.glb'
|
| 8 |
+
'3D Model/6.glb','Download 3D Model/6.glb'
|
| 9 |
+
'3D Model/7.glb','Download 3D Model/7.glb'
|
| 10 |
+
'3D Model/8.glb','Download 3D Model/8.glb'
|
|
|
gradio_cached_examples/output/.gitattributes
DELETED
|
File without changes
|
gradio_cached_examples/output/9.glb
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:751843708e0f2ce1ce063afd1c0f7e26bc39826e922a77176acb6c36c518242c
|
| 3 |
-
size 1808476
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -21,4 +21,5 @@ torchvision==0.5.0
|
|
| 21 |
trimesh==3.5.23
|
| 22 |
tqdm==4.64.0
|
| 23 |
paddlehub
|
| 24 |
-
paddlepaddle
|
|
|
|
|
|
| 21 |
trimesh==3.5.23
|
| 22 |
tqdm==4.64.0
|
| 23 |
paddlehub
|
| 24 |
+
paddlepaddle
|
| 25 |
+
glob2
|