Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ When used for **privacy mode**, the `depth_only` blend mode fully anonymizes the
| Platform | Backend | Runtime | Model |
|----------|---------|---------|-------|
| **macOS** | CoreML | Apple Neural Engine | `apple/coreml-depth-anything-v2-small` (.mlpackage) |
| Linux/Windows | PyTorch | CUDA / CPU | `depth-anything/Depth-Anything-V2-Small` (.pth) |
| Windows/Linux | **TensorRT** | NVIDIA TRT FP16 | Auto-built `.trt` engine (from ONNX) |
| Windows/Linux | PyTorch | CUDA / CPU | `depth-anything/Depth-Anything-V2-Small` (.pth) |

On macOS, CoreML runs on the Neural Engine, leaving the GPU free for other tasks. The model is auto-downloaded from HuggingFace and stored at `~/.aegis-ai/models/feature-extraction/`.
On macOS, CoreML runs on the Neural Engine, leaving the GPU free for other tasks.
On Windows/Linux with NVIDIA GPUs, TensorRT FP16 provides 2-4x speedup over vanilla PyTorch CUDA. Engines are auto-built on first run and cached at `~/.aegis-ai/models/feature-extraction/trt_engines/`.
The model is auto-downloaded from HuggingFace and stored at `~/.aegis-ai/models/feature-extraction/`.

## What You Get

