← Open Source
trekhleb

machine-learning-experiments

🤖 Interactive Machine Learning experiments: 🏋️models training + 🎨models demo.

TutorialsML/AI fundamentalsJupyter Notebook
Open on GitHub
Momentum
+1stars in 24 hours+0.1%
1.84k
Stars
330
Forks
+3
This week
1
Contributors
Created 2019-11-14 · Updated 2026-10-15 · #5292 today
Top developers

trekhleb/machine-learning-experiments is ranked 5,292 with 1,836 stars.

Same-category comparison

trekhleb/machine-learning-experiments is ranked 5,292 among these 8 peers; peremartra/Large-Language-Model-Notebooks-Course is ranked 5,297.

Same-category comparison
NameRankMetrics
MicrosoftDocs/ml-basics5,242
Language:
Jupyter Notebook
Stars:
1,946
Forks:
2,320
Description:
Exercise notebooks for Machine Learning modules on Microsoft Learn.
goodfeli/dlbook_notation5,247
Language:
TeX
Stars:
1,925
Forks:
384
Description:
LaTeX files for the Deep Learning book notation.
tiepvupsu/ebookMLCB5,257
Language:
Jupyter Notebook
Stars:
1,903
Forks:
469
Description:
ebook Machine Learning cơ bản.
qqfly/how-to-learn-robotics5,260
Language:
Python
Stars:
1,895
Forks:
329
peremartra/Large-Language-Model-Notebooks-Course5,297
Language:
Jupyter Notebook
Stars:
1,824
Forks:
450
Description:
Practical course about Large Language Models.
linyiLYi/snake-ai5,317
Language:
Python
Stars:
1,789
Forks:
397
Description:
An AI agent that beats the classic game "Snake".
amitshekhariitbhu/llm-internals5,334
Stars:
1,753
Forks:
204
Description:
Learn LLM internals step by step - from tokenization to attention to inference optimization.
asinghcsu/AgenticRAG-Survey5,341
Stars:
1,742
Forks:
184
Description:
Agentic-RAG explores advanced Retrieval-Augmented Generation systems enhanced with AI LLM agents.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageJupyter Notebook
CategoryTutorials
SubcategoryML/AI fundamentals
Stars1,836
Forks330
Contributors1
Created date2019-11-14
Updated date2026-10-15
Stars in 1 day1
Stars in 7 days3
Rank5,292
Previous rank9,441
Rank change4,149
7-day stars rank6,841
Previous 7-day stars rank7,937
7-day stars rank change1,096
Total stars rank6,826
Previous total stars rank6,822
Total stars rank change-4
CountryUSA
README summary

🤖 Interactive Machine Learning Experiments 🇺🇦 UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. - Help Ukraine via: - Serhiy Prytula Charity Foundation - Come Back Alive Charity Foundation - National Bank of Ukraine - More info on war. ua and MFA of Ukraine This is a collection of interactive machine-learning experiments. Each experiment consists of 🏋️ Jupyter/Colab _notebook_ (to see how a model was trained) and 🎨 _demo page_ (to see a model in action right in your browser). 🎨 Launch ML experiments demo 🏋️ Launch ML experiments Jupyter

notebooks _You might also be interested in Homemade GPT • JS_ ⚠️ This repository contains machine learning **experiments** and **not** a production ready, reusable, optimised and fine-tuned code and models. This is rather a sandbox or a playground for learning and trying different machine learning approaches, algorithms and data-sets. Models might not perform well and there is a place for overfitting/underfitting. Experiments Most of the models in these experiments were trained using TensorFlow 2 with Keras support. Supervised Machine

Learning Supervised learning is when you have input variables and an output variable and you use an algorithm to learn the mapping function from the input to the output: . The goal is to approximate the mapping function so well that when you have new input data that you can predict the output variables for that data. It is called supervised learning because the process of an algorithm learning from the training dataset can be thought of as a teacher supervising

the learning process. Multilayer Perceptron (MLP) or simple Neural Network (NN) A multilayer perceptron (MLP) is a class of feedforward artificial neural network (ANN). Multilayer perceptrons are sometimes referred to as "vanilla" neural networks (composed of multiple layers of perceptrons), especially when they have a single hidden layer. It can distinguish data that is not linearly separable. Convolutional Neural Networks (CNN) A convolutional neural network (CNN, or ConvNet) is a class of deep neural networks, most commonly applied to analyzing

visual imagery (photos, videos). They are used for detecting and classifying objects on photos and videos, style transfer, face recognition, pose estimation etc. Recurrent Neural Networks (RNN) A recurrent neural network (RNN) is a class of deep neural networks, most commonly applied to sequence-based data like speech, voice, text or music. They are used for machine translation, speech recognition, voice synthesis etc. Unsupervised Machine Learning Unsupervised learning is when you only have input data and no corresponding output variables

