Instructions to use AutowareFoundation/traffic_light_fine_detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use AutowareFoundation/traffic_light_fine_detector with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
feat: add traffic_light_fine_detector v3.0 artifacts (from awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3)
Browse files- .gitignore +5 -0
- README.md +139 -0
- deploy_metadata.yaml +1 -0
- tlr_car_ped_yolox_s_batch_1.onnx +3 -0
- tlr_car_ped_yolox_s_batch_4.onnx +3 -0
- tlr_car_ped_yolox_s_batch_6.onnx +3 -0
- tlr_labels.txt +3 -0
.gitignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated TensorRT artifacts, built locally by Autoware from the ONNX
|
| 2 |
+
# files (see autoware_tensorrt_common). They are environment-specific
|
| 3 |
+
# (GPU arch + TensorRT version) and must not be committed to this repo.
|
| 4 |
+
*.engine
|
| 5 |
+
*.json
|
README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: object-detection
|
| 4 |
+
tags:
|
| 5 |
+
- autoware
|
| 6 |
+
- ros2
|
| 7 |
+
- autonomous-driving
|
| 8 |
+
- camera
|
| 9 |
+
- traffic-light
|
| 10 |
+
- yolox
|
| 11 |
+
- tensorrt
|
| 12 |
+
- onnx
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# YOLOX-s Traffic Light Fine Detector for Autoware (`traffic_light_fine_detector`)
|
| 16 |
+
|
| 17 |
+
Camera-based traffic light detection models, used by the
|
| 18 |
+
[`autoware_traffic_light_fine_detector`](https://github.com/autowarefoundation/autoware_universe/tree/main/perception/autoware_traffic_light_fine_detector)
|
| 19 |
+
node in [Autoware](https://github.com/autowarefoundation/autoware).
|
| 20 |
+
|
| 21 |
+
The models are **YOLOX-s** [1] detectors fine-tuned by TIER IV for traffic light detection. Given the full
|
| 22 |
+
camera image and the coarse ROIs predicted by the `traffic_light_map_based_detector` node, the fine detector
|
| 23 |
+
refines each ROI to a tight bounding box around the traffic light. The models are exported as ONNX; Autoware
|
| 24 |
+
builds the TensorRT engine from the ONNX file on first launch.
|
| 25 |
+
|
| 26 |
+
## Model overview
|
| 27 |
+
|
| 28 |
+
| | |
|
| 29 |
+
| --- | --- |
|
| 30 |
+
| Task | 2D traffic light detection (ROI refinement) in camera images |
|
| 31 |
+
| Architecture | YOLOX-s |
|
| 32 |
+
| Detected classes | `traffic_light`, `pedestrian_traffic_light` (plus a `BACKGROUND` label) |
|
| 33 |
+
| Runtime | TensorRT (FP16 by default, FP32 selectable) via the `autoware_traffic_light_fine_detector` ROS 2 node |
|
| 34 |
+
| Format | ONNX (Autoware builds the TensorRT engine locally on first launch) |
|
| 35 |
+
| License | Apache-2.0 |
|
| 36 |
+
|
| 37 |
+
## Variants in this repository
|
| 38 |
+
|
| 39 |
+
The three ONNX files share the same weights and differ only in their static batch size. The TensorRT engine
|
| 40 |
+
requires a fixed batch size, so the node pads the ROI list with dummy entries up to the model's batch size
|
| 41 |
+
when fewer traffic lights are visible.
|
| 42 |
+
|
| 43 |
+
| Variant | Batch size | Default in Autoware |
|
| 44 |
+
| --- | --- | --- |
|
| 45 |
+
| `tlr_car_ped_yolox_s_batch_1.onnx` | 1 | |
|
| 46 |
+
| `tlr_car_ped_yolox_s_batch_4.onnx` | 4 | |
|
| 47 |
+
| `tlr_car_ped_yolox_s_batch_6.onnx` | 6 | yes (loaded by the package's launch file) |
|
| 48 |
+
|
| 49 |
+
## Files
|
| 50 |
+
|
| 51 |
+
| File | Description |
|
| 52 |
+
| --- | --- |
|
| 53 |
+
| `tlr_car_ped_yolox_s_batch_1.onnx` | YOLOX-s traffic light detector, static batch size 1 |
|
| 54 |
+
| `tlr_car_ped_yolox_s_batch_4.onnx` | YOLOX-s traffic light detector, static batch size 4 |
|
| 55 |
+
| `tlr_car_ped_yolox_s_batch_6.onnx` | YOLOX-s traffic light detector, static batch size 6 (default) |
|
| 56 |
+
| `tlr_labels.txt` | Class labels: `BACKGROUND`, `traffic_light`, `pedestrian_traffic_light` |
|
| 57 |
+
| `deploy_metadata.yaml` | Deployment metadata recording the artifact version of this repository |
|
| 58 |
+
|
| 59 |
+
> **TensorRT engines are not distributed here.** TensorRT engines are specific to the GPU architecture and
|
| 60 |
+
> TensorRT version they are built on and are not portable, so Autoware builds them locally from the ONNX files
|
| 61 |
+
> on first launch (or via `build_only:=true`).
|
| 62 |
+
|
| 63 |
+
## Inputs and outputs (as used by the node)
|
| 64 |
+
|
| 65 |
+
**Inputs**
|
| 66 |
+
|
| 67 |
+
| Topic | Type | Description |
|
| 68 |
+
| --- | --- | --- |
|
| 69 |
+
| `~/input/image` | `sensor_msgs/msg/Image` | The full size camera image |
|
| 70 |
+
| `~/input/rois` | `tier4_perception_msgs/msg/TrafficLightRoiArray` | Coarse ROIs from the map-based detector |
|
| 71 |
+
| `~/expect/rois` | `tier4_perception_msgs/msg/TrafficLightRoiArray` | Offset-free ROIs used to select the best detections |
|
| 72 |
+
|
| 73 |
+
**Outputs**
|
| 74 |
+
|
| 75 |
+
| Topic | Type | Description |
|
| 76 |
+
| --- | --- | --- |
|
| 77 |
+
| `~/output/rois` | `tier4_perception_msgs/msg/TrafficLightRoiArray` | The refined, accurate ROIs |
|
| 78 |
+
| `~/debug/exe_time_ms` | `autoware_internal_debug_msgs/msg/Float32Stamped` | Inference time |
|
| 79 |
+
|
| 80 |
+
If no traffic light is detected inside a coarse ROI, the output ROI's `x_offset`, `y_offset`, `height`, and
|
| 81 |
+
`width` are set to `0`. Detections from YOLOX are matched against the `expect/rois` array as a whole set, not
|
| 82 |
+
each ROI in isolation. Key node parameters (defaults): `precision: fp16`, `score_thresh: 0.3`,
|
| 83 |
+
`nms_thresh: 0.65`, `gpu_id: 0`.
|
| 84 |
+
|
| 85 |
+
## Usage in Autoware
|
| 86 |
+
|
| 87 |
+
The node expects these artifacts under `~/autoware_data/ml_models/traffic_light_fine_detector/` and launches
|
| 88 |
+
with, e.g.:
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
ros2 launch autoware_traffic_light_fine_detector traffic_light_fine_detector.launch.xml \
|
| 92 |
+
data_path:=$HOME/autoware_data/ml_models \
|
| 93 |
+
model_path:=$HOME/autoware_data/ml_models/traffic_light_fine_detector/tlr_car_ped_yolox_s_batch_6.onnx \
|
| 94 |
+
label_path:=$HOME/autoware_data/ml_models/traffic_light_fine_detector/tlr_labels.txt
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
Add `build_only:=true` to build the TensorRT engine from the ONNX as a one-off pre-task.
|
| 98 |
+
See the [package README](https://github.com/autowarefoundation/autoware_universe/tree/main/perception/autoware_traffic_light_fine_detector)
|
| 99 |
+
for the full parameter reference.
|
| 100 |
+
|
| 101 |
+
## Training
|
| 102 |
+
|
| 103 |
+
- Base model: YOLOX-s from the official [YOLOX repository](https://github.com/Megvii-BaseDetection/YOLOX),
|
| 104 |
+
starting from the published [yolox_s.pth](https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth)
|
| 105 |
+
pretrained weights.
|
| 106 |
+
- Fine-tuning: performed by TIER IV on around 17,000 internal images of Japanese traffic lights.
|
| 107 |
+
- Further training details (epochs, hyperparameters, evaluation metrics) are not publicly documented.
|
| 108 |
+
|
| 109 |
+
## Limitations
|
| 110 |
+
|
| 111 |
+
- Fine-tuned on Japanese traffic lights; accuracy on traffic lights with different shapes, layouts, or
|
| 112 |
+
signaling conventions may drop without additional fine-tuning.
|
| 113 |
+
- The node is designed to run downstream of the map-based detector: it refines externally provided ROIs
|
| 114 |
+
rather than detecting traffic lights anywhere in the frame.
|
| 115 |
+
- The TensorRT engine has a static batch size; scenes with more simultaneous ROIs than the model's batch size
|
| 116 |
+
are processed in multiple inference passes.
|
| 117 |
+
|
| 118 |
+
## Provenance
|
| 119 |
+
|
| 120 |
+
| | |
|
| 121 |
+
| --- | --- |
|
| 122 |
+
| Original source | `https://awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3/` |
|
| 123 |
+
| Version tag in this repository | `v3.0` |
|
| 124 |
+
|
| 125 |
+
## Citation
|
| 126 |
+
|
| 127 |
+
```bibtex
|
| 128 |
+
@article{ge2021yolox,
|
| 129 |
+
title = {YOLOX: Exceeding YOLO Series in 2021},
|
| 130 |
+
author = {Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
|
| 131 |
+
journal = {arXiv preprint arXiv:2107.08430},
|
| 132 |
+
year = {2021}
|
| 133 |
+
}
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
## References
|
| 137 |
+
|
| 138 |
+
- [1] Ge et al., "YOLOX: Exceeding YOLO Series in 2021", arXiv:2107.08430, 2021.
|
| 139 |
+
- YOLOX repository: <https://github.com/Megvii-BaseDetection/YOLOX>
|
deploy_metadata.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
version: v3.0
|
tlr_car_ped_yolox_s_batch_1.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ad633066a1195006f4709f8fa07800dd65a74a814b3efb4c99bcc5a1a7962f6
|
| 3 |
+
size 35794092
|
tlr_car_ped_yolox_s_batch_4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf93eb1e1a97aefc6edd0c0c4d77c7f5fc2aa1e81e3c5c9cd49d976173d03a04
|
| 3 |
+
size 35794092
|
tlr_car_ped_yolox_s_batch_6.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b05a89fb30f1f92c6ec687d48e8ceda4da6f81cbd82d8a102d168753a6cedb6
|
| 3 |
+
size 35794092
|
tlr_labels.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BACKGROUND
|
| 2 |
+
traffic_light
|
| 3 |
+
pedestrian_traffic_light
|