A production-grade benchmarking framework for comparing monocular depth estimation models against Intel RealSense depth sensing, with pose-aware analysis and temporal refinement.
✓ 8 State-of-the-Art Depth Models
✓ Advanced Processing
✓ RealSense Integration
✓ Comprehensive Metrics
✓ Pose Estimation
✓ Visualizations
depth_benchmark/
├── common/ # Shared utilities
│ ├── config.py # Configuration management
│ ├── utils.py # General utilities
│ ├── video_loader.py # Video/RealSense .bag loading
│ ├── frame_extractor.py # Frame extraction
│ ├── depth_alignment.py # Depth alignment
│ ├── metrics.py # Metric computation
│ ├── pose_estimation.py # MediaPipe integration
│ ├── temporal_refinement.py # DepthCrafter refinement
│ └── visualization.py # Visualization utilities
│
├── models/ # Depth model runners
│ ├── base_model.py # Base model class
│ ├── midas_runner.py
│ ├── depth_anything_runner.py
│ ├── depth_anything_v2_runner.py
│ ├── zoedepth_runner.py
│ ├── dpt_large_runner.py
│ ├── depth_pro_runner.py
│ ├── leres_runner.py
│ └── bts_runner.py
│
├── benchmark/ # Benchmarking pipeline
│ ├── benchmark_pipeline.py # Main pipeline
│ ├── compare_models.py # Model comparison utilities
│ ├── generate_csv.py # CSV export
│ └── generate_report.py # Report generation
│
├── notebooks/ # Jupyter notebooks
│ ├── evaluation.ipynb # Full evaluation pipeline
│ └── visualization.ipynb # Results visualization
│
├── outputs/ # Results (auto-created)
│ ├── raw_depth/
│ ├── refined_depth/
│ ├── metrics/
│ ├── visualizations/
│ └── pose_results/
│
├── config.yaml # Main configuration
├── main.py # Entry point
└── requirements.txt # Dependencies
git clone https://github.com/M0hammedAyan/Models-Check.git
python3.10 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
# Depth Anything
git clone https://github.com/LiheYoung/Depth-Anything
cd Depth-Anything
pip install -e .
cd ..
# Depth Anything V2
pip install git+https://github.com/DepthAnything/Depth-Anything-V2.git
# ZoeDepth
pip install git+https://github.com/isl-org/ZoeDepth.git
# Depth Pro (if available)
pip install git+https://github.com/apple/depth-pro.git
# RealSense (for .bag support)
pip install pyrealsense2
# FLOPs calculation
pip install fvcore
# Development tools
pip install black pylint pytest
Organize test data in the following structure:
test_data/
├── Ncam/
│ ├── video1.mp4
│ └── video2.mp4
└── Realsense/
├── recording1.bag
└── recording2.bag
Edit config.yaml:
data:
video_path: ../test_data/Ncam/video.mp4 # or set via CLI
bag_path: ../test_data/Realsense/recording.bag
output_dir: ./outputs
device: cuda
# Full benchmark with all models
python main.py --config config.yaml --input-video ../test_data/Ncam/video.mp4
# With RealSense .bag
python main.py --config config.yaml --input-bag ../test_data/Realsense/recording.bag
# Specific models only
python main.py --config config.yaml --models midas depth_anything dpt_large
# On CPU
python main.py --config config.yaml --device cpu
# Skip pose estimation
python main.py --config config.yaml --skip-pose
# Skip temporal refinement
python main.py --config config.yaml --skip-temporal-refinement
On Raspberry Pi 5, run one model at a time with CPU-only inference and optional pose/refinement disabled:
python main.py --config config.yaml \
--input-video ../test_data/Ncam/video.mp4 \
--device cpu \
--model midas \
--skip-pose \
--skip-temporal-refinement
You can repeat the same command later with --model depth_anything, --model zoedepth, or any other single model you want to test.
# Check outputs
ls -la outputs/
# Open visualization notebook
jupyter notebook notebooks/visualization.ipynb
# View generated reports
cat outputs/reports/model_rankings.txt
cat outputs/metrics/model_comparison.csv
python main.py \
--config config.yaml \
--input-video test_data/Ncam/person.mp4 \
--input-bag test_data/Realsense/person.bag \
--output-dir outputs/person_benchmark
# With refinement (default)
python main.py --config config.yaml --input-video video.mp4 --output-dir outputs/refined
# Without refinement
python main.py --config config.yaml --input-video video.mp4 --output-dir outputs/non_refined --skip-temporal-refinement
python main.py \
--config config.yaml \
--input-video test_data/Ncam/4k_video.mp4 \
--models midas depth_anything depth_anything_v2 depth_pro \
--device cuda
from common import BenchmarkConfig
from benchmark import BenchmarkPipeline
from models import ModelFactory
# Load config
config = BenchmarkConfig.from_yaml('config.yaml')
# Create pipeline
pipeline = BenchmarkPipeline(config)
pipeline.load_models()
# Process video
results, rgb_frames = pipeline.process_video('test_data/Ncam/video.mp4')
# Compute metrics
metrics = pipeline.compute_metrics(
results['models']['midas']['depths'],
reference_depths
)
print(metrics)
BenchmarkConfigConfiguration management with YAML/JSON support.
from common import BenchmarkConfig
config = BenchmarkConfig.from_yaml('config.yaml')
config.models['midas'].use_cuda = True
config.to_yaml('config_modified.yaml')
BenchmarkPipelineMain benchmarking pipeline.
from benchmark import BenchmarkPipeline
pipeline = BenchmarkPipeline(config)
pipeline.load_models()
results, rgb_frames = pipeline.process_video(video_path)
ModelFactoryCreate depth models on-the-fly.
from models import ModelFactory
model = ModelFactory.create_model('midas', device='cuda', use_fp16=True)
depth = model.predict(rgb_image)
# List available models
print(ModelFactory.list_models())
DepthMetricsCompute depth comparison metrics.
from common import DepthMetrics
metrics = DepthMetrics.compute_all_metrics(predicted, reference)
print(metrics)
# {'mae': ..., 'rmse': ..., 'abs_rel': ..., 'silog': ..., 'delta_1.25': ...}
MediaPipePosePose estimation and analysis.
from common import MediaPipePose, PoseProcessor
pose_detector = MediaPipePose()
pose_result = pose_detector.detect(rgb_image)
# Get joint positions
joints = PoseProcessor.extract_joint_positions(pose_result, [12, 14, 16])
from common import (
VideoLoader, RealSenseLoader,
DepthAligner, DepthVisualizer,
apply_temporal_refinement
)
# Load video
with VideoLoader(path) as loader:
for frame, idx, timestamp in loader.get_frames():
pass
# Load RealSense .bag
with RealSenseLoader(bag_path) as loader:
for rgb, depth, idx, timestamp in loader.get_frames():
pass
# Align depths
aligner = DepthAligner()
aligner.compute_alignment(predicted, reference)
aligned = aligner.align(predicted)
# Visualize
colored = DepthVisualizer.colorize_depth(depth, cmap='viridis')
# Temporal refinement
refined = apply_temporal_refinement(depth_sequence, method='gaussian')
outputs/
├── raw_depth/ # Unrefined depth maps
├── refined_depth/ # Temporally refined depth maps
├── metrics/
│ ├── benchmark_results.json
│ ├── model_comparison.csv
│ └── summary.json
├── visualizations/
│ ├── metrics_comparison.png
│ ├── rgb_depth_0000.png
│ ├── comparison_video.mp4
│ └── pose_overlay_0000.png
├── pose_results/
│ ├── pose_joints.json
│ ├── skeleton_depth_analysis.csv
│ └── consistency_scores.json
└── reports/
├── model_rankings.txt
└── summary.json
resolution: [960, 540]batch_size: 4 (if GPU memory allows)device: cpu for testing--skip-pose and --skip-temporal-refinement# Reduce batch size
python main.py --config config.yaml --models midas
# Use CPU
python main.py --config config.yaml --device cpu
# Reduce resolution in config.yaml
Models download weights automatically on first run. Ensure internet connection.
# Pre-download weights
python -c "from models import ModelFactory; ModelFactory.create_model('midas')"
# Install pyrealsense2
pip install pyrealsense2
# Test with sample .bag
python -c "from common import RealSenseLoader; loader = RealSenseLoader('test.bag')"
If you use this benchmark in your research, please cite:
@software{depth_benchmark_2024,
title={Depth Estimation Benchmark: Monocular vs RealSense},
author={Research Team},
year={2024},
howpublished={\url{https://github.com/...}}
}
MIT License - See LICENSE file for details
Contributions welcome! Please:
For issues and questions:
Last Updated: January 2024
Maintainer: Research Team
Status: Production Ready
2 commits
Python
96.5%
Jupyter Notebook
3.5%
A production-grade benchmarking framework for comparing monocular depth estimation models against Intel RealSense depth sensing, with pose-aware analysis and temporal refinement.
✓ 8 State-of-the-Art Depth Models
✓ Advanced Processing
✓ RealSense Integration
✓ Comprehensive Metrics
✓ Pose Estimation
✓ Visualizations
depth_benchmark/
├── common/ # Shared utilities
│ ├── config.py # Configuration management
│ ├── utils.py # General utilities
│ ├── video_loader.py # Video/RealSense .bag loading
│ ├── frame_extractor.py # Frame extraction
│ ├── depth_alignment.py # Depth alignment
│ ├── metrics.py # Metric computation
│ ├── pose_estimation.py # MediaPipe integration
│ ├── temporal_refinement.py # DepthCrafter refinement
│ └── visualization.py # Visualization utilities
│
├── models/ # Depth model runners
│ ├── base_model.py # Base model class
│ ├── midas_runner.py
│ ├── depth_anything_runner.py
│ ├── depth_anything_v2_runner.py
│ ├── zoedepth_runner.py
│ ├── dpt_large_runner.py
│ ├── depth_pro_runner.py
│ ├── leres_runner.py
│ └── bts_runner.py
│
├── benchmark/ # Benchmarking pipeline
│ ├── benchmark_pipeline.py # Main pipeline
│ ├── compare_models.py # Model comparison utilities
│ ├── generate_csv.py # CSV export
│ └── generate_report.py # Report generation
│
├── notebooks/ # Jupyter notebooks
│ ├── evaluation.ipynb # Full evaluation pipeline
│ └── visualization.ipynb # Results visualization
│
├── outputs/ # Results (auto-created)
│ ├── raw_depth/
│ ├── refined_depth/
│ ├── metrics/
│ ├── visualizations/
│ └── pose_results/
│
├── config.yaml # Main configuration
├── main.py # Entry point
└── requirements.txt # Dependencies
git clone https://github.com/M0hammedAyan/Models-Check.git
python3.10 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
# Depth Anything
git clone https://github.com/LiheYoung/Depth-Anything
cd Depth-Anything
pip install -e .
cd ..
# Depth Anything V2
pip install git+https://github.com/DepthAnything/Depth-Anything-V2.git
# ZoeDepth
pip install git+https://github.com/isl-org/ZoeDepth.git
# Depth Pro (if available)
pip install git+https://github.com/apple/depth-pro.git
# RealSense (for .bag support)
pip install pyrealsense2
# FLOPs calculation
pip install fvcore
# Development tools
pip install black pylint pytest
Organize test data in the following structure:
test_data/
├── Ncam/
│ ├── video1.mp4
│ └── video2.mp4
└── Realsense/
├── recording1.bag
└── recording2.bag
Edit config.yaml:
data:
video_path: ../test_data/Ncam/video.mp4 # or set via CLI
bag_path: ../test_data/Realsense/recording.bag
output_dir: ./outputs
device: cuda
# Full benchmark with all models
python main.py --config config.yaml --input-video ../test_data/Ncam/video.mp4
# With RealSense .bag
python main.py --config config.yaml --input-bag ../test_data/Realsense/recording.bag
# Specific models only
python main.py --config config.yaml --models midas depth_anything dpt_large
# On CPU
python main.py --config config.yaml --device cpu
# Skip pose estimation
python main.py --config config.yaml --skip-pose
# Skip temporal refinement
python main.py --config config.yaml --skip-temporal-refinement
On Raspberry Pi 5, run one model at a time with CPU-only inference and optional pose/refinement disabled:
python main.py --config config.yaml \
--input-video ../test_data/Ncam/video.mp4 \
--device cpu \
--model midas \
--skip-pose \
--skip-temporal-refinement
You can repeat the same command later with --model depth_anything, --model zoedepth, or any other single model you want to test.
# Check outputs
ls -la outputs/
# Open visualization notebook
jupyter notebook notebooks/visualization.ipynb
# View generated reports
cat outputs/reports/model_rankings.txt
cat outputs/metrics/model_comparison.csv
python main.py \
--config config.yaml \
--input-video test_data/Ncam/person.mp4 \
--input-bag test_data/Realsense/person.bag \
--output-dir outputs/person_benchmark
# With refinement (default)
python main.py --config config.yaml --input-video video.mp4 --output-dir outputs/refined
# Without refinement
python main.py --config config.yaml --input-video video.mp4 --output-dir outputs/non_refined --skip-temporal-refinement
python main.py \
--config config.yaml \
--input-video test_data/Ncam/4k_video.mp4 \
--models midas depth_anything depth_anything_v2 depth_pro \
--device cuda
from common import BenchmarkConfig
from benchmark import BenchmarkPipeline
from models import ModelFactory
# Load config
config = BenchmarkConfig.from_yaml('config.yaml')
# Create pipeline
pipeline = BenchmarkPipeline(config)
pipeline.load_models()
# Process video
results, rgb_frames = pipeline.process_video('test_data/Ncam/video.mp4')
# Compute metrics
metrics = pipeline.compute_metrics(
results['models']['midas']['depths'],
reference_depths
)
print(metrics)
BenchmarkConfigConfiguration management with YAML/JSON support.
from common import BenchmarkConfig
config = BenchmarkConfig.from_yaml('config.yaml')
config.models['midas'].use_cuda = True
config.to_yaml('config_modified.yaml')
BenchmarkPipelineMain benchmarking pipeline.
from benchmark import BenchmarkPipeline
pipeline = BenchmarkPipeline(config)
pipeline.load_models()
results, rgb_frames = pipeline.process_video(video_path)
ModelFactoryCreate depth models on-the-fly.
from models import ModelFactory
model = ModelFactory.create_model('midas', device='cuda', use_fp16=True)
depth = model.predict(rgb_image)
# List available models
print(ModelFactory.list_models())
DepthMetricsCompute depth comparison metrics.
from common import DepthMetrics
metrics = DepthMetrics.compute_all_metrics(predicted, reference)
print(metrics)
# {'mae': ..., 'rmse': ..., 'abs_rel': ..., 'silog': ..., 'delta_1.25': ...}
MediaPipePosePose estimation and analysis.
from common import MediaPipePose, PoseProcessor
pose_detector = MediaPipePose()
pose_result = pose_detector.detect(rgb_image)
# Get joint positions
joints = PoseProcessor.extract_joint_positions(pose_result, [12, 14, 16])
from common import (
VideoLoader, RealSenseLoader,
DepthAligner, DepthVisualizer,
apply_temporal_refinement
)
# Load video
with VideoLoader(path) as loader:
for frame, idx, timestamp in loader.get_frames():
pass
# Load RealSense .bag
with RealSenseLoader(bag_path) as loader:
for rgb, depth, idx, timestamp in loader.get_frames():
pass
# Align depths
aligner = DepthAligner()
aligner.compute_alignment(predicted, reference)
aligned = aligner.align(predicted)
# Visualize
colored = DepthVisualizer.colorize_depth(depth, cmap='viridis')
# Temporal refinement
refined = apply_temporal_refinement(depth_sequence, method='gaussian')
outputs/
├── raw_depth/ # Unrefined depth maps
├── refined_depth/ # Temporally refined depth maps
├── metrics/
│ ├── benchmark_results.json
│ ├── model_comparison.csv
│ └── summary.json
├── visualizations/
│ ├── metrics_comparison.png
│ ├── rgb_depth_0000.png
│ ├── comparison_video.mp4
│ └── pose_overlay_0000.png
├── pose_results/
│ ├── pose_joints.json
│ ├── skeleton_depth_analysis.csv
│ └── consistency_scores.json
└── reports/
├── model_rankings.txt
└── summary.json
resolution: [960, 540]batch_size: 4 (if GPU memory allows)device: cpu for testing--skip-pose and --skip-temporal-refinement# Reduce batch size
python main.py --config config.yaml --models midas
# Use CPU
python main.py --config config.yaml --device cpu
# Reduce resolution in config.yaml
Models download weights automatically on first run. Ensure internet connection.
# Pre-download weights
python -c "from models import ModelFactory; ModelFactory.create_model('midas')"
# Install pyrealsense2
pip install pyrealsense2
# Test with sample .bag
python -c "from common import RealSenseLoader; loader = RealSenseLoader('test.bag')"
If you use this benchmark in your research, please cite:
@software{depth_benchmark_2024,
title={Depth Estimation Benchmark: Monocular vs RealSense},
author={Research Team},
year={2024},
howpublished={\url{https://github.com/...}}
}
MIT License - See LICENSE file for details
Contributions welcome! Please:
For issues and questions:
Last Updated: January 2024
Maintainer: Research Team
Status: Production Ready
2 commits
Python
96.5%
Jupyter Notebook
3.5%