. The goal for unsupervised learning is to model the underlying structure or distribution in the data in order to learn more about the data. These are called unsupervised learning because unlike supervised learning above there is no correct answers and there is no teacher. Algorithms are left to their own to discover and present the interesting structure in the data. Generative Adversarial Networks (GANs) A generative adversarial network (GAN) is a class of machine learning frameworks where two neural networks

contest with each other in a game. Two models are trained simultaneously by an adversarial process. For example a _generator

Frequently asked questions

How many stars and forks are recorded?

trekhleb/machine-learning-experiments has 1,836 stars and 330 forks.

What is the repository rank?

trekhleb/machine-learning-experiments is ranked 5,292.

What language and category are recorded?

trekhleb/machine-learning-experiments has 1,836 stars, uses Jupyter Notebook and belongs to Tutorials.

Which repository is closest in rank?

trekhleb/machine-learning-experiments is compared with peremartra/Large-Language-Model-Notebooks-Course, ranked 5,297 with 1,824 stars.

README

🤖 Interactive Machine Learning Experiments

🇺🇦 UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED.

This is a collection of interactive machine-learning experiments. Each experiment consists of 🏋️ Jupyter/Colab notebook (to see how a model was trained) and 🎨 demo page (to see a model in action right in your browser).

You might also be interested in Homemade GPT • JS

⚠️ This repository contains machine learning experiments and not a production ready, reusable, optimised and fine-tuned code and models. This is rather a sandbox or a playground for learning and trying different machine learning approaches, algorithms and data-sets. Models might not perform well and there is a place for overfitting/underfitting.

Experiments

Most of the models in these experiments were trained using TensorFlow 2 with Keras support.

Supervised Machine Learning

Supervised learning is when you have input variables X and an output variable Y and you use an algorithm to learn the mapping function from the input to the output: Y = f(X). The goal is to approximate the mapping function so well that when you have new input data X that you can predict the output variables Y for that data. It is called supervised learning because the process of an algorithm learning from the training dataset can be thought of as a teacher supervising the learning process.

Multilayer Perceptron (MLP) or simple Neural Network (NN)

A multilayer perceptron (MLP) is a class of feedforward artificial neural network (ANN). Multilayer perceptrons are sometimes referred to as "vanilla" neural networks (composed of multiple layers of perceptrons), especially when they have a single hidden layer. It can distinguish data that is not linearly separable.

Experiment

Model demo & training

Tags