Expand Down
2 changes: 1 addition & 1 deletion skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"id": "depth-estimation",
"name": "Depth Estimation (Privacy)",
"description": "Privacy-first depth map transforms — anonymize camera feeds with Depth Anything v2 while preserving spatial awareness.",
"version": "1.1.0",
"version": "1.2.0",
"category": "privacy",
"path": "skills/transformation/depth-estimation",
"tags": [
Expand Down
66 changes: 66 additions & 0 deletions skills/transformation/depth-estimation/deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@echo off
REM deploy.bat — Windows deployment for Depth Estimation (Privacy) skill
REM Creates venv, installs PyTorch + CUDA dependencies, verifies GPU detection.
REM
REM The Aegis deployment agent calls this on Windows instead of deploy.sh.

setlocal enabledelayedexpansion

set "SCRIPT_DIR=%~dp0"
set "VENV_DIR=%SCRIPT_DIR%.venv"
set "MODELS_DIR=%USERPROFILE%\.aegis-ai\models\feature-extraction"

echo === Depth Estimation (Privacy) — Windows Setup ===

REM ── Create venv ───────────────────────────────────────────────────
if not exist "%VENV_DIR%" (
echo Creating virtual environment...
python -m venv "%VENV_DIR%"
if errorlevel 1 (
echo ERROR: Failed to create virtual environment. Is Python installed?
exit /b 1
)
)

set "PIP=%VENV_DIR%\Scripts\pip.exe"
set "PYTHON=%VENV_DIR%\Scripts\python.exe"

REM Upgrade pip
"%PIP%" install --upgrade pip --quiet

echo.
echo === Windows — PyTorch backend (CUDA/CPU) ===
echo Installing PyTorch dependencies...
"%PIP%" install --quiet -r "%SCRIPT_DIR%requirements.txt"

if errorlevel 1 (
echo ERROR: pip install failed. Check requirements.txt and network connectivity.
exit /b 1
)

echo [OK] PyTorch dependencies installed

REM ── Verify installation ───────────────────────────────────────────
"%PYTHON%" -c "import torch, cv2, numpy, PIL; from depth_anything_v2.dpt import DepthAnythingV2; cuda = 'YES' if torch.cuda.is_available() else 'NO'; gpu = torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'N/A'; print(f'[OK] Verified: torch={torch.__version__}, CUDA={cuda}, GPU={gpu}')"

if errorlevel 1 (
echo WARNING: Verification failed. Some packages may not be installed correctly.
echo Trying minimal verification...
"%PYTHON%" -c "import torch; print(f'torch={torch.__version__}, CUDA={torch.cuda.is_available()}')"
)

REM ── TensorRT verification (optional) ──────────────────────────────
echo.
echo === TensorRT Check ===
"%PYTHON%" -c "import tensorrt; print(f'[OK] TensorRT={tensorrt.__version__}')" 2>nul
if errorlevel 1 (
echo [INFO] TensorRT not available — will use PyTorch CUDA backend
echo [INFO] To enable TensorRT: pip install tensorrt
) else (
echo [OK] TensorRT FP16 acceleration available
)

echo.
echo === Setup complete ===

endlocal
123 changes: 123 additions & 0 deletions skills/transformation/depth-estimation/models.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"studio": {
"title": "3D Depth Vision Studio",
"subtitle": "Convert 2D video to 3D depth maps • Privacy-first scene understanding",
"icon": "layers"
},
"models_dir": "~/.aegis-ai/models/feature-extraction",
"models": {
"depth-anything-v2-small": {
"name": "Depth Anything V2 Small",
"type": "depth_estimation",
"input_size": [518, 392],
"description": "Monocular depth estimation — fast, lightweight model",
"platforms": {
"darwin": {
"repository": "apple/coreml-depth-anything-v2-small",
"format": "mlpackage",
"variants": {
"DepthAnythingV2SmallF16": {
"precision": "float16",
"size_mb": 49.8,
"description": "Float16 — Optimized for Neural Engine"
},
"DepthAnythingV2SmallF32": {
"precision": "float32",
"size_mb": 99.2,
"description": "Float32 — Highest precision"
}
}
},
"win32": {
"repository": "depth-anything/Depth-Anything-V2-Small",
"format": "pth",
"variants": {
"depth_anything_v2_vits": {
"precision": "float32",
"size_mb": 99,
"description": "PyTorch ViT-S — CUDA/CPU/MPS compatible"
},
"depth_anything_v2_vits_trt_fp16": {
"precision": "float16",
"format": "trt",
"size_mb": 25,
"description": "TensorRT FP16 — Fastest (requires NVIDIA GPU + TensorRT)",
"requires": "tensorrt"
}
}
},
"linux": {
"repository": "depth-anything/Depth-Anything-V2-Small",
"format": "pth",
"variants": {
"depth_anything_v2_vits": {
"precision": "float32",
"size_mb": 99,
"description": "PyTorch ViT-S — CUDA/CPU compatible"
}
}
}
}
},
"depth-anything-v2-base": {
"name": "Depth Anything V2 Base",
"type": "depth_estimation",
"input_size": [518, 392],
"description": "Monocular depth estimation — balanced speed and accuracy",
"platforms": {
"win32": {
"repository": "depth-anything/Depth-Anything-V2-Base",
"format": "pth",
"variants": {
"depth_anything_v2_vitb": {
"precision": "float32",
"size_mb": 390,
"description": "PyTorch ViT-B — CUDA/CPU/MPS compatible"
}
}
},
"linux": {
"repository": "depth-anything/Depth-Anything-V2-Base",
"format": "pth",
"variants": {
"depth_anything_v2_vitb": {
"precision": "float32",
"size_mb": 390,
"description": "PyTorch ViT-B — CUDA/CPU compatible"
}
}
}
}
},
"depth-anything-v2-large": {
"name": "Depth Anything V2 Large",
"type": "depth_estimation",
"input_size": [518, 392],
"description": "Monocular depth estimation — highest accuracy, more VRAM required",
"platforms": {
"win32": {
"repository": "depth-anything/Depth-Anything-V2-Large",
"format": "pth",
"variants": {
"depth_anything_v2_vitl": {
"precision": "float32",
"size_mb": 1340,
"description": "PyTorch ViT-L — CUDA recommended (1.3 GB)"
}
}
},
"linux": {
"repository": "depth-anything/Depth-Anything-V2-Large",
"format": "pth",
"variants": {
"depth_anything_v2_vitl": {
"precision": "float32",
"size_mb": 1340,
"description": "PyTorch ViT-L — CUDA recommended (1.3 GB)"
}
}
}
}
}
}
}
14 changes: 14 additions & 0 deletions skills/transformation/depth-estimation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Depth Estimation — Privacy Transform Skill
# CoreML-first on macOS (Neural Engine), PyTorch fallback on other platforms.
#
# INSTALL WITH: pip install --ignore-requires-python -r requirements.txt
# The depth-anything-v2 PyPI wheel declares python_requires>=3.12 in its
# metadata, but is pure Python (py3-none-any) and works on Python 3.11+.
#
# macOS: coremltools loads .mlpackage models — fast, leaves GPU free.
# Other: PyTorch + depth-anything-v2 pip package + HF weights.
# Common: opencv, numpy, pillow, huggingface_hub for model download.

# ── CUDA (NVIDIA systems get CUDA wheels, CPU-only falls back) ───────
--extra-index-url https://download.pytorch.org/whl/cu126

# ── CoreML (macOS only) ──────────────────────────────────────────────
coremltools>=8.0; sys_platform == "darwin"

Expand All @@ -20,3 +27,10 @@ numpy>=1.24.0
opencv-python-headless>=4.8.0
Pillow>=10.0.0
matplotlib>=3.7.0

# ── TensorRT acceleration (optional, NVIDIA only) ───────────────────
# Provides ~2-4x speedup over vanilla PyTorch CUDA via FP16 inference.
# Requires NVIDIA GPU with Compute Capability >= 7.0 (Turing+).
# If not installed, the skill gracefully falls back to PyTorch.
tensorrt>=10.0; sys_platform != "darwin"
onnxruntime-gpu>=1.17.0; sys_platform != "darwin"
Loading