keras-js | Run Keras models in the browser, with GPU support using WebGL | Machine Learning library

 by   transcranial JavaScript Version: 1.0.3 License: MIT

kandi X-RAY | keras-js Summary

kandi X-RAY | keras-js Summary

keras-js is a JavaScript library typically used in Artificial Intelligence, Machine Learning, Deep Learning, Tensorflow, Keras, WebGL applications. keras-js has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i keras-js' or download it from GitHub, npm.

Run Keras models in the browser, with GPU support using WebGL
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              keras-js has a medium active ecosystem.
              It has 4936 star(s) with 523 fork(s). There are 181 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 70 open issues and 45 have been closed. On average issues are closed in 184 days. There are 11 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of keras-js is 1.0.3

            kandi-Quality Quality

              keras-js has 0 bugs and 0 code smells.

            kandi-Security Security

              keras-js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              keras-js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              keras-js is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              keras-js releases are available to install and integrate.
              Deployable package is available in npm.
              keras-js saves you 107 person hours of effort in developing the same functionality from scratch.
              It has 272 lines of code, 3 functions and 254 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed keras-js and discovered the below as its top functions. This is intended to give you an instant insight into keras-js implemented functionality, and help decide if they suit your requirements.
            • Create diagram data structure
            • cropping the bounds
            • Create indices for the given shape .
            • Unroll a 2D T .
            • get the top - set of top classes
            • Creates data from a DDL3D array
            • Create an image from an array
            • Converts a touch event into a coordinate .
            • Calculates the minimum and maximum of the given array .
            • 2D - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Get all kandi verified functions for this library.

            keras-js Key Features

            No Key Features are available at this moment for keras-js.

            keras-js Examples and Code Snippets

            No Code Snippets are available at this moment for keras-js.

            Community Discussions

            QUESTION

            How to find keras.json file in google colab?
            Asked 2019-Aug-07 at 10:34

            On my local system I know where is the keras.json file present(.keras/keras.json) but when I switched to google colab, I don't know where to find it.

            I did google search for this problem but have not got any answer. I went through this link but got nothing helpful.

            Any reply and reference will be appreciable.

            ...

            ANSWER

            Answered 2019-Aug-07 at 10:34

            I can find that file in colab ~/.keras/keras.json

            Good post to dynamically switch backend https://stackoverflow.com/a/44446822/8660575

            Source https://stackoverflow.com/questions/57388261

            QUESTION

            keras-js "Error: [Model] Model configuration does not contain any layers."
            Asked 2019-Jun-07 at 02:04

            Im trying to load a simple example network created with keras in the browser using keras-js. After saving the model as .h5 file and converting it to a .bin file I get following error while loading it:

            ...

            ANSWER

            Answered 2019-Jun-07 at 02:04

            Well, I knew nothing about this JS library but I tried to reproduce the problem and I really get that error you mentioned. HOWEVER, a careful programmer would notice that an error previous to that mentioned error had shown up. And it was the following:

            Access to XMLHttpRequest at 'file:///< your_local_path_to_keras-js >/keras-js-master/example.bin' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

            You can read more about this issue in this question. Basically, a webapp is not allowed to access your local files due to security measures. Then, you need to serve these files, which can be easily done with the following python command:

            Source https://stackoverflow.com/questions/49201067

            QUESTION

            How to call a multidimensional prediction on a keras model with a javascript api
            Asked 2018-Jun-17 at 10:30

            I have trained a model based on the keras lstm_text_generation example, and I would like to perform predictions on this model with front-end javascript.

            First I tried using keras.js, however that only takes 1-dimensional Float32Array vectors in it's prediction function so I am unable to use it since the lstm_text_generation example uses a multidimensional array of shape (1, maxlen, len(chars)).

            Next I tried using tensorflow.js, using this tutorial to port my keras model to a model.json file. Everything seems to work fine, up to the point where I perform the actual prediction where it freezes and gives me the warning Orthogonal initializer is being called on a matrix with more than 2000 (65536) elements: Slowness may result.

            I noticed that in many of the tensorflow.js examples, people convert their arrays to tensor2d, but I did this and it had no effect on the performance of my code.

            For anyone curious, here is the javascript code I wrote...

            ...

            ANSWER

            Answered 2018-Jun-17 at 10:30

            x_pred needs to be a tensor, the simplest way to create a tensor with custom values is tf.buffer, which can be initialized with a TypedArray or can be modified using .set() which would be better for you, because most of your values are 0 and buffer are filled with zeros by default. And to create a tensor out of a buffer just use .toTensor();

            So it would something like this:

            Source https://stackoverflow.com/questions/50895494

            QUESTION

            Implementing Keras Model into website with Keras.js
            Asked 2017-Aug-09 at 15:03

            I have been trying to implement a basic Keras model generated in Python into a website using the Keras.js library. Now, I have the model trained and exported into the model.json, model_weights.buf, and model_metadata.json files. Now, I essentially copied and pasted test code from the github page to see if the model would load in browser, but unfortunately I am getting errors. Here is the test code. (EDIT: I fixed some errors, see below for remaining ones.)

            ...

            ANSWER

            Answered 2017-Aug-03 at 19:39

            Ok, so I figured out why this was happening. There were two problems. First, the data array needs to be flattened, so i wrote a quick function to take the 2D input and "flatten" it to be a 1D array of length 784. Then, because I used a Sequential model, the key name of the data should not have been 'input_1', but rather just 'input'. This got rid of all the errors.

            Now, to get the output information, we simply can store it in an array like this: var out = outputData['output']. Because I used the MNIST data set, out was a 1D array of length 10 that contained probabilities of each digit being the user-written digit. From there, you can simply find the number with the highest probability and use that as a prediciton for the model.

            Source https://stackoverflow.com/questions/45470067

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install keras-js

            You can install using 'npm i keras-js' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i keras-js

          • CLONE
          • HTTPS

            https://github.com/transcranial/keras-js.git

          • CLI

            gh repo clone transcranial/keras-js

          • sshUrl

            git@github.com:transcranial/keras-js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link