Duplicate from hacksider/deep-live-cam
Browse filesCo-authored-by: Kenneth Estanislao <hacksider@users.noreply.huggingface.co>
- .gitattributes +36 -0
- 4xFFHQDAT.pth +3 -0
- GFPGANv1.4.onnx +3 -0
- GFPGANv1.4.pth +3 -0
- GPEN-BFR-256.onnx +3 -0
- GPEN-BFR-512.onnx +3 -0
- README.md +3 -0
- Real-ESRGAN-x4plus.onnx +3 -0
- RealESRGAN_x2plus.fp16.onnx +3 -0
- RealESRGAN_x4plus.pth +3 -0
- appearance_feature_extractor.safetensors +3 -0
- buffalo_l/buffalo_l/1k3d68.onnx +3 -0
- buffalo_l/buffalo_l/2d106det.onnx +3 -0
- buffalo_l/buffalo_l/det_10g.onnx +3 -0
- buffalo_l/buffalo_l/genderage.onnx +3 -0
- buffalo_l/buffalo_l/w600k_r50.onnx +3 -0
- gfpgan-1024.onnx +3 -0
- hyperswap_1a_256.onnx +3 -0
- hyperswap_1b_256.onnx +3 -0
- hyperswap_1c_256.onnx +3 -0
- insightface-0.7.3-cp310-cp310-win_amd64.whl +3 -0
- instructions.txt +4 -0
- inswapper_128.onnx +3 -0
- inswapper_128_fp16.onnx +3 -0
- liveportrait/live_portrait_eye_retargeter.onnx +3 -0
- liveportrait/live_portrait_feature_extractor.onnx +3 -0
- liveportrait/live_portrait_generator.onnx +3 -0
- liveportrait/live_portrait_lip_retargeter.onnx +3 -0
- liveportrait/live_portrait_motion_extractor.onnx +3 -0
- liveportrait/live_portrait_stitcher.onnx +3 -0
- motion_extractor.safetensors +3 -0
- reswapper_256.onnx +3 -0
- sam2/download_models.py +135 -0
- sam2/sam2_hiera_tiny.decoder.onnx +3 -0
- sam2/sam2_hiera_tiny.encoder.onnx +3 -0
- spade_generator.safetensors +3 -0
- warping_module.safetensors +3 -0
- xseg.onnx +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
insightface-0.7.3-cp310-cp310-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
4xFFHQDAT.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14de53f9a48b5dbb268a35aa4daba9a9201679724b0bf36e2cd5e64280e066a2
|
| 3 |
+
size 154679777
|
GFPGANv1.4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd7311b8d9e13cdb1e208b12363182da58c7bf45e26d1aa67bbeac4751aae92e
|
| 3 |
+
size 340256686
|
GFPGANv1.4.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e2cd4703ab14f4d01fd1383a8a8b266f9a5833dacee8e6a79d3bf21a1b6be5ad
|
| 3 |
+
size 348632874
|
GPEN-BFR-256.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa5bd3ab238640a378c59e4a560f7a7150627944cf2129e6311ae4720e833271
|
| 3 |
+
size 75715262
|
GPEN-BFR-512.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf80acb8e91ba8852e3f012505be2c3b6cd6b3eed5ec605e3db87863c4e74d4e
|
| 3 |
+
size 284244491
|
README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gpl-3.0
|
| 3 |
+
---
|
Real-ESRGAN-x4plus.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e25d35c847f81e51a6f89cb939c373c9dc535871a820a4ab87ed1207a457f5c8
|
| 3 |
+
size 67123260
|
RealESRGAN_x2plus.fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b1770bcb31b3a9021d4251b538da4eb47c84f42706504d44a76d17e8c267606
|
| 3 |
+
size 33619494
|
RealESRGAN_x4plus.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4fa0d38905f75ac06eb49a7951b426670021be3018265fd191d2125df9d682f1
|
| 3 |
+
size 67040989
|
appearance_feature_extractor.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:38bef5de50a92bf1fc66e8c511051a19dfacdf80c37f8713425ec15dc9ca7d34
|
| 3 |
+
size 3361936
|
buffalo_l/buffalo_l/1k3d68.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df5c06b8a0c12e422b2ed8947b8869faa4105387f199c477af038aa01f9a45cc
|
| 3 |
+
size 143607619
|
buffalo_l/buffalo_l/2d106det.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f001b856447c413801ef5c42091ed0cd516fcd21f2d6b79635b1e733a7109dbf
|
| 3 |
+
size 5030888
|
buffalo_l/buffalo_l/det_10g.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5838f7fe053675b1c7a08b633df49e7af5495cee0493c7dcf6697200b85b5b91
|
| 3 |
+
size 16923827
|
buffalo_l/buffalo_l/genderage.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4fde69b1c810857b88c64a335084f1c3fe8f01246c9a191b48c7bb756d6652fb
|
| 3 |
+
size 1322532
|
buffalo_l/buffalo_l/w600k_r50.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4c06341c33c2ca1f86781dab0e829f88ad5b64be9fba56e56bc9ebdefc619e43
|
| 3 |
+
size 174383860
|
gfpgan-1024.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee8dd6415e388b3a410689d5d9395a2bf50b5973b588421ebfa57bc266f19e24
|
| 3 |
+
size 365875079
|
hyperswap_1a_256.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c0e98a8a03a238f461ed3d2570e426b49f46745ee400854a60dceeb70c246add
|
| 3 |
+
size 402742682
|
hyperswap_1b_256.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5124031789c42f71b9558fb71954ef7aedb6da7ed9fac79293e23c61a792a73e
|
| 3 |
+
size 402742682
|
hyperswap_1c_256.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5528c2d76fe9986c99d829278987ef9f3a630cb606db7628d02b57b330f406a5
|
| 3 |
+
size 402742682
|
insightface-0.7.3-cp310-cp310-win_amd64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dd77692380c79d1baa44314b17238fa26053f64f63f879e7d4e2a47f95b58b0d
|
| 3 |
+
size 873937
|
instructions.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
just put the models in this folder -
|
| 2 |
+
|
| 3 |
+
https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128_fp16.onnx?download=true
|
| 4 |
+
https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth
|
inswapper_128.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4a3f08c753cb72d04e10aa0f7dbe3deebbf39567d4ead6dce08e98aa49e16af
|
| 3 |
+
size 554253681
|
inswapper_128_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d51a9278a1f650cffefc18ba53f38bf2769bf4bbff89267822cf72945f8a38b
|
| 3 |
+
size 277680638
|
liveportrait/live_portrait_eye_retargeter.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:13cf8b06f0a314e6e65b4a47fea5ce270edb79cd54359c4d273f2c139820276b
|
| 3 |
+
size 581421
|
liveportrait/live_portrait_feature_extractor.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:980d26afc9af6d1b6c946329df08b89a4a8582c9bb668d9475f5254e69434d15
|
| 3 |
+
size 3354251
|
liveportrait/live_portrait_generator.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db9274114fed504226c5921fc736b9558505e68682e7448631aea7b62cb3048a
|
| 3 |
+
size 222263347
|
liveportrait/live_portrait_lip_retargeter.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f5b76344d0bfbb44c8a0b1ec57a4a7c36fd38db530338777a48c4a33a02d71f
|
| 3 |
+
size 151022
|
liveportrait/live_portrait_motion_extractor.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ef4a00ff50d5d864994eeecb226dc3b298e62afacec8fa4fc8b912835ec4b0ab
|
| 3 |
+
size 112636642
|
liveportrait/live_portrait_stitcher.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6683427edf3e0c3a86e61b1dea1e6dad56c557f5e711fec93966cfb34fd5f87
|
| 3 |
+
size 193259
|
motion_extractor.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3568cd410e29d046771acb55ecfdfe4c7c197d345bd8b7f95942ef63130b6c9e
|
| 3 |
+
size 112496256
|
reswapper_256.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a87d3cbe281037133f1be765d14e164fe071e55fe2488887b789c39cc59cecd6
|
| 3 |
+
size 554298280
|
sam2/download_models.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Download SAM2 ONNX models from HuggingFace.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
python models/sam2/download_models.py [variant]
|
| 6 |
+
|
| 7 |
+
Variants:
|
| 8 |
+
tiny - SAM2 Hiera-Tiny (smallest, fastest) ~155 MB
|
| 9 |
+
small - SAM2 Hiera-Small (good balance) ~183 MB
|
| 10 |
+
base_plus - SAM2 Hiera-Base+ (higher accuracy) ~360 MB
|
| 11 |
+
large - SAM2 Hiera-Large (most accurate) ~910 MB
|
| 12 |
+
|
| 13 |
+
Default: tiny (recommended for real-time LivePortrait use)
|
| 14 |
+
|
| 15 |
+
Models are downloaded from:
|
| 16 |
+
https://huggingface.co/vietanhdev/segment-anything-2-onnx-models
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
import os
|
| 20 |
+
import sys
|
| 21 |
+
import urllib.request
|
| 22 |
+
import zipfile
|
| 23 |
+
|
| 24 |
+
HUGGINGFACE_BASE_URL = "https://huggingface.co/vietanhdev/segment-anything-2-onnx-models/resolve/main"
|
| 25 |
+
|
| 26 |
+
VARIANTS = {
|
| 27 |
+
"tiny": "sam2_hiera_tiny",
|
| 28 |
+
"small": "sam2_hiera_small",
|
| 29 |
+
"base_plus": "sam2_hiera_base_plus",
|
| 30 |
+
"large": "sam2_hiera_large",
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
def download_variant(variant_key: str = "tiny", output_dir: str = None):
|
| 34 |
+
"""Download and extract a SAM2 ONNX model variant."""
|
| 35 |
+
if output_dir is None:
|
| 36 |
+
output_dir = os.path.dirname(os.path.abspath(__file__))
|
| 37 |
+
|
| 38 |
+
if variant_key not in VARIANTS:
|
| 39 |
+
print(f"Unknown variant: {variant_key}")
|
| 40 |
+
print(f"Available variants: {', '.join(VARIANTS.keys())}")
|
| 41 |
+
return False
|
| 42 |
+
|
| 43 |
+
variant_name = VARIANTS[variant_key]
|
| 44 |
+
zip_filename = f"{variant_name}.zip"
|
| 45 |
+
zip_url = f"{HUGGINGFACE_BASE_URL}/{zip_filename}"
|
| 46 |
+
zip_path = os.path.join(output_dir, zip_filename)
|
| 47 |
+
|
| 48 |
+
encoder_path = os.path.join(output_dir, f"{variant_name}.encoder.onnx")
|
| 49 |
+
decoder_path = os.path.join(output_dir, f"{variant_name}.decoder.onnx")
|
| 50 |
+
|
| 51 |
+
# Check if already downloaded
|
| 52 |
+
if os.path.exists(encoder_path) and os.path.exists(decoder_path):
|
| 53 |
+
print(f"[SAM2] Models already exist for variant '{variant_key}':")
|
| 54 |
+
print(f" Encoder: {encoder_path}")
|
| 55 |
+
print(f" Decoder: {decoder_path}")
|
| 56 |
+
return True
|
| 57 |
+
|
| 58 |
+
print(f"[SAM2] Downloading {variant_key} variant from HuggingFace...")
|
| 59 |
+
print(f" URL: {zip_url}")
|
| 60 |
+
print(f" Destination: {output_dir}")
|
| 61 |
+
|
| 62 |
+
try:
|
| 63 |
+
# Download zip
|
| 64 |
+
def progress_hook(count, block_size, total_size):
|
| 65 |
+
percent = int(count * block_size * 100 / total_size) if total_size > 0 else 0
|
| 66 |
+
percent = min(percent, 100)
|
| 67 |
+
sys.stdout.write(f"\r Downloading: {percent}%")
|
| 68 |
+
sys.stdout.flush()
|
| 69 |
+
|
| 70 |
+
urllib.request.urlretrieve(zip_url, zip_path, reporthook=progress_hook)
|
| 71 |
+
print() # newline after progress
|
| 72 |
+
|
| 73 |
+
# Extract
|
| 74 |
+
print(f" Extracting...")
|
| 75 |
+
with zipfile.ZipFile(zip_path, 'r') as z:
|
| 76 |
+
z.extractall(output_dir)
|
| 77 |
+
|
| 78 |
+
# The zip extracts to a subdirectory; move files up if needed
|
| 79 |
+
extracted_dir = os.path.join(output_dir, variant_name)
|
| 80 |
+
if os.path.isdir(extracted_dir):
|
| 81 |
+
for fname in os.listdir(extracted_dir):
|
| 82 |
+
src = os.path.join(extracted_dir, fname)
|
| 83 |
+
dst = os.path.join(output_dir, f"{variant_name}.{fname}")
|
| 84 |
+
if not os.path.exists(dst):
|
| 85 |
+
os.rename(src, dst)
|
| 86 |
+
# Clean up extracted directory
|
| 87 |
+
try:
|
| 88 |
+
os.rmdir(extracted_dir)
|
| 89 |
+
except OSError:
|
| 90 |
+
pass
|
| 91 |
+
|
| 92 |
+
# Clean up zip
|
| 93 |
+
if os.path.exists(zip_path):
|
| 94 |
+
os.remove(zip_path)
|
| 95 |
+
|
| 96 |
+
# Verify
|
| 97 |
+
if os.path.exists(encoder_path) and os.path.exists(decoder_path):
|
| 98 |
+
print(f"[SAM2] Successfully downloaded {variant_key} variant!")
|
| 99 |
+
print(f" Encoder: {encoder_path}")
|
| 100 |
+
print(f" Decoder: {decoder_path}")
|
| 101 |
+
return True
|
| 102 |
+
else:
|
| 103 |
+
# Try alternate naming (files might be named without the variant prefix)
|
| 104 |
+
alt_encoder = os.path.join(output_dir, "encoder.onnx")
|
| 105 |
+
alt_decoder = os.path.join(output_dir, "decoder.onnx")
|
| 106 |
+
if os.path.exists(alt_encoder) and not os.path.exists(encoder_path):
|
| 107 |
+
os.rename(alt_encoder, encoder_path)
|
| 108 |
+
if os.path.exists(alt_decoder) and not os.path.exists(decoder_path):
|
| 109 |
+
os.rename(alt_decoder, decoder_path)
|
| 110 |
+
|
| 111 |
+
if os.path.exists(encoder_path) and os.path.exists(decoder_path):
|
| 112 |
+
print(f"[SAM2] Successfully downloaded {variant_key} variant!")
|
| 113 |
+
return True
|
| 114 |
+
else:
|
| 115 |
+
print(f"[SAM2] Warning: Expected files not found after extraction.")
|
| 116 |
+
print(f" Looking for: {encoder_path}")
|
| 117 |
+
print(f" Looking for: {decoder_path}")
|
| 118 |
+
print(f" Contents of {output_dir}:")
|
| 119 |
+
for f in os.listdir(output_dir):
|
| 120 |
+
print(f" {f}")
|
| 121 |
+
return False
|
| 122 |
+
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"\n[SAM2] Download failed: {e}")
|
| 125 |
+
# Clean up partial download
|
| 126 |
+
if os.path.exists(zip_path):
|
| 127 |
+
os.remove(zip_path)
|
| 128 |
+
return False
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
if __name__ == "__main__":
|
| 132 |
+
variant = sys.argv[1] if len(sys.argv) > 1 else "tiny"
|
| 133 |
+
success = download_variant(variant)
|
| 134 |
+
if not success:
|
| 135 |
+
sys.exit(1)
|
sam2/sam2_hiera_tiny.decoder.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5a4bd656c143899fb7f52d64ed81e6f6aeb37d477a0b6da50146ac7cf2187bf
|
| 3 |
+
size 20640886
|
sam2/sam2_hiera_tiny.encoder.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4cc015ee18520e93f8c7ddfeaca7436039daaaaf19721b4b96a8810a805e82f7
|
| 3 |
+
size 134261315
|
spade_generator.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca04fbec765745e9eae836d2d7522c274647b277ce5f25104fa1705b75222212
|
| 3 |
+
size 221771768
|
warping_module.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7b7834bd6039b4088f72e5161e60ad366f68a3763df8a3eac0bc0f9d46fdbbf
|
| 3 |
+
size 182158564
|
xseg.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b57328efcb839d85973164b617ceee9dfe6cfcb2c82e8a033bba9f4f09b27e5
|
| 3 |
+
size 70327737
|