Skip to main content

Beyond ADAS — collision anticipation inference for dashcam video

Project description

BADAS - Beyond ADAS

Python 3.10+ PyTorch 2.0+ PyPI

BADAS (Beyond ADAS) is a deep learning framework for predicting collision likelihood in dashcam video sequences. It supports multiple vision transformer backbones and deployment formats optimized for real-time inference.

Installation

pip install badas

Optional extras for faster video decoding or alternative backends:

pip install decord           # Fast video decoding (falls back to OpenCV)
pip install onnxruntime-gpu  # ONNX backend

Quick Start

from badas.inference import BADAS, BADASConfig

predictor = BADAS.from_pretrained("nexar-ai/BADAS-Open")

# Batch prediction on a video
results = predictor.predict_video("dashcam.mp4", stride=1)
for r in results:
    print(f"[{r['timestamp']:.2f}s]  {r['risk_level']:<6}  p={r['probability']:.3f}")

# Streaming / moving-window inference
for pred in predictor.predict_stream("dashcam.mp4", stride=1):
    if pred['probability'] > 0.7:
        print(f"WARNING: High collision risk at {pred['timestamp']:.2f}s")

Prediction Output

Each prediction is a dict:

{
    'frame_index': 100,
    'timestamp': 4.17,
    'probability': 0.823,
    'risk_level': 'high',   # 'low' | 'medium' | 'high'
    'smoothed': True,
}

Inference Backends

Format Load Notes
.ckpt / .pt BADAS("model.ckpt") Full model + config, supports torch.compile
.onnx BADAS("model.onnx") CPU/GPU via ONNX Runtime
.trt / .engine BADAS("model.trt") NVIDIA GPU, lowest latency

Configuration

from badas.inference import BADAS, BADASConfig, SmoothingConfig

config = BADASConfig(
    use_compile=True,       # torch.compile — slow first run, fast thereafter
    startup_ramp=True,      # yield predictions before the full window is buffered
    smoothing=SmoothingConfig(
        enabled=True,
        alpha_rise=0.7,     # smoothing when risk increases
        alpha_fall=0.3,     # smoothing when risk decreases
    ),
)
predictor = BADAS("model.ckpt", config=config)

Available Models

Open Source

Model Size Notes
nexar-ai/BADAS-Open ViT-L Publicly available
predictor = BADAS.from_pretrained("nexar-ai/BADAS-Open")

Commercial (Nexar)

Model Size Notes
nexar-ai/badas-1.0 ViT-L
nexar-ai/badas-1.5 ViT-L Best accuracy
nexar-ai/badas-1.5-flash ViT-B Fast
nexar-ai/badas-1.5-flash-lite ViT-S Fastest

To request access, visit nexar-ai.com/badas.

Citation

@article{goldshmidt2025badas,
  title={BADAS: Context Aware Collision Prediction Using Real-World Dashcam Data},
  author={Goldshmidt, Roni and Scott, Hamish and Niccolini, Lorenzo and
          Zhu, Shizhan and Moura, Daniel and Zvitia, Orly},
  journal={arXiv preprint},
  year={2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

badas-1.0.5.tar.gz (221.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

badas-1.0.5-py3-none-any.whl (237.1 kB view details)

Uploaded Python 3

File details

Details for the file badas-1.0.5.tar.gz.

File metadata

  • Download URL: badas-1.0.5.tar.gz
  • Upload date:
  • Size: 221.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for badas-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f2e128b8855b09b2fc2de035f8796690b640f0f329c0bbe944ce9ee07a842a0f
MD5 8b7444f25554c8681fbc04f54b113710
BLAKE2b-256 e47de888183b327df5755e7debcddc825b746878a36175d8ce9c8b4c085fb6cd

See more details on using hashes here.

File details

Details for the file badas-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: badas-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 237.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for badas-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d1093b3a9c7394693744a42fc50b0ff356de6f21bac16aa52178259dcb128a3f
MD5 51afa5784483940c333e10710e2f3f2b
BLAKE2b-256 f16b621164468b7d7fea4c8caf72361a19169457f5a02f7865e1f548f3de8ff8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page