Digits Object Detection App is a web-based platform that allows users to draw digits on a canvas and instantly see bounding boxes and confidence scores for each recognized digit. It leverages a custom YOLOv8 model that has been converted to ONNX, enabling fast in-browser inference via ONNX Runtime Web and OpenCV.js.
Live Demo: Digits Object Detection App
Showcases how bounding boxes update on the fly as you draw digits (e.g., changing a 0
into a 9
).
demo.mp4
Demonstrates how adjusting IoU and confidence thresholds influences the appearance or disappearance of bounding boxes.
threshold.mp4
- Canvas Drawing: Users draw digits on the
sketchCanvas
. - Preprocessing ONNX: The drawn image is resized and normalized for the YOLO model.
- YOLO ONNX: Performs digit detection, outputting bounding boxes and confidence scores.
- NMS ONNX: Applies non-maximum suppression to filter overlapping detections.
- Postprocessing ONNX: Converts normalized coordinates back to the original canvas space.
- Render: Detected bounding boxes and labels are drawn onto the
boxesCanvas
.
- HTML, CSS, and JavaScript
- OpenCV.js for image and canvas manipulation
- ONNX Runtime Web for model inference in the browser
- YOLOv8 (trained and then exported to ONNX)
Digits-Object-Detection-App/
├── index.html
├── styles/
│ └── style.css
├── scripts/
│ ├── main.js
│ ├── models.js
│ ├── utils.js
├── onnx/
│ ├── preprocessing.onnx
│ ├── model.onnx
│ ├── nms.onnx
│ └── postprocessing.onnx
└── README.md
- index.html: Main entry point
- styles/style.css: Global styling
- scripts/main.js: Contains canvas interactions, event listeners, and detection triggers
- scripts/models.js: Loads and executes ONNX models
- scripts/utils.js: Helper functions (color palette, mouse/touch position, etc.)
- onnx/: ONNX models (preprocessing, YOLO, NMS, postprocessing)
- README.md: Project documentation