linhaotong commited on
Commit
6a8ae2c
·
1 Parent(s): d55de36

update examples

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +39 -0
  2. app.py +45 -0
  3. depth_anything_3/__pycache__/api.cpython-311.pyc +0 -0
  4. depth_anything_3/__pycache__/cfg.cpython-311.pyc +0 -0
  5. depth_anything_3/__pycache__/cli.cpython-311.pyc +0 -0
  6. depth_anything_3/__pycache__/registry.cpython-311.pyc +0 -0
  7. depth_anything_3/__pycache__/specs.cpython-311.pyc +0 -0
  8. depth_anything_3/app/__pycache__/css_and_html.cpython-311.pyc +0 -0
  9. depth_anything_3/app/__pycache__/gradio_app.cpython-311.pyc +0 -0
  10. depth_anything_3/app/modules/__pycache__/__init__.cpython-311.pyc +0 -0
  11. depth_anything_3/app/modules/__pycache__/event_handlers.cpython-311.pyc +0 -0
  12. depth_anything_3/app/modules/__pycache__/file_handlers.cpython-311.pyc +0 -0
  13. depth_anything_3/app/modules/__pycache__/model_inference.cpython-311.pyc +0 -0
  14. depth_anything_3/app/modules/__pycache__/ui_components.cpython-311.pyc +0 -0
  15. depth_anything_3/app/modules/__pycache__/utils.cpython-311.pyc +0 -0
  16. depth_anything_3/app/modules/__pycache__/visualization.cpython-311.pyc +0 -0
  17. depth_anything_3/model/__pycache__/__init__.cpython-311.pyc +0 -0
  18. depth_anything_3/model/__pycache__/cam_dec.cpython-311.pyc +0 -0
  19. depth_anything_3/model/__pycache__/cam_enc.cpython-311.pyc +0 -0
  20. depth_anything_3/model/__pycache__/da3.cpython-311.pyc +0 -0
  21. depth_anything_3/model/__pycache__/dpt.cpython-311.pyc +0 -0
  22. depth_anything_3/model/__pycache__/dualdpt.cpython-311.pyc +0 -0
  23. depth_anything_3/model/__pycache__/gs_adapter.cpython-311.pyc +0 -0
  24. depth_anything_3/model/__pycache__/gsdpt.cpython-311.pyc +0 -0
  25. depth_anything_3/model/dinov2/__pycache__/dinov2.cpython-311.pyc +0 -0
  26. depth_anything_3/model/dinov2/__pycache__/vision_transformer.cpython-311.pyc +0 -0
  27. depth_anything_3/model/dinov2/layers/__pycache__/__init__.cpython-311.pyc +0 -0
  28. depth_anything_3/model/dinov2/layers/__pycache__/attention.cpython-311.pyc +0 -0
  29. depth_anything_3/model/dinov2/layers/__pycache__/block.cpython-311.pyc +0 -0
  30. depth_anything_3/model/dinov2/layers/__pycache__/drop_path.cpython-311.pyc +0 -0
  31. depth_anything_3/model/dinov2/layers/__pycache__/layer_scale.cpython-311.pyc +0 -0
  32. depth_anything_3/model/dinov2/layers/__pycache__/mlp.cpython-311.pyc +0 -0
  33. depth_anything_3/model/dinov2/layers/__pycache__/patch_embed.cpython-311.pyc +0 -0
  34. depth_anything_3/model/dinov2/layers/__pycache__/rope.cpython-311.pyc +0 -0
  35. depth_anything_3/model/dinov2/layers/__pycache__/swiglu_ffn.cpython-311.pyc +0 -0
  36. depth_anything_3/model/utils/__pycache__/attention.cpython-311.pyc +0 -0
  37. depth_anything_3/model/utils/__pycache__/block.cpython-311.pyc +0 -0
  38. depth_anything_3/model/utils/__pycache__/gs_renderer.cpython-311.pyc +0 -0
  39. depth_anything_3/model/utils/__pycache__/head_utils.cpython-311.pyc +0 -0
  40. depth_anything_3/model/utils/__pycache__/transform.cpython-311.pyc +0 -0
  41. depth_anything_3/services/__pycache__/__init__.cpython-311.pyc +0 -0
  42. depth_anything_3/services/__pycache__/backend.cpython-311.pyc +0 -0
  43. depth_anything_3/services/__pycache__/gallery.cpython-311.pyc +0 -0
  44. depth_anything_3/services/__pycache__/inference_service.cpython-311.pyc +0 -0
  45. depth_anything_3/services/__pycache__/input_handlers.cpython-311.pyc +0 -0
  46. depth_anything_3/utils/__pycache__/alignment.cpython-311.pyc +0 -0
  47. depth_anything_3/utils/__pycache__/camera_trj_helpers.cpython-311.pyc +0 -0
  48. depth_anything_3/utils/__pycache__/constants.cpython-311.pyc +0 -0
  49. depth_anything_3/utils/__pycache__/geometry.cpython-311.pyc +0 -0
  50. depth_anything_3/utils/__pycache__/gsply_helpers.cpython-311.pyc +0 -0
