Tensorflow.js on fly
2018-07-07 本文已影响19人
yingshaoxo
Have a try
0. Source come from
https://js.tensorflow.org/tutorials/webcam-transfer-learning.html
1. Installation
After googled how to install nodejs
and npm
:
git clone https://github.com/tensorflow/tfjs-examples
cd tfjs-examples/webcam-transfer-learning
yarn
yarn watch
Take a picture from webcamera
vim index.html
:
<html>
<body>
<video autoplay playsinline muted id="webcam" width="224" height="224"></video>
<script src="index.js"></script>
</body>
</html>
vim index.js
:
import {Webcam} from './webcam';
const webcam = new Webcam(document.getElementById('webcam'));
async function init() {
try {
await webcam.setup();
} catch (e) {
console.log(e);
}
}
init();
yarn watch
https://github.com/yingshaoxo/age-and-gender-detection-in-real-time-with-tensorflowjs