未验证 提交 f08efe20 编写于 作者: W wangqun 提交者: GitHub

Merge branch 'master' into master

[中文版](https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/web/README_cn.md) [中文版](./README_cn.md)
# Web # Paddle.js
Paddle.js is an Web project for Baidu Paddle, which is an an open source deep learning framework designed to work on web browser. Load a pretrained paddle.js SavedModel or Paddle Hub module into the browser and run inference through Paddle.js. It could run on nearly every browser with WebGL support. Paddle.js is an Web project for Baidu Paddle, which is an an open source deep learning framework designed to work on web browser. Load a pretrained paddle.js SavedModel or Paddle Hub module into the browser and run inference through Paddle.js. It could run on nearly every browser with WebGL support.
...@@ -33,7 +33,7 @@ If the original model was a SavedModel, use paddle.load(). ...@@ -33,7 +33,7 @@ If the original model was a SavedModel, use paddle.load().
```bash ```bash
import * as tf from 'paddlejs'; import Paddle from 'paddlejs';
let feed = io.process({ let feed = io.process({
...@@ -90,7 +90,7 @@ Please see fetch documentation for details. ...@@ -90,7 +90,7 @@ Please see fetch documentation for details.
## Run the converter script provided by the pip package: ## Run the converter script provided by the pip package:
The converter expects a Paddlejs SavedModel, Paddle Hub module, Tpaddle.js JSON format for input. The converter expects a Paddlejs SavedModel, Paddle Hub module, paddle.js JSON format for input.
## Web-friendly format ## Web-friendly format
......
# Web [中文版](./README_cn.md)
该Web项目是致力于在浏览器中运行的开源深度学习框架,在支持WebGL的浏览器上即可直接运行。 # Paddle.js
## 主要特点 Paddle.js是百度Paddle的web方向子项目,是一个运行在浏览器中的开源深度学习框架。Paddle.js可以加载提前训练好的paddle模型,或者将paddle hub中的模型通过paddle.js的模型转换工具变成浏览器友好的模型进行在线推理预测使用。目前,paddle.js仅可以在支持webGL的浏览器中运行。
### 模块化
该Web项目建立于Atom组件之上。Atom组件在WebGL基础上进行了封装,可以方便的进行通用GPU计算任务。它是高度模块化的,不仅可以用于本项目,也可以用于其它的WebGL加速场景。 ## 主要特点
### 高性能 ### Modular
目前Web项目运行TinyYolo模型可以达到30ms以内,对于一般的实时场景已经足够应对。 Web project is built on Atom system which is a versatile framework to support GPGPU operation on WebGL. It is quite modular and could be used to make computation tasks faster by utilizing WebGL.
### 浏览器覆盖 ### 浏览器覆盖范围
* PC: Chrome * PC: Chrome
* Mac: Chrome * Mac: Chrome
* Android: Baidu App and QQ Browser * Android: Baidu App and QQ Browser
## 如何构建部署 demo ### 支持的操作
Currently Paddle.js only supports a limited set of Paddle Ops. See the full list. If your model uses unsupported ops, the Paddle.js script will fail and produce a list of the unsupported ops in your model. Please file issues to let us know what ops you need support with.
目前,Paddle.js只支持有限的一组算子操作。如果您的模型使用不支持的操作,那么padde.js将运行失败,如果您的模型中存在不支持的op操作的列表。请提出问题,让我们知道你需要支持。
[查看完整列表](./src/factory/fshader/README.md)
## 加载和运行模型
如果原始模型是浏览器友好的model格式, 使用 paddle.load()接在模型。
```bash ```bash
cd web # 进入根目录
npm i # 安装依赖 import Paddle from 'paddlejs';
mkdir dist # 创建资源目录
cd dist # 进入资源目录 let feed = io.process({
git clone https://github.com/DerekYangMing/Paddle-Web-Models.git # 获取模型 input: document.getElementById('image'),
mv Paddle-Web-Models/separablemodel . # 移动模型到制定地点 params: {
cd .. # 返回根目录 gapFillWith: '#000', // What to use to fill the square part after zooming
npm run testVideoDemo # 启动 demo 服务 targetSize: {
height: fw,
width: fh
},
targetShape: [1, 3, fh, fw], // Target shape changed its name to be compatible with previous logic
// shape: [3, 608, 608], // Preset sensor shape
mean: [117.001, 114.697, 97.404], // Preset mean
// std: [0.229, 0.224, 0.225] // Preset std
}
});
const MODEL_CONFIG = {
dir: `/${path}/`, // model URL
main: 'model.json', // main graph
};
const paddle = new Paddle({
urlConf: MODEL_CONFIG,
options: {
multipart: true,
dataType: 'binary',
options: {
fileCount: 1, // How many model have been cut
getFileName(i) {
return 'chunk_' + i + '.dat';
}
}
}
});
model = await paddle.load();
// run model
let inst = model.execute({
input: feed
});
// There should be a fetch execution call or a fetch output
let result = await inst.read();
``` ```
## 如何预览 demo 对于前输入处理的有关详细信息,请参阅feed文档。
对于得到结果后输出处理的有关详细信息,请参阅fetch文档。
## 运行Paddle.js提供的转换器脚本
模型转换器需要输入一个Paddle格式的model,可以是Paddle Hub中的model,运行转换器将会得到paddle.js的JSON格式model。
## eb友好的model格式
上面的转换脚本生成两种类型的文件:
- model.json (数据流图和权重清单文件)
- group1-shard\*of\* (二进制权重文件的集合)
## 预览演示
Paddle.js已经将一些模型转换成了Paddle.js支持的格式。在下面的URL中有一些演示,打开一个带有演示的浏览器页面。
[查看更多](./examples/README.md)
1. 在浏览器中打开url: https://localhost:8123/ ## 反馈和社区支持
2. 点击【开始检测】按钮。
3. 将人脸对准摄像头,没有问题的话,可以正常检测到人脸。
## 交流与反馈 - Questions, reports, and suggestions are welcome through Github Issues!
* 欢迎您通过Github Issues来提交问题、报告与建议 - Forum: Opinions and questions are welcome at our [PaddlePaddle Forum](https://ai.baidu.com/forum/topic/list/168)
* QQ群: 696965088 - QQ group chat: 696965088
* 论坛: 欢迎大家在[PaddlePaddle论坛](https://ai.baidu.com/forum/topic/list/168)分享在使用PaddlePaddle中遇到的问题和经验, 营造良好的论坛氛围
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册