Skip to content

Commit

Permalink
test=pre-develop, test=documents_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
D-DanielYang committed Nov 20, 2020
1 parent c093331 commit edbe41b
Show file tree
Hide file tree
Showing 263 changed files with 7,832 additions and 7,365 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)

## 简介
- PaddleHub旨在为开发者提供丰富的、高质量的、直接可用的预训练模型,**【无需深度学习背景、无需数据与训练过程】**也可快速使用AI模型。
- PaddleHub旨在为开发者提供丰富的、高质量的、直接可用的预训练模型,**【无需深度学习背景、无需数据与训练过程】**也可快速使用AI模型。
- 涵盖CV、NLP、Audio、Video主流四大品类,支持**一键预测****一键服务化部署****快速迁移学习**
- 全部模型开源下载,**离线可运行**

Expand All @@ -15,10 +15,10 @@
- **2020.09.27**,新增文本生成模型6个,图像分割模型1个,预训练模型总量到达 **【154】** 个。
- **2020.08.13**,发布v1.8.1,新增人像分割模型Humanseg,支持EMNLP2019-Sentence-BERT作为文本匹配任务网络,预训练模型总量到达 **【147】** 个。
- **2020.07.29**,发布v1.8.0,新增AI对联和AI写诗、jieba切词,文本数据LDA、语义相似度计算,新增目标检测,短视频分类模型,超轻量中英文OCR,新增行人检测、车辆检测、动物识别等工业级模型,支持VisualDL可视化训练,预训练模型总量到达 **【135】** 个。
- [More]()
- [More](./docs/release.md)


