Cosmos Sentinel is an agentic, demo-first traffic safety pipeline. It evaluates dashcam and traffic videos by combining early-warning collision prediction with high-level multimodal reasoning and future-state video generation.
Cosmos Sentinel runs a three-stage intelligent pipeline:
graph TD
A[Input Dashcam Video] -->|Raw Frames| B[BADAS Detector V-JEPA2]
B -->|Collision Probabilities| C{Risk Threshold Met?}
C -->|No| D[Log: Safe state, Keep monitoring]
C -->|Yes| E[Extract Pre-Alert Focused Clip]
A --> F[NVIDIA Cosmos Reason 2 8B]
E --> F
F -->|Risk Analysis & Bounding Boxes| G[Structured Payload Generation]
G --> H{Run Predict Rollout?}
H -->|Yes| I[NVIDIA Cosmos Predict 2.5 2B]
I -->|Prompt: Prevented Collision| J[Counterfactual Video]
I -->|Prompt: Observed Trajectory| K[Continuation Video]
G --> L[Gradio UI Dashboard]
J --> L
K --> L
.
βββ app.py # Gradio UI (Hugging Face Spaces entry point)
βββ badas_detector.py # BADAS model loading and sliding-window inference
βββ cosmos_risk_narrator.py # Cosmos Reason 2 prompt building and inference
βββ cosmos_predict_runner.py # Cosmos Predict 2.5 generation logic
βββ extract_clip.py # Focused clip extraction utility
βββ main_pipeline.py # CLI orchestration for the full pipeline
pip install -r requirements.txt
Note: If you want to use the Cosmos Predict module locally, you must follow the Cosmos Predict 2.5 Setup Guide to install its specific uv workspace dependencies.
You need a Hugging Face token to download the gated models (BADAS and Cosmos).
export HF_TOKEN="your_hugging_face_token"
# Optional: Set a persistent cache directory to avoid re-downloading models
export HF_HOME="/path/to/your/large/storage/.huggingface"
python app.py
This branch (huggingface-spaces) is the source for the Cosmos Sentinel Hugging Face Space. Push directly to HF Spaces from this branch.
It is optimized for:
@spaces.GPU allocation to prevent timeouts during long downloads.HF_HOME=/data/.huggingface to cache the 30GB+ of models across restarts.Jupyter Notebook
69.5%
Python
30.5%
Cosmos Sentinel is an agentic, demo-first traffic safety pipeline. It evaluates dashcam and traffic videos by combining early-warning collision prediction with high-level multimodal reasoning and future-state video generation.
Cosmos Sentinel runs a three-stage intelligent pipeline:
graph TD
A[Input Dashcam Video] -->|Raw Frames| B[BADAS Detector V-JEPA2]
B -->|Collision Probabilities| C{Risk Threshold Met?}
C -->|No| D[Log: Safe state, Keep monitoring]
C -->|Yes| E[Extract Pre-Alert Focused Clip]
A --> F[NVIDIA Cosmos Reason 2 8B]
E --> F
F -->|Risk Analysis & Bounding Boxes| G[Structured Payload Generation]
G --> H{Run Predict Rollout?}
H -->|Yes| I[NVIDIA Cosmos Predict 2.5 2B]
I -->|Prompt: Prevented Collision| J[Counterfactual Video]
I -->|Prompt: Observed Trajectory| K[Continuation Video]
G --> L[Gradio UI Dashboard]
J --> L
K --> L
.
βββ app.py # Gradio UI (Hugging Face Spaces entry point)
βββ badas_detector.py # BADAS model loading and sliding-window inference
βββ cosmos_risk_narrator.py # Cosmos Reason 2 prompt building and inference
βββ cosmos_predict_runner.py # Cosmos Predict 2.5 generation logic
βββ extract_clip.py # Focused clip extraction utility
βββ main_pipeline.py # CLI orchestration for the full pipeline
pip install -r requirements.txt
Note: If you want to use the Cosmos Predict module locally, you must follow the Cosmos Predict 2.5 Setup Guide to install its specific uv workspace dependencies.
You need a Hugging Face token to download the gated models (BADAS and Cosmos).
export HF_TOKEN="your_hugging_face_token"
# Optional: Set a persistent cache directory to avoid re-downloading models
export HF_HOME="/path/to/your/large/storage/.huggingface"
python app.py
This branch (huggingface-spaces) is the source for the Cosmos Sentinel Hugging Face Space. Push directly to HF Spaces from this branch.
It is optimized for:
@spaces.GPU allocation to prevent timeouts during long downloads.HF_HOME=/data/.huggingface to cache the 30GB+ of models across restarts.Jupyter Notebook
69.5%
Python
30.5%