GitHub - cloud-annotations/javascript-sdk: Use custom trained Cloud Annotations models with TensorFlow.js
Repository navigation
javascript-sdkPublic
About
Use custom trained Cloud Annotations models with TensorFlow.js
Topics
computer-vision javascript machine-learning object-detection tensorflowResources
Readme MIT license Activity Custom propertiesStars
23 starsWatchers
1 watchingForks
6 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
44 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| fixtures | fixtures | ||
| packages | packages | ||
| .gitignore | .gitignore | ||
| .prettierrc | .prettierrc | ||
| LICENSE | LICENSE | ||
| README.md | README.md | ||
| lerna.json | lerna.json | ||
| package.json | package.json | ||
| tsconfig.json | tsconfig.json | ||
| yarn.lock | yarn.lock | ||
Repository files navigation
Cloud Annotations JavaScript SDK
The Cloud Annotations SDK makes it easy to use your custom trained object detection or classification models in the browser or on the backend with TensorFlow.js. Simply load() your model_web folder and pass the loaded model a <canvas>, <img> or <video> reference.
Installation
npm install @cloud-annotations/models
Usage
Load a model
import models from '@cloud-annotations/models'
const model = await models.load('/model_web')
Object detection
const img = document.getElementById('img')
const predictions = await model.detect(img)
// predictions =>
[{
label: 'dog',
bbox: [x, y, width, height],
score: 0.92
},
{
label: 'cat',
bbox: [x, y, width, height],
score: 0.72
}]
Classification
const img = document.getElementById('img')
const predictions = await model.classify(img)
// predictions =>
[
{ label: 'dog', score: 0.92 },
{ label: 'cat', score: 0.72 }
]
Usage via Script Tag
No npm install required. Just import via the script tag.
<script src="https://cdn.jsdelivr.net/npm/@cloud-annotations/models"></script>
<script>
const img = document.getElementById('img')
models.load('/model_web')
.then(model => model.detect(img))
.then(predictions => {
console.log(predictions)
})
</script>
Example usage: Real-Time Object Detection With React .
About
Use custom trained Cloud Annotations models with TensorFlow.js