0.0.5 • Published 5 years ago

@joeycode/teach v0.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

Teach.js Tweet

Dependency Status

A set of ready-to-use Machine Learning extracted functions from tensorflow.js. Made teaching your website to react based on trainning by Webcam be possible.

Demo

https://teach-demo.firebaseapp.com/

⚠ This package does not support NPM install yet

Teach.js is not bundled yet by Webpack as in the early stage, which you can not install from npm.

You will have to manually install the 3 dependencies. npm install --save @tensorflow-models/knn-classifier @tensorflow-models/mobilenet @tensorflow/tfjs

Table of contents

Quick start

Install this library

Teach.js assembles a set of ready-to-use Machine Learning functions.

Example

Creating an model using a Teach build is very simple and can be implemented in these steps:

  1. Download this Teach.js into your project and import as: import * from './lib/Teach'
  2. Create a new instance var instance = new Teach('webcam',fn1,fn2). fn1 and fn2 are the functions will be invoked if trained pattern gets recognized. e.g. In the demo:
<script>
	var scrollSpeed = 20;
	fn1(){
		window.scrollBy(0, -this.scrollSpeed);
	},
	fn2(){
		window.scrollBy(0, this.scrollSpeed);
	}
</script>
  1. #console contains the webcam and reaction.
<div id="console" />
  1. #webcam to record your action/gesture:
<video autoplay playsinline muted id="webcam" width="280" height="150" />
  1. Three buttons to train your model, in the demo:
<button onClick="instance.addExample(0)"> Default </button>
<button onClick="instance.addExample(1)"> Up </button>

addExample(1) will trigger fn1().

<button onClick="instance.addExample(2)"> Down </button>

addExample(2) will trigger fn2().

Packages

Core libraries

License

For full details about the license, please check the LICENSE.md file.