Dataset

     ![Handwritten digits recognition (MLP)](demos/src/images/digits_recognition_mlp.png) 
  

  

    [Handwritten Digits Recognition (MLP)](experiments/digits_recognition_mlp/digits_recognition_mlp.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/DigitsRecognitionMLP)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/digits_recognition_mlp/digits_recognition_mlp.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/digits_recognition_mlp/digits_recognition_mlp.ipynb)
  

  

    MLP
  

  

    [MNIST](https://www.tensorflow.org/datasets/catalog/mnist)
  






  

     ![Handwritten sketch recognition (MLP)](demos/src/images/sketch_recognition_mlp.png) 
  

  

    [Handwritten Sketch Recognition (MLP)](experiments/sketch_recognition_mlp/sketch_recognition_mlp.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/SketchRecognitionMLP)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/sketch_recognition_mlp/sketch_recognition_mlp.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/sketch_recognition_mlp/sketch_recognition_mlp.ipynb)
  

  

    MLP
  

  

    [QuickDraw](https://github.com/googlecreativelab/quickdraw-dataset)

Convolutional Neural Networks (CNN)

A convolutional neural network (CNN, or ConvNet) is a class of deep neural networks, most commonly applied to analyzing visual imagery (photos, videos). They are used for detecting and classifying objects on photos and videos, style transfer, face recognition, pose estimation etc.

Experiment

Model demo & training

Tags

Dataset

     ![Handwritten digits recognition (CNN)](demos/src/images/digits_recognition_cnn.png) 
  

  

    [Handwritten Digits Recognition (CNN)](experiments/digits_recognition_cnn/digits_recognition_cnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/DigitsRecognitionCNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/digits_recognition_cnn/digits_recognition_cnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/digits_recognition_cnn/digits_recognition_cnn.ipynb)
  

  

    CNN
  

  

    [MNIST](https://www.tensorflow.org/datasets/catalog/mnist)
  






  

     ![Handwritten sketch recognition (CNN)](demos/src/images/sketch_recognition_cnn.png) 
  

  

    [Handwritten Sketch Recognition (CNN)](experiments/sketch_recognition_cnn/sketch_recognition_cnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/SketchRecognitionCNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/sketch_recognition_cnn/sketch_recognition_cnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/sketch_recognition_cnn/sketch_recognition_cnn.ipynb)
  

  

    CNN
  

  

    [QuickDraw](https://github.com/googlecreativelab/quickdraw-dataset)
  






  

     ![Rock Paper Scissors](demos/src/images/rock_paper_scissors_cnn.jpg) 
  

  

    [Rock Paper Scissors (CNN)](experiments/rock_paper_scissors_cnn/rock_paper_scissors_cnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/RockPaperScissorsCNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/rock_paper_scissors_cnn/rock_paper_scissors_cnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/rock_paper_scissors_cnn/rock_paper_scissors_cnn.ipynb)
  

  

    CNN
  

  

    [RPS](http://www.laurencemoroney.com/rock-paper-scissors-dataset/)
  






  

     ![Rock Paper Scissors](demos/src/images/rock_paper_scissors_mobilenet_v2.jpg) 
  

  

    [Rock Paper Scissors (MobilenetV2)](experiments/rock_paper_scissors_mobilenet_v2/rock_paper_scissors_mobilenet_v2.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/RockPaperScissorsMobilenetV2)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/rock_paper_scissors_mobilenet_v2/rock_paper_scissors_mobilenet_v2.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/rock_paper_scissors_mobilenet_v2/rock_paper_scissors_mobilenet_v2.ipynb)
  

  

    MobileNetV2,
    Transfer learning,
    CNN
  

  

    [RPS](http://www.laurencemoroney.com/rock-paper-scissors-dataset/),
    [ImageNet](http://image-net.org/explore)
  






  

     ![Objects detection](demos/src/images/objects_detection_ssdlite_mobilenet_v2.jpg) 
  

  

    [Objects Detection (MobileNetV2)](experiments/objects_detection_ssdlite_mobilenet_v2/objects_detection_ssdlite_mobilenet_v2.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/ObjectsDetectionSSDLiteMobilenetV2)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/objects_detection_ssdlite_mobilenet_v2/objects_detection_ssdlite_mobilenet_v2.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/objects_detection_ssdlite_mobilenet_v2/objects_detection_ssdlite_mobilenet_v2.ipynb)
  

  

    MobileNetV2,
    SSDLite,
    CNN
  

  

    [COCO](http://cocodataset.org/#home)
  






  

     ![Objects detection](demos/src/images/image_classification_mobilenet_v2.jpg) 
  

  

    [Image Classification (MobileNetV2)](experiments/image_classification_mobilenet_v2/image_classification_mobilenet_v2.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/ImageClassificationMobilenetV2)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/image_classification_mobilenet_v2/image_classification_mobilenet_v2.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/image_classification_mobilenet_v2/image_classification_mobilenet_v2.ipynb)
  

  

    MobileNetV2,
    CNN
  

  

    [ImageNet](http://image-net.org/explore)

Recurrent Neural Networks (RNN)

A recurrent neural network (RNN) is a class of deep neural networks, most commonly applied to sequence-based data like speech, voice, text or music. They are used for machine translation, speech recognition, voice synthesis etc.

Experiment

Model demo & training

Tags

Dataset

     ![Numbers summation (RNN)](demos/src/images/numbers_summation_rnn.png) 
  

  

    [Numbers Summation (RNN)](experiments/numbers_summation_rnn/numbers_summation_rnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/NumbersSummationRNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/numbers_summation_rnn/numbers_summation_rnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/numbers_summation_rnn/numbers_summation_rnn.ipynb)
  

  

    LSTM,
    Sequence-to-sequence
  

  

    Auto-generated
  






  

     ![Shakespeare Text Generation (RNN)](demos/src/images/text_generation_shakespeare_rnn.jpg) 
  

  

    [Shakespeare Text Generation (RNN)](experiments/text_generation_shakespeare_rnn/text_generation_shakespeare_rnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/TextGenerationShakespeareRNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/text_generation_shakespeare_rnn/text_generation_shakespeare_rnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/text_generation_shakespeare_rnn/text_generation_shakespeare_rnn.ipynb)
  

  

    LSTM,
    Character-based RNN
  

  

    [Shakespeare](https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt)
  






  

     ![Wikipedia Text Generation (RNN)](demos/src/images/text_generation_wikipedia_rnn.png) 
  

  

    [Wikipedia Text Generation (RNN)](experiments/text_generation_wikipedia_rnn/text_generation_wikipedia_rnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/TextGenerationWikipediaRNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/text_generation_wikipedia_rnn/text_generation_wikipedia_rnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/text_generation_wikipedia_rnn/text_generation_wikipedia_rnn.ipynb)
  

  

    LSTM,
    Character-based RNN
  

  

    [Wikipedia](https://www.tensorflow.org/datasets/catalog/wikipedia)
  






  

     ![Recipe Generation (RNN)](demos/src/images/recipe_generation_rnn.jpg) 
  

  

    [Recipe Generation (RNN)](experiments/recipe_generation_rnn/recipe_generation_rnn.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/RecipeGenerationRNN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/recipe_generation_rnn/recipe_generation_rnn.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/recipe_generation_rnn/recipe_generation_rnn.ipynb)
  

  

    LSTM,
    Character-based RNN
  

  

    [Recipe box](https://eightportions.com/datasets/Recipes/)

Unsupervised Machine Learning

Unsupervised learning is when you only have input data X and no corresponding output variables. The goal for unsupervised learning is to model the underlying structure or distribution in the data in order to learn more about the data. These are called unsupervised learning because unlike supervised learning above there is no correct answers and there is no teacher. Algorithms are left to their own to discover and present the interesting structure in the data.

Generative Adversarial Networks (GANs)

A generative adversarial network (GAN) is a class of machine learning frameworks where two neural networks contest with each other in a game. Two models are trained simultaneously by an adversarial process. For example a generator ("the artist") learns to create images that look real, while a discriminator ("the art critic") learns to tell real images apart from fakes.

Experiment

Model demo & training

Tags

Dataset

     ![Clothes Generation (DCGAN)](demos/src/images/clothes_generation_dcgan.jpg) 
  

  

    [Clothes Generation (DCGAN)](experiments/clothes_generation_dcgan/clothes_generation_dcgan.ipynb)
  

  

    [![Launch demo](https://img.shields.io/static/v1?label=%F0%9F%8E%A8%20Launch&message=Demo&color=green)](https://trekhleb.github.io/machine-learning-experiments/#/experiments/ClothesGenerationDCGAN)
    [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://nbviewer.jupyter.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/clothes_generation_dcgan/clothes_generation_dcgan.ipynb)
    [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/clothes_generation_dcgan/clothes_generation_dcgan.ipynb)
  

  

    DCGAN
  

  

    [Fashion MNIST](https://www.tensorflow.org/datasets/catalog/fashion_mnist)

How to use this repository locally

Setup virtual environment for Experiments

# Create "experiments" environment (from the project root folder).
python3 -m venv .virtualenvs/experiments

# Activate environment.
source .virtualenvs/experiments/bin/activate
# or if you use Fish...
source .virtualenvs/experiments/bin/activate.fish

To quit an environment run deactivate.

Install dependencies

# Upgrade pip and setuptools to the latest versions.
pip install --upgrade pip setuptools

# Install packages
pip install -r requirements.txt

To install new packages run pip install package-name. To add new packages to the requirements run pip freeze > requirements.txt.

Launch Jupyter locally

In order to play around with Jupyter notebooks and see how models were trained you need to launch a Jupyter Notebook server.

# Launch Jupyter server.
jupyter notebook

Jupyter will be available locally at http://localhost:8888/. Notebooks with experiments may be found in experiments folder.

Launch demos locally

Demo application is made on React by means of create-react-app.

# Switch to demos folder from project root.
cd demos

# Install all dependencies.
yarn install

# Start demo server on http. 
yarn start

# Or start demo server on https (for camera access in browser to work on localhost).
yarn start-https

Demos will be available locally at http://localhost:3000/ or at https://localhost:3000/.

Convert models

The converter environment is used to convert the models that were trained during the experiments from .h5 Keras format to Javascript understandable formats (tfjs_layers_model or tfjs_graph_model formats with .json and .bin files) for further usage with TensorFlow.js in Demo application.

# Create "converter" environment (from the project root folder).
python3 -m venv .virtualenvs/converter

# Activate "converter" environment.
source .virtualenvs/converter/bin/activate
# or if you use Fish...
source .virtualenvs/converter/bin/activate.fish

# Install converter requirements.
pip install -r requirements.converter.txt

The conversion of keras models to tfjs_layers_model/tfjs_graph_model formats is done by tfjs-converter:

For example:

tensorflowjs_converter --input_format keras \
  ./experiments/digits_recognition_mlp/digits_recognition_mlp.h5 \
  ./demos/public/models/digits_recognition_mlp

⚠️ Converting the models to JS understandable formats and loading them to the browser directly might not be a good practice since in this case the user might need to load tens or hundreds of megabytes of data to the browser which is not efficient. Normally the model is being served from the back-end (i.e. TensorFlow Extended) and instead of loading it all to the browser the user will do a lightweight HTTP request to do a prediction. But since the Demo App is just an experiment and not a production-ready app and for the sake of simplicity (to avoid having an up and running back-end) we're converting the models to JS understandable formats and loading them directly into the browser.

Requirements

Recommended versions:

  • Python: > 3.7.3.
  • Node: >= 12.4.0.
  • Yarn: >= 1.13.0.

In case if you have Python version 3.7.3 you might experience RuntimeError: dictionary changed size during iteration error when trying to import tensorflow (see the issue).

You might also be interested in

Articles

Author

Nearby in the ranking
Similar items