tfjs-models README

The project's README from github.com/tensorflow/tfjs-models. As one markdown file: README.md.

Pre-trained TensorFlow.js models

This repository hosts a set of pre-trained models that have been ported to TensorFlow.js.

The models are hosted on NPM and unpkg so they can be used in any project out of the box. They can be used directly or used in a transfer learning setting with TensorFlow.js.

To find out about APIs for models, look at the README in each of the respective directories. In general, we try to hide tensors so the API can be used by non-machine learning experts.

For those interested in contributing a model, please file a GitHub issue on tfjs to gauge interest. We are trying to add models that complement the existing set of models and can be used as building blocks in other apps.

Models

Type Model Demo Details Install
Images
MobileNet
live Classify images with labels from the ImageNet database. npm i @tensorflow-models/mobilenet
source
Hand
live Real-time hand pose detection in the browser using TensorFlow.js. npm i @tensorflow-models/hand-pose-detection
source
Pose
live An API for real-time human pose detection in the browser. npm i @tensorflow-models/pose-detection
source
Coco SSD
Object detection model that aims to localize and identify multiple objects in a single image. Based on the TensorFlow object detection API. npm i @tensorflow-models/coco-ssd
source
DeepLab v3
Semantic segmentation npm i @tensorflow-models/deeplab
source
Face Landmark Detection
live Real-time 3D facial landmarks detection to infer the approximate surface geometry of a human face npm i @tensorflow-models/face-landmarks-detection
source
Audio
Speech Commands
live Classify 1 second audio snippets from the speech commands dataset. npm i @tensorflow-models/speech-commands
source
Text
Universal Sentence Encoder
Encode text into a 512-dimensional embedding to be used as inputs to natural language processing tasks such as sentiment classification and textual similarity. npm i @tensorflow-models/universal-sentence-encoder
source
Text Toxicity
live Score the perceived impact a comment might have on a conversation, from "Very toxic" to "Very healthy". npm i @tensorflow-models/toxicity
source
Depth Estimation
Portrait Depth
live Estimate per-pixel depth (the distance to the camera center) for a single portrait image, which can be further used for creative applications such as 3D photo and relighting. npm i @tensorflow-models/depth-estimation
source
General Utilities
KNN Classifier
This package provides a utility for creating a classifier using the K-Nearest Neighbors algorithm. Can be used for transfer learning. npm i @tensorflow-models/knn-classifier
source

Development

You can run the unit tests for any of the models by running the following inside a directory:

yarn test

New models should have a test NPM script (see this package.json and run_tests.ts helper for reference).

To run all of the tests, you can run the following command from the root of this repo:

yarn presubmit

tfjs-models (tensorflow/tfjs-models)

Searching Database…

这是什么?一组预训练好的机器学习模型,已移植到 TensorFlow.js,涵盖视觉、音频、文本和通用工具类任务,可直接在浏览器或 Node.js 项目中使用。
这是一个单独的库,还是一组独立的包?这是一组独立的 npm 包,每个模型对应一个包(例如 mobilenet、pose-detection、coco-ssd),每个包都可以单独安装。
我该如何把模型加入我的项目?从 npm 安装对应的模型包,例如 'npm i @tensorflow-models/coco-ssd' 或 'npm i @tensorflow-models/pose-detection',然后导入并调用它的 API。
使用这些模型需要了解 TensorFlow 的内部原理吗?不需要,这些 API 的设计隐藏了张量(tensor)等细节,非机器学习专家也能直接使用。
除了开箱即用的推理,我还能怎么使用这些模型?可以。大多数模型还支持迁移学习,并且提供了 KNN 分类器工具,专门用于在模型输出之上构建自定义分类器。
这些模型在哪里运行?它们通过 TensorFlow.js 在浏览器端运行,因为它们通过 NPM 和 unpkg 分发,可直接用于网页。
包含哪些类型的模型?视觉类模型(MobileNet、姿态/手部/面部关键点检测、Coco SSD、DeepLab v3、人像深度估计)、一个音频语音指令分类器、文本模型(Universal Sentence Encoder、毒性内容评分),以及一个通用的 KNN 分类器工具。
安装前我能先试用演示吗?每个模型条目都附有在线演示和源代码链接,你可以在把 npm 包添加到自己的项目之前先看看实际效果。
我该如何为这个仓库提议一个新模型?在主 tfjs 仓库上提交一个 GitHub issue,以了解大家的兴趣;维护者会优先考虑那些能补充现有模型集、并可作为其他应用基础模块的模型。
我该如何运行某个模型的测试?在某个模型的目录下运行 'yarn test',或在仓库根目录运行 'yarn presubmit' 来测试所有模型。
Creator
tensorflow
Size
171.7 MB
Stars
14.8K
Age
8y
Commits · 90 Days