Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: onnx
|
| 3 |
+
pipeline_tag: video-classification
|
| 4 |
+
tags:
|
| 5 |
+
- onnx
|
| 6 |
+
- video-classification
|
| 7 |
+
- accident-detection
|
| 8 |
+
- dashcam
|
| 9 |
+
- jetson
|
| 10 |
+
- rockchip
|
| 11 |
+
license: mit
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Dashcam Collision Detector (videomae_base, ONNX)
|
| 15 |
+
|
| 16 |
+
Causal sliding-window crash detector exported to ONNX. The model scores a short
|
| 17 |
+
temporal window of dashcam frames and a downstream rule (`consec` consecutive
|
| 18 |
+
detections above `detect_threshold`) decides *when* a collision occurs.
|
| 19 |
+
|
| 20 |
+
- **Architecture:** `videomae_base`
|
| 21 |
+
- **Input:** float32 `[1, 3, 16, 224, 224]` (NCTHW), RGB, ImageNet mean/std normalized
|
| 22 |
+
- **Sampling:** 16-frame window at 16 fps
|
| 23 |
+
- **Decision rule:** threshold `0.97`, `3` consecutive windows
|
| 24 |
+
|
| 25 |
+
## Inference metadata
|
| 26 |
+
|
| 27 |
+
```json
|
| 28 |
+
{
|
| 29 |
+
"input_shape": [
|
| 30 |
+
1,
|
| 31 |
+
3,
|
| 32 |
+
16,
|
| 33 |
+
224,
|
| 34 |
+
224
|
| 35 |
+
],
|
| 36 |
+
"detect_threshold": 0.97,
|
| 37 |
+
"consec": 3,
|
| 38 |
+
"target_fps": 16,
|
| 39 |
+
"window_frames": 16,
|
| 40 |
+
"stride": 3,
|
| 41 |
+
"tolerance_s": 1.0,
|
| 42 |
+
"mean": [
|
| 43 |
+
0.485,
|
| 44 |
+
0.456,
|
| 45 |
+
0.406
|
| 46 |
+
],
|
| 47 |
+
"std": [
|
| 48 |
+
0.229,
|
| 49 |
+
0.224,
|
| 50 |
+
0.225
|
| 51 |
+
],
|
| 52 |
+
"arch": "videomae_base"
|
| 53 |
+
}
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from huggingface_hub import hf_hub_download
|
| 60 |
+
import onnxruntime as ort, numpy as np
|
| 61 |
+
|
| 62 |
+
path = hf_hub_download(repo_id="akhra92/dashcam-collision-jetson-videomae-hnm", filename="model.onnx")
|
| 63 |
+
sess = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
|
| 64 |
+
x = np.random.randn(*[1, 3, 16, 224, 224]).astype("float32")
|
| 65 |
+
logit = sess.run(["logit"], {"input": x})[0]
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
On-device, the ONNX graph is compiled to a TensorRT engine (Jetson) or an
|
| 69 |
+
`.rknn` model (Rockchip). See `deploy/` in the source repo.
|