.gitignore ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ __pycache__/
6
+ *.so
7
+ *.egg
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+
12
+ # Workspace
13
+ workspace/gradio/input_images/
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+
22
+ # OS
23
+ .DS_Store
24
+ Thumbs.db
25
+
26
+ # Environment
27
+ .env
28
+ .venv
29
+ env/
30
+ venv/
31
+ ENV/
32
+
33
+ # Jupyter
34
+ .ipynb_checkpoints/
35
+ *.ipynb
36
+
37
+ # Logs
38
+ *.log
39
+
app.py CHANGED
@@ -62,11 +62,56 @@ if __name__ == "__main__":
62
  gallery_dir=gallery_dir
63
  )
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  # Launch with Spaces-friendly settings
66
  print("🚀 Launching Depth Anything 3 on Hugging Face Spaces...")
67
  print(f"📦 Model Directory: {model_dir}")
68
  print(f"📁 Workspace Directory: {workspace_dir}")
69
  print(f"🖼️ Gallery Directory: {gallery_dir}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  # Launch with minimal, Spaces-compatible configuration
72
  # Some parameters may cause routing issues, so we use minimal config
 
62
  gallery_dir=gallery_dir
63
  )
64
 
65
+ # Check if examples directory exists
66
+ examples_dir = os.path.join(workspace_dir, "examples")
67
+ examples_exist = os.path.exists(examples_dir)
68
+
69
+ # Check if caching is enabled via environment variable (default: True if examples exist)
70
+ # Allow disabling via environment variable: DA3_CACHE_EXAMPLES=false
71
+ cache_examples_env = os.environ.get("DA3_CACHE_EXAMPLES", "").lower()
72
+ if cache_examples_env in ("false", "0", "no"):
73
+ cache_examples = False
74
+ elif cache_examples_env in ("true", "1", "yes"):
75
+ cache_examples = True
76
+ else:
77
+ # Default: enable caching if examples directory exists
78
+ cache_examples = examples_exist
79
+
80
+ # Get cache_gs_tag from environment variable (default: "dl3dv")
81
+ cache_gs_tag = os.environ.get("DA3_CACHE_GS_TAG", "dl3dv")
82
+
83
  # Launch with Spaces-friendly settings
84
  print("🚀 Launching Depth Anything 3 on Hugging Face Spaces...")
85
  print(f"📦 Model Directory: {model_dir}")
86
  print(f"📁 Workspace Directory: {workspace_dir}")
87
  print(f"🖼️ Gallery Directory: {gallery_dir}")
88
+ print(f"💾 Cache Examples: {cache_examples}")
89
+ if cache_examples:
90
+ if cache_gs_tag:
91
+ print(f"🏷️ Cache GS Tag: '{cache_gs_tag}' (scenes matching this tag will use high-res + 3DGS)")
92
+ else:
93
+ print("🏷️ Cache GS Tag: None (all scenes will use low-res only)")
94
+
95
+ # Pre-cache examples if requested
96
+ if cache_examples:
97
+ print("\n" + "=" * 60)
98
+ print("Pre-caching mode enabled")
99
+ if cache_gs_tag:
100
+ print(f"Scenes containing '{cache_gs_tag}' will use HIGH-RES + 3DGS")
101
+ print("Other scenes will use LOW-RES only")
102
+ else:
103
+ print("All scenes will use LOW-RES only")
104
+ print("=" * 60)
105
+ app.cache_examples(
106
+ show_cam=True,
107
+ filter_black_bg=False,
108
+ filter_white_bg=False,
109
+ save_percentage=5.0,
110
+ num_max_points=1000,
111
+ cache_gs_tag=cache_gs_tag,
112
+ gs_trj_mode="smooth",
113
+ gs_video_quality="low",
114
+ )
115
 
116
  # Launch with minimal, Spaces-compatible configuration
117
  # Some parameters may cause routing issues, so we use minimal config
depth_anything_3/__pycache__/api.cpython-311.pyc DELETED
Binary file (17.9 kB)
 
depth_anything_3/__pycache__/cfg.cpython-311.pyc DELETED
Binary file (6.98 kB)
 
depth_anything_3/__pycache__/cli.cpython-311.pyc DELETED
Binary file (27.2 kB)
 
depth_anything_3/__pycache__/registry.cpython-311.pyc DELETED
Binary file (1.71 kB)
 
depth_anything_3/__pycache__/specs.cpython-311.pyc DELETED
Binary file (1.73 kB)
 
depth_anything_3/app/__pycache__/css_and_html.cpython-311.pyc DELETED
Binary file (18.5 kB)
 
depth_anything_3/app/__pycache__/gradio_app.cpython-311.pyc DELETED
Binary file (27.9 kB)
 
