Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ nul
# Claude AI
.claude/
CLAUDE.md
.DS_Store
48 changes: 30 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This aims to be a camera-agnostic ROS2 wrapper for Depth Anything 3 (DA3), provi
- **Docker Support**: Pre-configured Docker and Docker Compose files
- **Example Images**: Sample test images and benchmark scripts included
- **Performance Profiling**: Built-in benchmarking and profiling tools
- **TensorRT Support**: Validated 6.8x speedup on Jetson (35.3 FPS) - see [TensorRT Status](#tensorrt-status-validated)
- **TensorRT Support**: Validated 7.7x speedup on Jetson (40 FPS @ 518x518, 93 FPS @ 308x308) - see [TensorRT Status](#tensorrt-status-validated)
- **Post-Processing**: Depth map filtering, hole filling, and enhancement
- **INT8 Quantization**: Model compression for faster inference
- **ONNX Export**: Deploy to various platforms and runtimes
Expand Down Expand Up @@ -516,7 +516,7 @@ bash scripts/demo.sh
The demo script will:
1. **Auto-detect cameras** (USB and CSI) and let you select if multiple are found
2. **Build TensorRT engine** on first run (~2 minutes)
3. **Start TRT inference service** for 35+ FPS performance
3. **Start TRT inference service** for 40+ FPS performance (93+ FPS at 308x308)
4. **Launch Docker container** with ROS2 depth estimation node
5. **Open performance monitor** showing live FPS, latency, and GPU stats
6. **Optionally launch RViz2** for visualization
Expand Down Expand Up @@ -577,8 +577,8 @@ The performance monitor displays real-time metrics:
TensorRT Inference Service
----------------------------------------
Status: Running
FPS: 35.2
Latency: 28.4 ms
FPS: 40.1
Latency: 25.0 ms
Frames: 1024

GPU Resources
Expand Down Expand Up @@ -1120,11 +1120,11 @@ Measured on Jetson Orin NX 16GB (JetPack 6.0, L4T r36.2.0):
|-------|---------|------------|-----|----------------|
| DA3-SMALL | PyTorch FP32 | 518x518 | ~5.2 | ~193ms |

**Update (2026-01-31)**: TensorRT acceleration now validated with 6.8x speedup. See [TensorRT Status](#tensorrt-status-validated) below.
**Update (2026-02-02)**: TensorRT acceleration validated with up to 17.8x speedup (93 FPS @ 308x308). See [TensorRT Status](#tensorrt-status-validated) and [Benchmarks](docs/JETSON_BENCHMARKS.md) for details.

### TensorRT Status: VALIDATED (Host-Container Split)

TensorRT acceleration validated on Jetson Orin NX 16GB with **6.8x speedup** (35.3 FPS vs 5.2 FPS baseline).
TensorRT acceleration validated on Jetson Orin NX 16GB with **7.7x speedup** (40 FPS @ 518x518, 93 FPS @ 308x308).

#### Architecture: Host-Container Split

Expand Down Expand Up @@ -1157,18 +1157,23 @@ Due to broken TensorRT Python bindings in available Jetson containers ([dusty-nv
- Container TRT 8.6 cannot build DA3 engines (DINOv2 incompatibility)
- Host TRT 10.3 works perfectly (validated at 29.8ms latency)

#### Validated Performance (2026-01-31)
#### Validated Performance (2026-02-02)

| Metric | Value |
|--------|-------|
| Platform | Jetson Orin NX 16GB |
| JetPack | 6.2.1 (L4T R36.4.7) |
| JetPack | 6.2 (L4T R36.4) |
| TensorRT | 10.3.0.30 (host) |
| Model | DA3-SMALL @ 518x518 FP16 |
| Throughput | 35.3 FPS |
| Latency (median) | 26.4ms |
| Engine Size | 58MB |
| Speedup | 6.8x vs PyTorch |
| CUDA | 12.6 |

| Configuration | FPS | Latency | Speedup |
|--------------|-----|---------|---------|
| DA3-Small @ 518x518 FP16 | **40 FPS** | 25.0ms | 7.7x |
| DA3-Small @ 400x400 FP16 | **64 FPS** | 15.8ms | 12.2x |
| DA3-Small @ 308x308 FP16 | **93 FPS** | 10.9ms | 17.8x |
| DA3-Small @ 256x256 FP16 | **110 FPS** | 9.1ms | 21.2x |

Thermal stability validated: 10-minute sustained load at 40.79 FPS with no throttling.

#### Quick Start

Expand Down Expand Up @@ -1196,12 +1201,19 @@ See [docs/JETSON_DEPLOYMENT_GUIDE.md](docs/JETSON_DEPLOYMENT_GUIDE.md) for compl

### Validated TensorRT Performance

Measured on Jetson Orin NX 16GB with TensorRT 10.3 (2026-01-31):
Measured on Jetson Orin NX 16GB with TensorRT 10.3 (2026-02-02):

| Model | Backend | Resolution | FPS | Latency | Speedup |
|-------|---------|------------|-----|---------|---------|
| DA3-Small | TensorRT FP16 | 518x518 | **40.1** | 25.0ms | 7.7x |
| DA3-Small | TensorRT FP16 | 400x400 | **63.6** | 15.8ms | 12.2x |
| DA3-Small | TensorRT FP16 | 308x308 | **92.6** | 10.9ms | 17.8x |
| DA3-Small | TensorRT FP16 | 256x256 | **110.2** | 9.1ms | 21.2x |
| DA3-Base | TensorRT FP16 | 518x518 | **19.2** | 51.4ms | - |
| DA3-Large | TensorRT FP16 | 518x518 | **7.5** | 132.2ms | - |
| DA3-Small | PyTorch FP32 | 518x518 | ~5.2 | ~193ms | Baseline |

| Model | Backend | Resolution | FPS | GPU Latency | Speedup vs PyTorch |
|-------|---------|------------|-----|-------------|-------------------|
| DA3-SMALL | TensorRT FP16 | 518x518 | 35.3 | 26.4ms (median) | 6.8x |
| DA3-SMALL | PyTorch FP32 | 518x518 | 5.2 | ~193ms | Baseline |
See [docs/JETSON_BENCHMARKS.md](docs/JETSON_BENCHMARKS.md) for comprehensive benchmarks.

### Optimization Tips (Current)

Expand Down
88 changes: 63 additions & 25 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Executive Summary

| Metric | PyTorch Baseline | TensorRT 10.3 FP16 |
|--------|------------------|-------------------|
| FPS | 5.2 | **35.3** |
| Latency | 193ms | **26.4ms** |
| Speedup | 1x | **6.8x** |
| Engine | N/A | 58MB |
| Metric | PyTorch Baseline | TensorRT 10.3 FP16 (518x518) | TensorRT 10.3 FP16 (308x308) |
|--------|------------------|------------------------------|------------------------------|
| FPS | 5.2 | **40.1** | **92.6** |
| Latency | 193ms | **25.0ms** | **10.9ms** |
| Speedup | 1x | **7.7x** | **17.8x** |
| Engine | N/A | 64MB | 60MB |

**Platform:** Jetson Orin NX 16GB, JetPack 6.2.1, TensorRT 10.3.0.30
**Platform:** Jetson Orin NX 16GB, JetPack 6.2, TensorRT 10.3

---

Expand All @@ -22,7 +22,7 @@

---

## Phase 2: Host-Container Split Architecture [IN PROGRESS]
## Phase 2: Host-Container Split Architecture [COMPLETE]

**Problem:** Container TensorRT Python bindings are broken:
- `dustynv/l4t-pytorch:r36.4.0` - TRT import fails ([Issue #714](https://github.com/dusty-nv/jetson-containers/issues/714))
Expand All @@ -40,36 +40,74 @@ HOST (TRT 10.3) CONTAINER (ROS2)
+------------------+ +------------------+
```

### Files to Create (Claude Code)
- [ ] `scripts/trt_inference_service.py` - Host TRT service
- [ ] Update `da3_inference.py` - Add SharedMemoryInference class
- [ ] Update `deploy_jetson.sh` - Start host service + container
### Implementation (Complete)
- [x] `scripts/trt_inference_service.py` - Host TRT service with file-based IPC
- [x] `depth_anything_3_ros2/da3_inference.py` - SharedMemoryInference class with PyTorch fallback
- [x] `scripts/deploy_jetson.sh --host-trt` - Orchestrates host service + container startup

### Communication Protocol
| File | Direction | Format |
|------|-----------|--------|
| `/tmp/da3_shared/input.npy` | Container -> Host | float32 [1,1,3,518,518] |
| `/tmp/da3_shared/output.npy` | Host -> Container | float32 [1,518,518] |
| `/tmp/da3_shared/request.flag` | Container -> Host | Signal file |
| `/tmp/da3_shared/ready.flag` | Host -> Container | Signal file |
| `/tmp/da3_shared/request` | Container -> Host | Timestamp signal |
| `/tmp/da3_shared/status` | Host -> Container | "ready", "complete:time", "error:msg" |

### Deployment
```bash
# Fresh Jetson deployment
cd ~
rm -rf ~/depth_anything_3_ros2 ~/ros2_ws ~/da3_fresh_test
git clone https://github.com/GerdsenAI/Depth-Anything-3-ROS2-Wrapper.git depth_anything_3_ros2
cd depth_anything_3_ros2
pip3 install pycuda --break-system-packages
bash scripts/deploy_jetson.sh --host-trt
```

---

## Phase 3: Resolution Tuning [PENDING]
## Phase 3: Performance Benchmarking [COMPLETE]

### Resolution Benchmarks (DA3-Small)

| Resolution | Throughput | Latency | Speedup |
|------------|------------|---------|---------|
| 518x518 | 40.1 FPS | 25.0ms | 1.0x |
| 400x400 | 63.6 FPS | 15.8ms | 1.6x |
| 308x308 | 92.6 FPS | 10.9ms | 2.3x |
| 256x256 | 110.2 FPS | 9.1ms | 2.7x |

### Model Size Benchmarks (518x518)

| Resolution | Expected FPS |
|------------|--------------|
| 518x518 | 35 (validated) |
| 400x400 | ~45 |
| 308x308 | ~55 |
| Model | Parameters | Throughput | Latency | Engine Size |
|-------|------------|------------|---------|-------------|
| DA3-Small | ~24M | 40.0 FPS | 25.0ms | 64MB |
| DA3-Base | ~97M | 19.2 FPS | 51.4ms | 211MB |
| DA3-Large | ~335M | 7.5 FPS | 132.2ms | 674MB |

**Recommendation:** DA3-Small @ 308-400px for real-time robotics (64-93 FPS)

See `docs/JETSON_BENCHMARKS.md` for full benchmark documentation.

---

## Phase 4: Thermal/Stability Validation [PENDING]
## Phase 4: Thermal/Stability Validation [COMPLETE]

### 10-Minute Sustained Load Test Results

| Metric | Value |
|--------|-------|
| Duration | 600.06 seconds |
| Status | **PASSED** |
| Throughput | 40.79 FPS (stable) |
| Latency (mean) | 24.73ms |
| Latency (min) | 24.25ms |
| Latency (max) | 27.88ms |
| Latency (p99) | 25.19ms |

- [ ] 10-minute sustained load test
- [ ] GPU temp monitoring (<80C target)
- [ ] FPS stability check
- [x] 10-minute sustained load test - **PASSED**
- [x] FPS stability check - **PASSED** (variance < 5%)
- [x] No thermal throttling detected (consistent performance throughout)

---

Expand All @@ -82,4 +120,4 @@ HOST (TRT 10.3) CONTAINER (ROS2)

---

**Last Updated:** 2026-01-31
**Last Updated:** 2026-02-02
Loading
Loading