Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,112 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
base_model: cfzd/Ultra-Fast-Lane-Detection
|
| 4 |
+
tags:
|
| 5 |
+
- tflite
|
| 6 |
+
- lane-detection
|
| 7 |
+
- object-detection
|
| 8 |
+
- quantized
|
| 9 |
+
- android
|
| 10 |
+
- automotive
|
| 11 |
+
- autonomous-driving
|
| 12 |
+
- adas
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
pipeline_tag: object-detection
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# Car Nebula ADAS β On-Device TFLite Models
|
| 19 |
+
|
| 20 |
+
Two TFLite models used by [Car Nebula](https://carnebula.app) for real-time Advanced Driver
|
| 21 |
+
Assistance (ADAS) running entirely on-device on Android automotive hardware.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Models
|
| 26 |
+
|
| 27 |
+
### 1. `lane_detector.tflite` β Lane Detection
|
| 28 |
+
|
| 29 |
+
| Property | Value |
|
| 30 |
+
|---|---|
|
| 31 |
+
| **Base model** | Ultra-Fast Lane Detection (cfzd/Ultra-Fast-Lane-Detection) |
|
| 32 |
+
| **Architecture** | ResNet-18 backbone |
|
| 33 |
+
| **Dataset** | TUSimple (highway lanes, US dashcam footage) |
|
| 34 |
+
| **Original weights** | `tusimple_res18.pth` (official pre-trained) |
|
| 35 |
+
| **Input shape** | `[1, 288, 800, 3]` β float32 or int8, NHWC |
|
| 36 |
+
| **Input normalization** | ImageNet: mean `[0.485, 0.456, 0.406]`, std `[0.229, 0.224, 0.225]` |
|
| 37 |
+
| **Output shape** | `[1, 201, 56, 4]` or `[1, 4, 56, 201]` |
|
| 38 |
+
| **Output format** | 201 grid bins (200 x-positions + 1 no-lane) Γ 56 row anchors Γ 4 lanes |
|
| 39 |
+
| **License** | MIT |
|
| 40 |
+
|
| 41 |
+
**Conversion pipeline:**
|
| 42 |
+
```
|
| 43 |
+
tusimple_res18.pth β ONNX (opset 11) β TF SavedModel β TFLite
|
| 44 |
+
```
|
| 45 |
+
Conversion script: `convert_ufld.py` (included in the Car Nebula Android repo).
|
| 46 |
+
|
| 47 |
+
**Row anchors (TUSimple, 56 rows, pixel Y in 288-px input):**
|
| 48 |
+
```
|
| 49 |
+
64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140
|
| 50 |
+
144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212
|
| 51 |
+
216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
### 2. `efficientdet_lite0.tflite` β Object Detection
|
| 57 |
+
|
| 58 |
+
| Property | Value |
|
| 59 |
+
|---|---|
|
| 60 |
+
| **Model family** | EfficientDet Lite0 |
|
| 61 |
+
| **Source** | [TensorFlow Hub](https://tfhub.dev/tensorflow/lite-model/efficientdet/lite0/detection/metadata/1) |
|
| 62 |
+
| **Input shape** | `[1, 320, 320, 3]` β uint8, NHWC |
|
| 63 |
+
| **Output** | Bounding boxes Β· class scores Β· class labels Β· detection count |
|
| 64 |
+
| **Classes** | 90 COCO classes |
|
| 65 |
+
| **Score threshold** | 0.38 (used by Car Nebula pipeline) |
|
| 66 |
+
| **License** | Apache 2.0 |
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## How the pipeline uses both models
|
| 71 |
+
|
| 72 |
+
```
|
| 73 |
+
Camera frame (CameraX / USB UVC)
|
| 74 |
+
β
|
| 75 |
+
ββββΊ EfficientDet Lite0 (every 3 frames)
|
| 76 |
+
β ββββΊ AdasBox list: label, bounding rect, estimated distance
|
| 77 |
+
β ββββΊ HUD overlay: boxes, collision warning, top-down view
|
| 78 |
+
β
|
| 79 |
+
ββββΊ UFLD ResNet-18 (every 3 frames)
|
| 80 |
+
ββββΊ Lane boundary points (left/right, top/bottom)
|
| 81 |
+
ββββΊ Camera overlay: seg mask, lane lines
|
| 82 |
+
HUD: road corridor, departure warning
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Results are temporally smoothed between inference runs so the UI always has
|
| 86 |
+
something to render even on frames that skip inference.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## Usage (Android / TFLite Java API)
|
| 91 |
+
|
| 92 |
+
```kotlin
|
| 93 |
+
// Load from downloaded file
|
| 94 |
+
val model = FileInputStream(file).channel.use { ch ->
|
| 95 |
+
ch.map(FileChannel.MapMode.READ_ONLY, 0, file.length())
|
| 96 |
+
}
|
| 97 |
+
val interpreter = InterpreterApi.create(
|
| 98 |
+
model,
|
| 99 |
+
InterpreterApi.Options()
|
| 100 |
+
.setRuntime(InterpreterApi.Options.TfLiteRuntime.FROM_SYSTEM_ONLY)
|
| 101 |
+
.setNumThreads(2)
|
| 102 |
+
)
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Licenses
|
| 108 |
+
|
| 109 |
+
| Model | License |
|
| 110 |
+
|---|---|
|
| 111 |
+
| `lane_detector.tflite` (UFLD ResNet-18) | [MIT](https://github.com/cfzd/Ultra-Fast-Lane-Detection/blob/master/LICENSE) |
|
| 112 |
+
| `efficientdet_lite0.tflite` (TFHub) | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
|