Extensions
LookExtension
LookExtension was developed at MIT and this uses machine learning to classify images. However, The original MIT LookExtension works on a limited number of Android devices. We hacked LookExtension so that it works on all devices, although the inference speed is much slower. So far, we confirmed our LookExtension works on a few of MIT original LookExtension unsupported devices such as Google Nexus 5, Moto G Play, and Samsung Galaxy Tab 4 8.0. You can download our LookExtension from here.
What has changed and why?
LookExtensiom uses TensorFlow.js, a JavaScript version of the machine learning software TensorFlow. TensorFlow.js uses WebGL2 (use GPU) for backend module. However, not all Android devices support WebGL2, so devices that do not support WebGL2 will cause errors when running. We changed it to use the CPU backend module instead of WebGL2 on devices that do not support WebGL2. The only file to change is assests/look.js. Add the following + lines.
let mobilenet;
+ var supportsWebGL2 = ( function () {
+ try {
+ return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'webgl2' );
+ } catch( e ) {
+ return false;
+ }
+ } )();
const mobilenetDemo = async () => {
+ if(supportsWebGL2){
+ console.log("WebGL2 is supported");
+ }else{
+ console.log("WebGL2 is not supported");
+ tf.setBackend('cpu');
+ }