npm.io
1.0.0 • Published 4 years ago

yolov5js

Licence
MIT
Version
1.0.0
Deps
1
Size
237 kB
Vulns
0
Weekly
0

npm NPM npm

yolov5.js

Logo

Install

npm install --save yolov5js

Convert

# clone YOLOv5 repository
git clone https://github.com/ultralytics/yolov5.git
cd yolov5

# create python virtual environment [recommended]
virtualenv venv
source venv/bin/activate

# install dependencies
pip install -r requirements.txt
pip install tensorflowjs

# convert model to tensorflow.js format
python export.py --weights yolov5s.pt --include tfjs

Zoo

Use and share pretrained YOLOv5 tensorflow.js models with yolov5.js-zoo.

Deploy

Fetch from models zoo
import {load, YOLO_V5_N_COCO_MODEL_CONFIG} from 'yolov5js'

const model = await load(YOLO_V5_N_COCO_MODEL_CONFIG)
Fetch from custom url
import {load, ModelConfig} from 'yolov5js'

const config = { source: 'https://raw.githubusercontent.com/SkalskiP/yolov5js-zoo/master/models/coco/yolov5n/model.json' }
const model = await load(config)
Load from file
import {load, ModelConfig} from 'yolov5js'
    
const uploadJSONInput = document.getElementById('upload-json');
const uploadWeightsInput = document.getElementById('upload-weights');
    
const config = { source: [uploadJSONInput.files[0], uploadWeightsInput.files[0]] }
const model = await load(config)

Kudos

Kudos to ultralytics team as well as all other open-source contributors for building YOLOv5 project, and making it all possible.

License

Project is freely distributable under the terms of the MIT license.