## 特性
## [特性](./docs/figures.md)
- **【丰富的预训练模型】**:涵盖CV、NLP、Audio、Video主流四大品类的 180+ 预训练模型,全部开源下载,离线可运行。
- **【一键模型快速预测】**:通过一行命令行或者极简的Python API实现模型调用,可快速体验模型效果。
- **【一键模型转服务化】**:一行命令,搭建深度学习模型API服务化部署能力。
Expand Down Expand Up @@ -60,27 +60,27 @@
- [在线运行体验demo【Official】](https://github.com/PaddlePaddle/PaddleHub/tree/release/v1.8/demo)
- [生态趣味项目demo【ThirdPary】](./docs/quick_experience/more_demos.md)
- 丰富的预训练模型 182 个
- [精品特色模型](./docs/pretrained_models.md)
- [精品特色模型](./docs/figure.md)
- 计算机视觉 126 个
- [图像分类 64 个](./modules/image/classification)
- [目标检测 13 个](./modules/image/object_detection)
- [人脸检测 7 个](./modules/image/face_detection)
- [关键点检测 3 个](./modules/image/keypoint_detection)
- [图像分割 7 个](./modules/image/semantic_segmentation)
- [文本识别 8 个](./modules/image/text_recognition)
- [图像生成 17 个](./modules/image/gan)
- [图像编辑 7 个](./modules/image/style_transfer)
- [图像分类 64 个](./modules/image/classification/README.md)
- [目标检测 13 个](./modules/image/object_detection/README.md)
- [人脸检测 7 个](./modules/image/face_detection/README.md)
- [关键点检测 3 个](./modules/image/keypoint_detection/README.md)
- [图像分割 7 个](./modules/image/semantic_segmentation/README.md)
- [文本识别 8 个](./modules/image/text_recognition/README.md)
- [图像生成 17 个](./modules/image/Image_gan/README.md)
- [图像编辑 7 个](./modules/image/Image_editing/README.md)
- 自然语言处理 48 个
- [词法分析 2 个](./modules/text/lexical_analysis)
- [句法分析 1 个](./modules/text/syntactic_analysis)
- [情感分析 7 个](./modules/text/semantic_model)
- [文本审核 3 个](./modules/text/text_review)
- [文本生成 9 个](./modules/text/text_generation)
- [语义模型 26 个](./modules/text/semantic_model)
- [词法分析 2 个](./modules/text/lexical_analysis/README.md)
- [句法分析 1 个](./modules/text/syntactic_analysis/README.md)
- [情感分析 7 个](./modules/text/sentiment_analysis/README.md)
- [文本审核 3 个](./modules/text/text_review/README.md)
- [文本生成 9 个](./modules/text/text_generation/README.md)
- [语义模型 26 个](./modules/text/language_model/README.md)
- 语音 3 个
- [语音合成 3 个](./modules/audio)
- [语音合成 3 个](./modules/audio/README.md)
- 视频5个
- [视频分类 5 个](./modules/video)
- [视频分类 5 个](./modules/video/README.md)
- 部署
- [一行代码服务化部署](./docs/tutorial/serving.md)
- C++ Inference 部署(建议加群沟通)
Expand Down
115 changes: 115 additions & 0 deletions docs/figures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
## 特性详解
<a name="丰富的预训练模型"></a>

### 1、丰富的预训练模型

- 1.1、图像

| | **精品模型举例** |
| ---------- | :----------------------------------------------------------- |
| 图像分类 | [菜品识别](https://www.paddlepaddle.org.cn/hubdetail?name=resnet50_vd_dishes&en_category=ImageClassification)[动物识别](https://www.paddlepaddle.org.cn/hubdetail?name=resnet50_vd_animals&en_category=ImageClassification)[动物识别](https://www.paddlepaddle.org.cn/hubdetail?name=resnet50_vd_animals&en_category=ImageClassification)[-->More](../modules/image/classification/README.md) |
| 目标检测 | [通用检测](https://www.paddlepaddle.org.cn/hubdetail?name=yolov3_darknet53_coco2017&en_category=ObjectDetection)[行人检测](https://www.paddlepaddle.org.cn/hubdetail?name=yolov3_darknet53_pedestrian&en_category=ObjectDetection)[车辆检测](https://www.paddlepaddle.org.cn/hubdetail?name=yolov3_darknet53_vehicles&en_category=ObjectDetection)[-->More](../modules/image/object_detection/README.md) |
| 人脸检测 | [人脸检测](https://www.paddlepaddle.org.cn/hubdetail?name=pyramidbox_lite_server&en_category=FaceDetection)[口罩检测](https://www.paddlepaddle.org.cn/hubdetail?name=pyramidbox_lite_server_mask&en_category=FaceDetection)[-->More](../modules/image/face_detection/README.md) |
| 图像分割 | [人像分割](https://www.paddlepaddle.org.cn/hubdetail?name=deeplabv3p_xception65_humanseg&en_category=ImageSegmentation)[人体解析](https://www.paddlepaddle.org.cn/hubdetail?name=ace2p&en_category=ImageSegmentation)[肺炎CT影像分析](https://www.paddlepaddle.org.cn/hubdetail?name=Pneumonia_CT_LKM_PP&en_category=ImageSegmentation)[-->More](../modules/image/semantic_segmentation/README.md) |
| 关键点检测 | [人体关键点](https://www.paddlepaddle.org.cn/hubdetail?name=human_pose_estimation_resnet50_mpii&en_category=KeyPointDetection)[人脸关键点](https://www.paddlepaddle.org.cn/hubdetail?name=face_landmark_localization&en_category=KeyPointDetection)[手部关键点](https://www.paddlepaddle.org.cn/hubdetail?name=hand_pose_localization&en_category=KeyPointDetection)[-->More](./modules/image/keypoint_detection/README.md) |
| 文本识别 | [超轻量中英文OCR文字识别](https://www.paddlepaddle.org.cn/hubdetail?name=chinese_ocr_db_crnn_mobile&en_category=TextRecognition)[-->More](../modules/image/text_recognition/README.md) |
| 图像生成 | [风格迁移](https://www.paddlepaddle.org.cn/hubdetail?name=stylepro_artistic&en_category=GANs)[街景动漫画]()[-->More](../modules/image/Image_gan/README.md) |
| 图像编辑 | [超分辨率](https://www.paddlepaddle.org.cn/hubdetail?name=realsr&en_category=ImageEditing)[黑白上色](https://www.paddlepaddle.org.cn/hubdetail?name=deoldify&en_category=ImageEditing)[-->More](../modules/image/Image_editing/README.md) |

- 1.2、文本
| | **精品模型举例** |
| ---------- | :----------------------------------------------------------- |
| 词句分析 | [词法分析 ](https://www.paddlepaddle.org.cn/hubdetail?name=lac&en_category=LexicalAnalysis)[句法分析](https://www.paddlepaddle.org.cn/hubdetail?name=ddparser&en_category=SyntacticAnalysis)[-->More](../modules/text/lexical_analysis/README.md) |
| 情感分析 | [情感判断](https://www.paddlepaddle.org.cn/hubdetail?name=lac&en_category=LexicalAnalysis)[情绪分析](https://www.paddlepaddle.org.cn/hubdetail?name=emotion_detection_textcnn&en_category=SentimentAnalysis)[-->More](../modules/text/sentiment_analysis/README.md)|
| 文本审核 | [色情审核](https://www.paddlepaddle.org.cn/hubdetail?name=porn_detection_gru&en_category=TextCensorship)[-->More](../modules/text/text_review/README.md) |
| 文本生成 | [对联生成]()[情话生成]()[藏图诗生成]()[土味情话]()[-->More](../modules/text/text_generation/README.md)|
| 语义模型 | [ERNIE](https://www.paddlepaddle.org.cn/hubdetail?name=ERNIE&en_category=SemanticModel)[文本相似度](https://www.paddlepaddle.org.cn/hubdetail?name=simnet_bow&en_category=SemanticModel)[-->More](../modules/text/language_model/README.md) |

- 1.3、语音
| | **精品模型举例** |
| ---------- | :----------------------------------------------------------- |
| 语音合成 | [语音合成]()[-->More](../modules/audio/README.md) |

- 1.4、视频
| | **精品模型举例** |
| ---------- | :----------------------------------------------------------- |
| 视频分类 | [视频分类]()[-->More](../modules/video/README.md) |

<a name="一键模型预测"></a>

### 2、一键模型预测


* 举例,假如考虑使用文字识别轻量级中文OCR模型chinese_ocr_db_crnn_mobile即可一键快速识别图片中的文字。
```shell
$ pip install paddlehub
$ wget https://paddlehub.bj.bcebos.com/model/image/ocr/test_ocr.jpg
$ hub run chinese_ocr_db_crnn_mobile --input_path test_ocr.jpg --visualization=True
```

* 预测结果图片保存在当前运行路径下ocr_result文件夹中,如下图所示。

<p align="center">
<img src="./imgs/ocr_res.jpg" width='70%' align="middle"
</p>

* 使用词法分析模型LAC进行分词
```shell
$ hub run lac --input_text "现在,慕尼黑再保险公司不仅是此类行动的倡议者,更是将其大量气候数据整合进保险产品中,并与公众共享大量天气信息,参与到新能源领域的保障中。"
[{
'word': ['现在', '', '慕尼黑再保险公司', '不仅', '', '此类', '行动', '', '倡议者', '', '更是', '', '', '大量', '气候', '数据', '整合', '', '保险', '产品', '', '', '', '', '公众', '共享', '大量', '天气', '信息', '', '参与', '', '新能源', '领域', '', '保障', '', ''],
'tag': ['TIME', 'w', 'ORG', 'c', 'v', 'r', 'n', 'u', 'n', 'w', 'd', 'p', 'r', 'a', 'n', 'n', 'v', 'v', 'n', 'n', 'f', 'w', 'c', 'p', 'n', 'v', 'a', 'n', 'n', 'w', 'v', 'v', 'n', 'n', 'u', 'vn', 'f', 'w']
}]
```

除了一行代码预测之外,PaddleHub也支持使用API调用模型的方式,可以参考每个模型的详细文档。

<a name="一键模型转服务"></a>

### 3、一键模型转服务

PaddleHub提供便捷的模型转服务的能力,只需简单一行命令即可完成模型的HTTP服务部署。通过以下命令即可快速启动LAC词法分析服务:

```shell
$ hub serving start -m chinese_ocr_db_crnn_mobile
```

更多关于模型服务化使用说明参见[PaddleHub模型一键服务化部署](./tutorial/serving.md)



<a name="十行代码迁移学习"></a>

### 4、十行代码迁移学习

通过Fine-tune API,只需要少量代码即可完成深度学习模型在计算机视觉场景下的迁移学习。

* [Demo示例](../demo)提供丰富的Fine-tune API的使用代码,包括[图像分类](../demo/image_classification)[图像着色](../demo/colorization)[风格迁移](../demo/style_transfer)、等场景的模型迁移示例。

<p align="center">
<img src="./imgs/paddlehub_finetune.gif" align="middle"
</p>

<p align='center'>
十行代码完成工业级文本分类
</p>

* 如需在线快速体验,请点击[PaddleHub教程合集](https://aistudio.baidu.com/aistudio/projectdetail/231146),可使用AI Studio平台提供的GPU算力进行快速尝试。



<a name="许可证书"></a>
## 许可证书
本项目的发布受<a href="./LICENSE">Apache 2.0 license</a>许可认证。

<a name="致谢"></a>
## 致谢
我们非常欢迎您为PaddleHub贡献代码,也十分感谢您的反馈。

* 非常感谢[Austendeng](https://github.com/Austendeng)贡献了修复SequenceLabelReader的pr
* 非常感谢[cclauss](https://github.com/cclauss)贡献了优化travis-ci检查的pr
* 非常感谢[奇想天外](http://www.cheerthink.com/)贡献了口罩检测的demo
* 非常感谢[mhlwsk](https://github.com/mhlwsk)贡献了修复序列标注预测demo的pr
* 非常感谢[zbp-xxxp](https://github.com/zbp-xxxp)贡献了看图作诗的module
* 非常感谢[zbp-xxxp](https://github.com/zbp-xxxp)[七年期限](https://github.com/1084667371)联合贡献了看图写诗中秋特别版module
* 非常感谢[livingbody](https://github.com/livingbody)贡献了基于PaddleHub能力的风格迁移和中秋看图写诗微信小程序
11 changes: 11 additions & 0 deletions modules/audio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## **更好用户体验,建议参考WEB端官方文档 -> [【语音合成】](https://www.paddlepaddle.org.cn/hubdetail)**

### 文字识别
语音合成(TTS)任务可以实现讲文字转化为语音,已经广泛应用于各种语音交互设备中。
- 推荐模型

| 模型名称 | 模型简介 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [语音合成transformer_tts_ljspeech](https://www.paddlepaddle.org.cn/hubdetail?name=transformer_tts_ljspeech&en_category=TextToSpeech) | TansformerTTS 对 Transformer 和 Tacotron2 进行了融合,取得了令人满意的效果,英文TTS模型,仅支持预测。 |
| [语音合成fastspeech_ljspeech](https://www.paddlepaddle.org.cn/hubdetail?name=fastspeech_ljspeech&en_category=TextToSpeech) | FastSpeech是基于encoder-decoder结构的teacher model中提取attention对角线来做发音持续时间预测,英文TTS模型,仅支持预测。 |
| [语音合成deepvoice3_ljspeech](https://www.paddlepaddle.org.cn/hubdetail?name=deepvoice3_ljspeech&en_category=TextToSpeech) | Deep Voice 3是百度研究院2017年发布的端到端的TTS模型(论文录用于ICLR 2018)。它是一个基于卷积神经网络和注意力机制的seq2seq模型,英文TTS模型,仅支持预测。|
15 changes: 15 additions & 0 deletions modules/image/Image_editing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## **更好用户体验,建议参考WEB端官方文档 -> [【图像编辑】](https://www.paddlepaddle.org.cn/hubdetail)**



### 图像编辑

图像编辑是指在输入图像的基础上,对图像的像素点进行进一步的编辑和调整,输出新的目标图像,具体的应用场景有:超分辨率、黑白片上色,老照片修复等。

- 精选推荐模型

| 模型名称 | 模型简介 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [超分辨率](https://www.paddlepaddle.org.cn/hubdetail?name=realsr&en_category=ImageEditing) | 可用于图像和视频超分模型,它能够将输入的图片和视频超分四倍。 |
| [黑白图像上色](https://www.paddlepaddle.org.cn/hubdetail?name=deoldify&en_category=ImageEditing) | deoldify是用于图像和视频的着色渲染模型,该模型能够实现给黑白照片和视频恢复原彩。 |
| [老照片修复](https://www.paddlepaddle.org.cn/hubdetail?name=photo_restoration&en_category=ImageEditing) | 针对老照片修复的模型。它主要由两个部分组成:着色和超分。|
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ def __call__(self, data_lab):
data['real_B_enc'] = paddle.to_tensor(data['real_B_enc'].astype(np.int64))
data['hint_B'] = paddle.to_tensor(data['hint_B'].astype(np.float32))
data['mask_B'] = paddle.to_tensor(data['mask_B'].astype(np.float32))
return data
return data
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class UserGuidedColorization(nn.Layer):
load_checkpoint (str): Pretrained checkpoint path.
"""

def __init__(self, use_tanh: bool = True, load_checkpoint: str = None):
super(UserGuidedColorization, self).__init__()
self.input_nc = 4
Expand Down Expand Up @@ -119,8 +118,8 @@ def __init__(self, use_tanh: bool = True, load_checkpoint: str = None):
)

# Conv8
model8up = (Conv2DTranspose(512, 256, kernel_size=4, stride=2, padding=1),)
model3short8 = (Conv2D(256, 256, 3, 1, 1),)
model8up = (Conv2DTranspose(512, 256, kernel_size=4, stride=2, padding=1), )
model3short8 = (Conv2D(256, 256, 3, 1, 1), )
model8 = (
nn.ReLU(),
Conv2D(256, 256, 3, 1, 1),
Expand All @@ -131,20 +130,26 @@ def __init__(self, use_tanh: bool = True, load_checkpoint: str = None):
)

# Conv9
model9up = (Conv2DTranspose(256, 128, kernel_size=4, stride=2, padding=1),)
model2short9 = (Conv2D(128, 128, 3, 1, 1,),)
model9up = (Conv2DTranspose(256, 128, kernel_size=4, stride=2, padding=1), )
model2short9 = (Conv2D(
128,
128,
3,
1,
1,
), )
model9 = (nn.ReLU(), Conv2D(128, 128, 3, 1, 1), nn.ReLU(), nn.BatchNorm(128))

# Conv10
model10up = (Conv2DTranspose(128, 128, kernel_size=4, stride=2, padding=1),)
model1short10 = (Conv2D(64, 128, 3, 1, 1),)
model10up = (Conv2DTranspose(128, 128, kernel_size=4, stride=2, padding=1), )
model1short10 = (Conv2D(64, 128, 3, 1, 1), )
model10 = (nn.ReLU(), Conv2D(128, 128, 3, 1, 1), nn.LeakyReLU(negative_slope=0.2))
model_class = (Conv2D(256, 529, 1),)
model_class = (Conv2D(256, 529, 1), )

if use_tanh:
model_out = (Conv2D(128, 2, 1, 1, 0, 1), nn.Tanh())
else:
model_out = (Conv2D(128, 2, 1, 1, 0, 1),)
model_out = (Conv2D(128, 2, 1, 1, 0, 1), )

self.model1 = nn.Sequential(*model1)
self.model2 = nn.Sequential(*model2)
Expand Down Expand Up @@ -178,10 +183,10 @@ def __init__(self, use_tanh: bool = True, load_checkpoint: str = None):
print("load pretrained checkpoint success")

def transforms(self, images: str) -> callable:

transform = T.Compose([T.Resize((256, 256), interpolation='NEAREST'), T.RGB2LAB()], to_rgb=True)
return transform(images)

def set_config(self, classification: bool = True, prob: float = 1., num_point: int = None):
self.classification = classification
self.pre_func = ColorizePreprocess(ab_thresh=0., p=prob, points=num_point)
Expand Down Expand Up @@ -221,4 +226,4 @@ def forward(self,
conv10_2 = self.model10(conv10_up)
out_reg = self.model_out(conv10_2)

return out_class, out_reg
return out_class, out_reg
Loading

0 comments on commit edbe41b

Please sign in to comment.