CINXE.COM
Webcam Pacman
<!-- Copyright 2018 Google LLC. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============================================================================== --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Webcam Pacman</title> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.cyan-teal.min.css"> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> <script defer="" src="https://code.getmdl.io/1.3.0/material.min.js"></script> <link rel="stylesheet" href="styles.f16cda59.css"> </head> <body> <header> Turn your <b>Web Camera</b> into a controller using a <b>Neural Network</b>. </header> <div id="no-webcam"> No webcam found. <br> To use this demo, use a device with a webcam. </div> <!-- Top --> <div id="pacman-container"> <div id="logo"> <div id="logo-l"> <div id="logo-b"> </div> </div> </div> </div> <div id="status">Loading mobilenet...</div> <div class="controller-panels" id="controller" style="display:none"> <div class="panel training-panel"> <!-- Big buttons. --> <div class="panel-row big-buttons"> <button id="train"> <img width="66" height="66" src="button.e29837f8.svg"> <span id="train-status">TRAIN MODEL</span> </button> <button id="predict"> <img width="66" height="66" src="button.e29837f8.svg"> <span>PLAY</span> </button> </div><!-- /.panel-row --> <div class="panel-row params-webcam-row"> <!-- Hyper params. --> <div class="hyper-params"> <!-- Learning rate --> <div class="dropdown"> <label>Learning rate</label> <div class="select"> <select id="learningRate"> <option value="0.00001">0.00001</option> <option selected="" value="0.0001">0.0001</option> <option value="0.01">0.001</option> <option value="0.03">0.003</option> </select> </div> </div> <!-- Batch size --> <div class="dropdown"> <label>Batch size</label> <div class="select"> <select id="batchSizeFraction"> <option value="0.05">0.05</option> <option value="0.1">0.1</option> <option selected="" value="0.4">0.4</option> <option value="1">1</option> </select> </div> </div> <!-- Epochs --> <div class="dropdown"> <label>Epochs</label> <div class="select"> <select id="epochs"> <option value="10">10</option> <option selected="" value="20">20</option> <option value="40">40</option> </select> </div> </div> <!-- Hidden units --> <div class="dropdown"> <label>Hidden units</label> <div class="select"> <select id="dense-units"> <option value="10">10</option> <option selected="" value="100">100</option> <option value="200">200</option> </select> </div> </div> </div><!-- /.hyper-params --> <div class="webcam-box-outer"> <div class="webcam-box-inner"> <video autoplay="" playsinline="" muted="" id="webcam" width="224" height="224"></video> </div> </div> </div><!-- /.panel-row --> </div><!-- /.panel --> <div class="panel joystick-panel"> <div class="panel-row panel-row-top"> <div class="panel-cell panel-cell-left panel-cell-fill"> <p class="help-text"> Click to add the <br> current camera <br> view as an example <br> for that control </p> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-center"> <div class="thumb-box"> <div class="thumb-box-outer"> <div class="thumb-box-inner"> <canvas class="thumb" width="224" height="224" id="up-thumb"></canvas> </div> <button class="record-button" id="up"><span>Add Sample</span></button> </div> <p> <span id="up-total">0</span> examples </p> </div> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-right panel-cell-fill"> </div><!-- ./panel-cell --> </div><!-- /.panel-row --> <div class="panel-row panel-row-middle"> <div class="panel-cell panel-cell-left"> <div class="thumb-box"> <div class="thumb-box-outer"> <div class="thumb-box-inner"> <canvas class="thumb" width="224" height="224" id="left-thumb"></canvas> </div> <button class="record-button" id="left"><span>Add Sample</span></button> </div> <p> <span id="left-total">0</span> examples </p> </div> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-center panel-cell-fill"> <img height="108" width="129" src="joystick.7cdf96ba.png"> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-right"> <div class="thumb-box"> <div class="thumb-box-outer"> <div class="thumb-box-inner"> <canvas class="thumb" width="224" height="224" id="right-thumb"></canvas> </div> <button class="record-button" id="right"><span>Add Sample</span></button> </div> <p> <span id="right-total">0</span> examples </p> </div> </div><!-- ./panel-cell --> </div><!-- /.panel-row --> <div class="panel-row panel-row-bottom"> <div class="panel-cell panel-cell-left panel-cell-fill"> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-center"> <div class="thumb-box"> <div class="thumb-box-outer"> <div class="thumb-box-inner"> <canvas class="thumb" width="224" height="224" id="down-thumb"></canvas> </div> <button class="record-button" id="down"><span>Add Sample</span></button> </div> <p> <span id="down-total">0</span> examples </p> </div> </div><!-- ./panel-cell --> <div class="panel-cell panel-cell-right panel-cell-fill"> </div><!-- ./panel-cell --> </div><!-- /.panel-row --> </div><!-- /.panel --> </div><!-- /#controller --> <p id="copyright">PAC-MAN™ © BANDAI NAMCO Entertainment Inc.</p> <script src="https://storage.googleapis.com/tfjs-examples/assets/webcam-transfer-learning/pacman-google.js"></script> <script src="webcam-transfer-learning.bd3eb700.js"></script> </body> </html>