liamxdev commited on
Commit
28b323b
·
verified ·
1 Parent(s): 11a35ed

Upload folder using huggingface_hub

Browse files
Files changed (7) hide show
  1. .gitattributes +3 -34
  2. README.md +170 -0
  3. benchmark.md +18 -0
  4. label-mapping.json +58 -0
  5. vtsr.engine +3 -0
  6. vtsr.torchscript +3 -0
  7. vtsr_int8.onnx +3 -0
.gitattributes CHANGED
@@ -1,35 +1,4 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
  *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.pt filter=lfs diff=lfs merge=lfs -text
2
+ *.onnx filter=lfs diff=lfs merge=lfs -text
3
+ *.engine filter=lfs diff=lfs merge=lfs -text
4
+ *.torchscript filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - vi
4
+ license: agpl-3.0
5
+ library_name: ultralytics
6
+ pipeline_tag: object-detection
7
+ tags:
8
+ - yolo
9
+ - yolov8
10
+ - onnx
11
+ - torchscript
12
+ - tensorrt
13
+ - int8
14
+ - fp16
15
+ - vision
16
+ - object-detection
17
+ - traffic-sign
18
+ - vietnam
19
+ ---
20
+
21
+ # VTSR
22
+
23
+ VTSR is a YOLOv8n object-detection model for recognizing 56 classes of Vietnamese traffic signs.
24
+
25
+ This repository focuses on optimized deployment artifacts derived from the original FP32 PyTorch checkpoint, including ONNX INT8, TensorRT INT8, and TorchScript FP16 models.
26
+
27
+ ## Demo
28
+
29
+ An interactive Gradio demo is available on Hugging Face Spaces:
30
+
31
+ https://huggingface.co/spaces/liamxdev/vtsr-demo
32
+
33
+ The demo currently uses the ONNX INT8 artifact for CPU-compatible inference.
34
+
35
+ ## Model details
36
+
37
+ | Property | Value |
38
+ | ------------------ | ------------------------------- |
39
+ | Task | Object detection |
40
+ | Architecture | YOLOv8n |
41
+ | Classes | 56 |
42
+ | Input size | 640 × 640 |
43
+ | Label descriptions | `label-mapping.json` |
44
+ | Dataset | Vietnam Traffic Sign Dataset v3 |
45
+ | License | AGPL-3.0 |
46
+
47
+ The model returns traffic-sign codes such as `P-102`, `R-303`, and `W-224`. Vietnamese descriptions for these codes are provided separately in `label-mapping.json`.
48
+
49
+ ## Artifacts
50
+
51
+ | File | Precision | Target platform |
52
+ | ----------------------- | --------- | -------------------------------------------- |
53
+ | `vtsr.pt` | FP32 | PyTorch |
54
+ | `vtsr_int8.onnx` | INT8 | ONNX Runtime, CPU, cross-platform deployment |
55
+ | `vtsr_fp16.torchscript` | FP16 | TorchScript runtimes |
56
+ | `vtsr_int8.engine` | INT8 | NVIDIA TensorRT and Jetson devices |
57
+ | `label-mapping.json` | — | Traffic-sign code descriptions |
58
+
59
+ > The original FP32 PyTorch checkpoint is intentionally omitted. This repository provides optimized deployment artifacts only.
60
+
61
+ ## Usage
62
+
63
+ Install dependencies:
64
+
65
+ ```bash
66
+ pip install ultralytics
67
+ ```
68
+
69
+ Run inference:
70
+
71
+ ```python
72
+ from ultralytics import YOLO
73
+
74
+ # Supported artifacts:
75
+ # vtsr.pt
76
+ # vtsr_int8.onnx
77
+ # vtsr_fp16.torchscript
78
+ # vtsr_int8.engine
79
+
80
+ model = YOLO("vtsr_int8.onnx")
81
+
82
+ results = model.predict(
83
+ source="traffic.jpg",
84
+ imgsz=640,
85
+ conf=0.25,
86
+ )
87
+
88
+ results[0].save("result.jpg")
89
+ ```
90
+
91
+ See `label-mapping.json` for Vietnamese descriptions of traffic-sign codes.
92
+
93
+ ## Download from Hugging Face Hub
94
+
95
+ ```python
96
+ from huggingface_hub import hf_hub_download
97
+
98
+ repo_id = "liamxdev/vtsr"
99
+
100
+ model_path = hf_hub_download(
101
+ repo_id=repo_id,
102
+ filename="vtsr_int8.onnx",
103
+ )
104
+
105
+ mapping_path = hf_hub_download(
106
+ repo_id=repo_id,
107
+ filename="label-mapping.json",
108
+ )
109
+ ```
110
+
111
+ Other artifacts can be downloaded in the same way:
112
+
113
+ * `vtsr.pt`
114
+ * `vtsr_fp16.torchscript`
115
+ * `vtsr_int8.engine`
116
+
117
+ ## Benchmark
118
+
119
+ See [benchmark.md](benchmark.md) for latency and throughput measurements.
120
+
121
+ ## Supported classes
122
+
123
+ The model covers 56 Vietnamese traffic-sign codes in four broad groups:
124
+
125
+ * `P-*`: prohibition signs.
126
+ * `R-*`: mandatory and instruction signs.
127
+ * `W-*`: warning signs.
128
+ * `S-*` and `DP-*`: supplementary or special signs represented in the training dataset.
129
+
130
+ See `label-mapping.json` for the complete list and Vietnamese meanings.
131
+
132
+ ## Training data
133
+
134
+ The model was trained using version 3 of the [Vietnam Traffic Sign Dataset](https://universe.roboflow.com/giang-yp9g1/vietnam-traffic-sign-altsi/dataset/3) published on Roboflow Universe. The dataset metadata declares a CC BY 4.0 license.
135
+
136
+ ## Intended use
137
+
138
+ * Educational and research projects.
139
+ * Traffic-scene analysis prototypes.
140
+ * Vietnamese traffic-sign detection demos.
141
+ * CPU-oriented deployment through ONNX Runtime.
142
+ * NVIDIA GPU and Jetson deployment through TensorRT.
143
+ * Lightweight deployment through TorchScript.
144
+
145
+ ## Limitations
146
+
147
+ * The model recognizes only the 56 classes listed in `label-mapping.json`.
148
+ * Detection quality can decrease with small, blurred, occluded, damaged, poorly lit, or unusually angled signs.
149
+ * Images outside the training distribution may produce missed detections or false positives.
150
+ * A detection is not a substitute for official road-sign interpretation or safety-critical driving decisions.
151
+ * Quantized and reduced-precision models may exhibit accuracy differences relative to the original PyTorch checkpoint.
152
+ * TensorRT engines are hardware-specific and may need to be regenerated for different GPU architectures.
153
+
154
+ ## License
155
+
156
+ The exported model contains Ultralytics YOLO components and is distributed under the AGPL-3.0 license. Dataset attribution and its CC BY 4.0 terms apply separately.
157
+
158
+ For commercial licensing of Ultralytics components, see https://www.ultralytics.com/license.
159
+
160
+ ## Citation
161
+
162
+ ```bibtex
163
+ @misc{vietnam_traffic_sign_altsi_dataset,
164
+ title = {Vietnam Traffic Sign Dataset},
165
+ author = {giang},
166
+ year = {2024},
167
+ publisher = {Roboflow Universe},
168
+ howpublished = {\url{https://universe.roboflow.com/giang-yp9g1/vietnam-traffic-sign-altsi}}
169
+ }
170
+ ```
benchmark.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Environment
2
+
3
+ - Platform: Google Colab
4
+ - GPU: NVIDIA Tesla T4
5
+ - Input size: 640×640
6
+ - Batch size: 1
7
+ - Warm-up runs: 30
8
+ - Measured runs: 200
9
+
10
+ ## Results
11
+
12
+ | Artifact | Mean Latency (ms) | Median Latency (ms) | P95 Latency (ms) | FPS (Median) |
13
+ |------------|------------------:|--------------------:|-----------------:|--------------:|
14
+ | ONNX INT8 | 733.704 | 634.253 | 1196.094 | 1.58 |
15
+ | TorchScript FP16 | 15.526 | 15.174 | 17.666 | 65.90 |
16
+ | TensorRT INT8 | 12.956 | 12.774 | 14.836 | 78.28 |
17
+
18
+ TensorRT INT8 achieved the best latency and throughput on an NVIDIA Tesla T4 GPU. TorchScript FP16 delivered comparable performance, while the ONNX INT8 artifact showed substantially higher latency in this environment.
label-mapping.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "DP-135": "Hết tất cả các lệnh cấm",
3
+ "P-102": "Cấm đi ngược chiều",
4
+ "P-103a": "Cấm xe ô tô",
5
+ "P-103b": "Cấm xe ô tô rẽ phải",
6
+ "P-103c": "Cấm xe ô tô rẽ trái",
7
+ "P-104": "Cấm xe máy",
8
+ "P-106a": "Cấm xe ô tô tải",
9
+ "P-106b": "Cấm xe ô tô tải có khối lượng chuyên chở lớn hơn quy định",
10
+ "P-107a": "Cấm xe ô tô khách",
11
+ "P-112": "Cấm người đi bộ",
12
+ "P-115": "Hạn chế tải trọng toàn bộ xe",
13
+ "P-117": "Hạn chế chiều cao",
14
+ "P-123a": "Cấm rẽ trái",
15
+ "P-123b": "Cấm rẽ phải",
16
+ "P-124a": "Cấm quay đầu xe",
17
+ "P-124b": "Cấm ô tô quay đầu xe",
18
+ "P-124c": "Cấm rẽ trái và quay đầu xe",
19
+ "P-127": "Tốc độ tối đa cho phép",
20
+ "P-128": "Cấm bóp còi",
21
+ "P-130": "Cấm dừng xe và đỗ xe",
22
+ "P-131a": "Cấm đỗ xe",
23
+ "P-137": "Cấm rẽ trái, rẽ phải",
24
+ "P-245a": "Đi chậm (Biển cấm cũ, hiện tại dùng W-245a)",
25
+ "R-301c": "Các xe chỉ được rẽ trái",
26
+ "R-301d": "Các xe chỉ được rẽ phải",
27
+ "R-301e": "Các xe chỉ được rẽ trái và đi thẳng",
28
+ "R-302a": "Hướng phải đi vòng chướng ngại vật sang phải",
29
+ "R-302b": "Hướng phải đi vòng chướng ngại vật sang trái",
30
+ "R-303": "Nơi giao nhau chạy theo vòng xuyến",
31
+ "R-407a": "Đường một chiều",
32
+ "R-409": "Chỗ quay xe",
33
+ "R-425": "Bệnh viện",
34
+ "R-434": "Bến xe buýt",
35
+ "S-509a": "Chiều cao an toàn (Biển phụ thuyết minh)",
36
+ "W-201a": "Chỗ ngoặt nguy hiểm vòng bên trái",
37
+ "W-201b": "Chỗ ngoặt nguy hiểm vòng bên phải",
38
+ "W-202a": "Nhiều chỗ ngoặt nguy hiểm liên tiếp vòng bên trái",
39
+ "W-202b": "Nhiều chỗ ngoặt nguy hiểm liên tiếp vòng bên phải",
40
+ "W-203b": "Đường bị thu hẹp về phía trái",
41
+ "W-203c": "Đường bị thu hẹp về phía phải",
42
+ "W-205a": "Đường giao nhau cùng cấp phía bên trái",
43
+ "W-205b": "Đường giao nhau cùng cấp phía bên phải",
44
+ "W-205d": "Đường giao nhau cùng cấp có dải trung tâm",
45
+ "W-207a": "Giao nhau với đường không ưu tiên (phía trước)",
46
+ "W-207b": "Giao nhau với đường không ưu tiên (phía bên phải)",
47
+ "W-207c": "Giao nhau với đường không ưu tiên (phía bên trái)",
48
+ "W-208": "Giao nhau với đường ưu tiên",
49
+ "W-209": "Giao nhau có tín hiệu đèn",
50
+ "W-210": "Giao nhau với đường sắt có rào chắn",
51
+ "W-219": "Dốc xuống nguy hiểm",
52
+ "W-224": "Đường người đi bộ cắt ngang",
53
+ "W-225": "Trẻ em",
54
+ "W-227": "Công trường",
55
+ "W-233": "Nguy hiểm khác",
56
+ "W-235": "Đường đôi",
57
+ "W-245a": "Đi chậm"
58
+ }
vtsr.engine ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40d814d559d55a4c8a7b7ff912024cd598e935c312914e3a9ab70677e32b3e0c
3
+ size 5883675
vtsr.torchscript ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c69010d1f047c8e5906ede5122ebdd02950650e489906d6097f005d9c708212f
3
+ size 6427758
vtsr_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08586b55e8761ba257035a4c1fcd12aeec5ae5206eb737f4fe16029e64c01854
3
+ size 3367466