This repository contains a collection of examples using ml5.js. The examples are meant to serve as an introduction to the library and machine learning concepts.
Examples are organized into folders according to their integration with other JavaScript libraries.
For example, the /p5js
folder holds examples of using ml5.js with p5.js. All examples are self-contained and can be run independently. Libraries are loaded through a Content Delivery Network (CDN) and certain examples (indicated in code comments) download a machine learning model from a "cloud" url. This means that ml5 currently relies on an internet connection in order to retrieve pre-trained models (unless they are served locally).
Instead of using the CDN links to p5 and ml5, you can download the p5.js libraries here and ml5 library here.
Download or clone this repository:
git clone https://github.com/ml5js/ml5-examples.git
Change directory into the new folder and start a server. An easy way to start a server is with python. If you are have python 2:
cd ml5-examples
python -m SimpleHTTPServer
If you are have python 3:
cd ml5-examples
python -m http.server
If you don't know how to start a server, check this guide.
Below is the current release
examples index:
ml5.js does not require p5.js, however as ml5.js and p5.js have been designed to play nicely with eachother, most of our examples currently are developed together with p5.js. The following "vanilla" javascript examples showcase the use of ml5 without p5.js.
- FeatureExtractor_Image_Classification
- ImageClassification_Video
- ImageClassification
- StyleTransfer_Image
- PoseNet
- CVAE
- BodyPix_Image
- BodyPix_Webcam
- BodyPix_Webcam_Parts
- DCGAN
- Sentiment
- UNET
- Word2Vec
- FeatureExtractor_Image_Classification
- FeatureExtractor_Image_Regression
- StyleTransfer_Video
- StyleTransfer_Image
- ImageClassification_Video
- ImageClassification_VideoScavengerHunt
- ImageClassification
- ImageClassification_VideoSoundTranslate
- ImageClassification_VideoSound
- ImageClassification_MultipleImages
- KNNClassification_VideoSound
- KNNClassification_Video
- KNNClassification_PoseNet
- KNNClassification_VideoSquare
- SketchRNN_basic
- SketchRNN_interactive
- PitchDetection_Game
- PitchDetection
- CharRNN_Interactive
- CharRNN_Text
- CharRNN_Text_Stateful
- Pix2Pix_callback
- Pix2Pix_promise
- YOLO_webcam
- YOLO_single_image
- PoseNet_image_single
- PoseNet_webcam
- PoseNet_part_selection
The p5.js examples can also be run using the p5.js web editor. We are in the process of porting and would welcome any contributions!
You can find all of our examples here:
NOTE: not all of the ml5.js examples are currently working on the p5.js web editor. Stay tuned for updates!
See CONTRIBUTING.MD
Thanks goes to these wonderful people (emoji key):
Michael Salaverry 🖋 🐛 |
This project follows the all-contributors specification. Contributions of any kind welcome!