Object Detection application right in your browser.
Serving YOLOv5 in browser using onnxruntime-web with wasm
backend.
git clone https://github.com/Hyuto/yolov5-onnxruntime-web.git
cd yolov5-onnxruntime-web
yarn install # Install dependencies
yarn start # Start dev server
yarn build # Build for productions
YOLOv5n model converted to onnx model.
used model : yolov5n
size : 7.6 Mb
⚠️ Size Overload : used YOLOv5 model in this repo is the smallest with size of 7.5 MB, so other models is definitely bigger than this which can cause memory problems on browser.
Use another YOLOv5 model.
-
Clone yolov5 repository
git clone https://github.com/ultralytics/yolov5.git && cd yolov5
Install
requirements.txt
firstpip install -r requirements.txt
-
Export model to onnx format
export.py --weights yolov5*.pt --include onnx
-
Copy
yolov5*.onnx
to./public/model
-
Update
modelName
inApp.jsx
to new model name... // configs const modelName = "yolov5*.onnx"; // change to new model name const modelInputShape = [1, 3, 640, 640]; ...
-
Done! 😊