Spaces:
Running
Running
ints8_quantization, as executorch is failing
Browse files- README.md +1 -1
- backend/model.py +7 -7
- frontend/vehicles.html +2 -2
- requirements.txt +5 -2
README.md
CHANGED
|
@@ -18,7 +18,7 @@ Full-stack traffic analytics dashboard. YOLO + ByteTrack backend processes uploa
|
|
| 18 |
|
| 19 |
## Stack
|
| 20 |
|
| 21 |
-
- **Backend**: FastAPI, Ultralytics YOLO (
|
| 22 |
- **Frontend**: Vanilla HTML/JS, TailwindCSS CDN, Chart.js
|
| 23 |
- **Infra**: Docker, CPU-only inference
|
| 24 |
|
|
|
|
| 18 |
|
| 19 |
## Stack
|
| 20 |
|
| 21 |
+
- **Backend**: FastAPI, Ultralytics YOLO (OpenVINO), ByteTrack, OpenCV
|
| 22 |
- **Frontend**: Vanilla HTML/JS, TailwindCSS CDN, Chart.js
|
| 23 |
- **Infra**: Docker, CPU-only inference
|
| 24 |
|
backend/model.py
CHANGED
|
@@ -7,10 +7,10 @@ load_dotenv()
|
|
| 7 |
|
| 8 |
MODEL_DIR = Path(__file__).parent / "weights"
|
| 9 |
PT_PATH = MODEL_DIR / "best.pt"
|
| 10 |
-
|
| 11 |
|
| 12 |
|
| 13 |
-
def
|
| 14 |
MODEL_DIR.mkdir(exist_ok=True)
|
| 15 |
|
| 16 |
if not PT_PATH.exists():
|
|
@@ -21,11 +21,11 @@ def ensure_executorch():
|
|
| 21 |
f'https://huggingface.co/Perception365/VehicleNet-Y26s/resolve/main/weights/best.pt'
|
| 22 |
)
|
| 23 |
|
| 24 |
-
# https://docs.ultralytics.com/
|
| 25 |
-
if not
|
| 26 |
-
YOLO(str(PT_PATH)).export(format="
|
| 27 |
|
| 28 |
|
| 29 |
def load_model():
|
| 30 |
-
|
| 31 |
-
return YOLO(str(
|
|
|
|
| 7 |
|
| 8 |
MODEL_DIR = Path(__file__).parent / "weights"
|
| 9 |
PT_PATH = MODEL_DIR / "best.pt"
|
| 10 |
+
OV_DIR = MODEL_DIR / "best_int8_openvino_model"
|
| 11 |
|
| 12 |
|
| 13 |
+
def ensure_openvino():
|
| 14 |
MODEL_DIR.mkdir(exist_ok=True)
|
| 15 |
|
| 16 |
if not PT_PATH.exists():
|
|
|
|
| 21 |
f'https://huggingface.co/Perception365/VehicleNet-Y26s/resolve/main/weights/best.pt'
|
| 22 |
)
|
| 23 |
|
| 24 |
+
# https://docs.ultralytics.com/modes/export/#arguments
|
| 25 |
+
if not OV_DIR.exists():
|
| 26 |
+
YOLO(str(PT_PATH)).export(format="openvino", dynamic=True, int8=True)
|
| 27 |
|
| 28 |
|
| 29 |
def load_model():
|
| 30 |
+
ensure_openvino()
|
| 31 |
+
return YOLO(str(OV_DIR), task="detect")
|
frontend/vehicles.html
CHANGED
|
@@ -421,7 +421,7 @@
|
|
| 421 |
<ul class="text-xs space-y-3 pl-1">
|
| 422 |
<li class="flex items-start gap-3"><i
|
| 423 |
class="fa-solid fa-circle text-[5px] mt-1.5 text-slate-400"></i>
|
| 424 |
-
<span>
|
| 425 |
</li>
|
| 426 |
<li class="flex items-start gap-3"><i
|
| 427 |
class="fa-solid fa-circle text-[5px] mt-1.5 text-slate-400"></i>
|
|
@@ -888,7 +888,7 @@
|
|
| 888 |
<a href="https://huggingface.co/Perception365/VehicleNet-Y26s" target="_blank" class="text-sm font-bold text-white mono-font hover:text-slate-300 transition underline underline-offset-4 decoration-slate-700">Perception365/VehicleNet-Y26s</a>
|
| 889 |
</div>` +
|
| 890 |
detailRow('task', 'detect') +
|
| 891 |
-
detailRow('format', '
|
| 892 |
detailRow('tracker', 'ByteTrack');
|
| 893 |
|
| 894 |
populateInferPanel(c);
|
|
|
|
| 421 |
<ul class="text-xs space-y-3 pl-1">
|
| 422 |
<li class="flex items-start gap-3"><i
|
| 423 |
class="fa-solid fa-circle text-[5px] mt-1.5 text-slate-400"></i>
|
| 424 |
+
<span>OpenVINO Performance Optimization</span>
|
| 425 |
</li>
|
| 426 |
<li class="flex items-start gap-3"><i
|
| 427 |
class="fa-solid fa-circle text-[5px] mt-1.5 text-slate-400"></i>
|
|
|
|
| 888 |
<a href="https://huggingface.co/Perception365/VehicleNet-Y26s" target="_blank" class="text-sm font-bold text-white mono-font hover:text-slate-300 transition underline underline-offset-4 decoration-slate-700">Perception365/VehicleNet-Y26s</a>
|
| 889 |
</div>` +
|
| 890 |
detailRow('task', 'detect') +
|
| 891 |
+
detailRow('format', 'OpenVINO') +
|
| 892 |
detailRow('tracker', 'ByteTrack');
|
| 893 |
|
| 894 |
populateInferPanel(c);
|
requirements.txt
CHANGED
|
@@ -4,10 +4,13 @@ python-multipart==0.0.6
|
|
| 4 |
opencv-python-headless==4.8.1.78
|
| 5 |
matplotlib>=3.7.0
|
| 6 |
ultralytics>=8.3.0
|
| 7 |
-
numpy=
|
| 8 |
python-dotenv==1.0.0
|
| 9 |
websockets==12.0
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
lap>=0.5.12
|
| 12 |
torch==2.1.0+cpu
|
| 13 |
torchvision==0.16.0+cpu
|
|
|
|
| 4 |
opencv-python-headless==4.8.1.78
|
| 5 |
matplotlib>=3.7.0
|
| 6 |
ultralytics>=8.3.0
|
| 7 |
+
numpy>=1.23.0,<2.0.0
|
| 8 |
python-dotenv==1.0.0
|
| 9 |
websockets==12.0
|
| 10 |
+
onnxruntime
|
| 11 |
+
openvino>=2024.0.0
|
| 12 |
+
onnx>=1.12.0
|
| 13 |
+
onnxslim>=0.1.71
|
| 14 |
lap>=0.5.12
|
| 15 |
torch==2.1.0+cpu
|
| 16 |
torchvision==0.16.0+cpu
|