depth_anything_3/app/modules/__pycache__/__init__.cpython-311.pyc DELETED
Binary file (1.22 kB)
 
depth_anything_3/app/modules/__pycache__/event_handlers.cpython-311.pyc DELETED
Binary file (25.3 kB)
 
depth_anything_3/app/modules/__pycache__/file_handlers.cpython-311.pyc DELETED
Binary file (13 kB)
 
depth_anything_3/app/modules/__pycache__/model_inference.cpython-311.pyc DELETED
Binary file (12.3 kB)
 
depth_anything_3/app/modules/__pycache__/ui_components.cpython-311.pyc DELETED
Binary file (19.3 kB)
 
depth_anything_3/app/modules/__pycache__/utils.cpython-311.pyc DELETED
Binary file (9.22 kB)
 
depth_anything_3/app/modules/__pycache__/visualization.cpython-311.pyc DELETED
Binary file (19 kB)
 
depth_anything_3/model/__pycache__/__init__.cpython-311.pyc DELETED
Binary file (379 Bytes)
 
depth_anything_3/model/__pycache__/cam_dec.cpython-311.pyc DELETED
Binary file (2.72 kB)
 
depth_anything_3/model/__pycache__/cam_enc.cpython-311.pyc DELETED
Binary file (3.24 kB)
 
depth_anything_3/model/__pycache__/da3.cpython-311.pyc DELETED
Binary file (15.9 kB)
 
depth_anything_3/model/__pycache__/dpt.cpython-311.pyc DELETED
Binary file (22.9 kB)
 
depth_anything_3/model/__pycache__/dualdpt.cpython-311.pyc DELETED
Binary file (20 kB)
 
depth_anything_3/model/__pycache__/gs_adapter.cpython-311.pyc DELETED
Binary file (8.79 kB)
 
depth_anything_3/model/__pycache__/gsdpt.cpython-311.pyc DELETED
Binary file (5.47 kB)
 
depth_anything_3/model/dinov2/__pycache__/dinov2.cpython-311.pyc DELETED
Binary file (2.27 kB)
 
depth_anything_3/model/dinov2/__pycache__/vision_transformer.cpython-311.pyc DELETED
Binary file (22.3 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/__init__.cpython-311.pyc DELETED
Binary file (709 Bytes)
 
depth_anything_3/model/dinov2/layers/__pycache__/attention.cpython-311.pyc DELETED
Binary file (5.33 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/block.cpython-311.pyc DELETED
Binary file (6.87 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/drop_path.cpython-311.pyc DELETED
Binary file (1.89 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/layer_scale.cpython-311.pyc DELETED
Binary file (1.99 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/mlp.cpython-311.pyc DELETED
Binary file (2.13 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/patch_embed.cpython-311.pyc DELETED
Binary file (4.52 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/rope.cpython-311.pyc DELETED
Binary file (9.82 kB)
 
depth_anything_3/model/dinov2/layers/__pycache__/swiglu_ffn.cpython-311.pyc DELETED
Binary file (3.34 kB)
 
depth_anything_3/model/utils/__pycache__/attention.cpython-311.pyc DELETED
Binary file (6.64 kB)
 
depth_anything_3/model/utils/__pycache__/block.cpython-311.pyc DELETED
Binary file (3.81 kB)
 
depth_anything_3/model/utils/__pycache__/gs_renderer.cpython-311.pyc DELETED
Binary file (14.4 kB)
 
depth_anything_3/model/utils/__pycache__/head_utils.cpython-311.pyc DELETED
Binary file (10 kB)
 
depth_anything_3/model/utils/__pycache__/transform.cpython-311.pyc DELETED
Binary file (9.18 kB)
 
depth_anything_3/services/__pycache__/__init__.cpython-311.pyc DELETED
Binary file (432 Bytes)
 
depth_anything_3/services/__pycache__/backend.cpython-311.pyc DELETED
Binary file (65.1 kB)
 
depth_anything_3/services/__pycache__/gallery.cpython-311.pyc DELETED
Binary file (42.8 kB)
 
depth_anything_3/services/__pycache__/inference_service.cpython-311.pyc DELETED
Binary file (8.43 kB)
 
depth_anything_3/services/__pycache__/input_handlers.cpython-311.pyc DELETED
Binary file (14.3 kB)
 
depth_anything_3/utils/__pycache__/alignment.cpython-311.pyc DELETED
Binary file (6.15 kB)
 
depth_anything_3/utils/__pycache__/camera_trj_helpers.cpython-311.pyc DELETED
Binary file (24 kB)
 
depth_anything_3/utils/__pycache__/constants.cpython-311.pyc DELETED
Binary file (432 Bytes)
 
depth_anything_3/utils/__pycache__/geometry.cpython-311.pyc DELETED
Binary file (15.9 kB)
 
depth_anything_3/utils/__pycache__/gsply_helpers.cpython-311.pyc DELETED
Binary file (8.92 kB)