Преглед на файлове

Merge branch 'develop' into develop

yzl19940819 преди 4 години
родител
ревизия
1788166c40
променени са 7 файла, в които са добавени 101 реда и са изтрити 45 реда
  1. 27 16
      README.md
  2. 34 29
      README_cn.md
  3. BIN
      docs/gui/.DS_Store
  4. BIN
      docs/gui/images/paddlexoverview_en.jpg
  5. BIN
      docs/gui/images/paddlexoverview_en.png
  6. 1 0
      paddlex/__init__.py
  7. 39 0
      paddlex/cv/models/slim/post_quantization.py

+ 27 - 16
README.md

@@ -11,20 +11,23 @@
 
 <p align= "center"> PaddleX -- PaddlePaddle End-to-End Development Toolkit, 
   enables developers to implement real industry projects in a low-code form quickly </p>
+  
+[![License](https://img.shields.io/badge/license-Apache%202-red.svg)](LICENSE) [![Version](https://img.shields.io/github/release/PaddlePaddle/PaddleX.svg)](https://github.com/PaddlePaddle/PaddleX/releases) ![python version](https://img.shields.io/badge/python-3.6+-orange.svg) ![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
+ ![QQGroup](https://img.shields.io/badge/QQ_Group-1045148026-52B6EF?style=social&logo=tencent-qq&logoColor=000&logoWidth=20)
 
-[![License](https://img.shields.io/badge/license-Apache%202-red.svg)](LICENSE)[![Version](https://img.shields.io/github/release/PaddlePaddle/PaddleX.svg)](https://github.com/PaddlePaddle/PaddleX/releases)![python version](https://img.shields.io/badge/python-3.6+-orange.svg)![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
-![QQGroup](https://img.shields.io/badge/QQ_Group-1045148026-52B6EF?style=social&logo=tencent-qq&logoColor=000&logoWidth=20)
+:hugs:  PaddleX integrated the abilities of **Image classification**, **Object detection**, **Semantic segmentation**, and **Instance segmentation** in the Paddle CV toolkits, and get through the whole-process development from **Data preparation** and **Model training and optimization** to **Multi-end deployment**. At the same time, PaddleX provides **Succinct APIs** and a **Graphical Ueser Interface**. Developers can quickly complete the end-to-end process development of the Paddle in a form of **low-code**  without installing different libraries.
 
-[Complete PaddleX Online Documentation Contents](https://paddlex.readthedocs.io/zh_CN/develop_en/index.html)
+**:factory: PaddleX** has been validated in a dozen of industry application scenarios such as **Quality Inspection**, **Security**, **Patrol Inspection**, **Remote Sensing**, **Retail**,  **Medical** etc.. In addition, it **provides a wealth of case practice tutorials**, to help developer could apply to actual cases easily.
 
-It is integrated the abilities of **Image classification**, **Object detection**, **Semantic segmentation**, and **Instance segmentation** in the Paddle CV toolkits, and get through the whole-process development from **Data preparation** and **Model training and optimization** to **Multi-end deployment**. At the same time, PaddleX provides **Succinct APIs** and a **Graphical Ueser Interface**. Developers can quickly complete the end-to-end process development of the Paddle in a form of **low-code**  without installing different libraries.
 
-**PaddleX** has been validated in a dozen of industry application scenarios such as **Quality Inspection**, **Security**, **Patrol Inspection**, **Remote Sensing**, **Retail**,  **Medical** etc.. In addition, it **provides a wealth of case practice tutorials**, to help developer could apply to actual cases easily.
 
-![](./docs/gui/images/paddlexoverview_en.png)
+:heart: **You can go to [Complete PaddleX Online Documentation Contents](https://paddlex.readthedocs.io/zh_CN/develop_en/index.html) for complete tutorial with the format of *Read the Doc* and better reading experience​** :heart:
+
+
+
+![](./docs/gui/images/paddlexoverview_en.jpg)
+
 
-## Recent Contributors
-[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/0)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/0)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/1)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/1)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/2)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/2)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/3)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/3)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/4)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/4)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/5)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/5)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/6)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/6)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/7)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/7)
 
 ## Installation
 
@@ -70,7 +73,7 @@ It's a all-in-one client enable develops could implement deep learning projects
 
 ## Full Documentation and API Description
 
-- [Complete PaddleX online documentation contents](https://paddlex.readthedocs.io/zh_CN/develop/index.html)
+- [Complete PaddleX online documentation contents](https://paddlex.readthedocs.io/zh_CN/develop_en/):heart:
 
 - [10-Minute Quick Start Tutorial Series](https://paddlex.readthedocs.io/zh_CN/develop/quick_start.html)
 - [Collection of PaddleX Model Training Tutorials](https://paddlex.readthedocs.io/zh_CN/develop/train/index.html)
@@ -87,19 +90,27 @@ To get developers up to speed with the PaddleX API, we've created a complete ser
 
 
 
-## Full Process Industry Applications
+## Full Process Industry Applications:star:
 
 (continue to be updated)
 
 * Industrial inspections:
-  - [Industrial Meter Readings](https://paddlex.readthedocs.io/zh_CN/develop/examples/meter_reader.html)
-* Industrial quality control:
-  - Battery separator defect detection (Coming Soon)
-* [Portrait Segmentation](https://paddlex.readthedocs.io/zh_CN/develop/examples/human_segmentation.html)
+  - [Industrial Meter Readings](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/meter_reader.html)
+* [Industrial quality control](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/industrial_quality_inspection/README.html)
+* Satellite Image Understanding:
+  * [RGB Satellite Image Segmentation](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/remote_sensing.html)
+  * [Multi-Channel Satellite Image Segmentation](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/multi-channel_remote_sensing/README.html)
+  * [Land Parcel Change Detection](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/change_detection.html)
+* [Portrait Segmentation](https://paddlex.readthedocs.io/zh_CN/develop_en/examples/human_segmentation.html)
+* Multi-platform Deployment with Encryption
+  - [CPU/GPU (Encryption) deployment](https://paddlex.readthedocs.io/zh_CN/develop_en/deploy/server/index.html)
+  - [Deployment with OpenVINO toolkit](https://paddlex.readthedocs.io/zh_CN/develop_en/deploy/openvino/index.html)
+  - [Deploy on Nvidia Jetson](https://paddlex.readthedocs.io/zh_CN/develop_en/deploy/nvidia-jetson.html)
+  - [Deploy on Raspberry Pi](https://paddlex.readthedocs.io/zh_CN/develop_en/deploy/raspberry/index.html)
 
 
 
-## [FAQ](./docs/gui/faq.md)
+## :question:[FAQ](./docs/gui/faq.md):question:
 
 
 
@@ -123,6 +134,6 @@ To get developers up to speed with the PaddleX API, we've created a complete ser
 
 
 
-## Contribution
+## :hugs: Contribution :hugs:
 
 You are welcomed to contribute codes to PaddleX or provide suggestions. If you can fix an issue or add a new feature, please feel free to submit Pull Requests.

+ 34 - 29
README_cn.md

@@ -6,27 +6,24 @@
 <p align="center">
   <img src="./docs/gui/images/paddlex.png" width="360" height ="55" alt="PaddleX" align="middle" />
 </p>
+ <p align= "center"> PaddleX -- 飞桨全流程开发工具,以低代码的形式支持开发者快速实现产业实际项目落地 </p>
 
+[![License](https://img.shields.io/badge/license-Apache%202-red.svg)](LICENSE) [![Version](https://img.shields.io/github/release/PaddlePaddle/PaddleX.svg)](https://github.com/PaddlePaddle/PaddleX/releases) ![python version](https://img.shields.io/badge/python-3.6+-orange.svg) ![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
+ ![QQGroup](https://img.shields.io/badge/QQ_Group-1045148026-52B6EF?style=social&logo=tencent-qq&logoColor=000&logoWidth=20)
 
-<p align= "center"> PaddleX -- 飞桨全流程开发工具,以低代码的形式支持开发者快速实现产业实际项目落地 </p>
+:hugs: PaddleX 集成飞桨智能视觉领域**图像分类**、**目标检测**、**语义分割**、**实例分割**任务能力,将深度学习开发全流程从**数据准备**、**模型训练与优化**到**多端部署**端到端打通,并提供**统一任务API接口**及**图形化开发界面Demo**。开发者无需分别安装不同套件,以**低代码**的形式即可快速完成飞桨全流程开发。
 
-[![License](https://img.shields.io/badge/license-Apache%202-red.svg)](LICENSE)
-[![Version](https://img.shields.io/github/release/PaddlePaddle/PaddleX.svg)](https://github.com/PaddlePaddle/PaddleX/releases)
-![python version](https://img.shields.io/badge/python-3.6+-orange.svg)
-![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
-![QQGroup](https://img.shields.io/badge/QQ_Group-1045148026-52B6EF?style=social&logo=tencent-qq&logoColor=000&logoWidth=20)
+:factory: **PaddleX** 经过**质检**、**安防**、**巡检**、**遥感**、**零售**、**医疗**等十多个行业实际应用场景验证,沉淀产业实际经验,**并提供丰富的案例实践教程**,全程助力开发者产业实践落地。
 
-[完整PaddleX在线使用文档目录](https://paddlex.readthedocs.io/zh_CN/develop/index.html)
 
-集成飞桨智能视觉领域**图像分类**、**目标检测**、**语义分割**、**实例分割**任务能力,将深度学习开发全流程从**数据准备**、**模型训练与优化**到**多端部署**端到端打通,并提供**统一任务API接口**及**图形化开发界面Demo**。开发者无需分别安装不同套件,以**低代码**的形式即可快速完成飞桨全流程开发。
 
-**PaddleX** 经过**质检**、**安防**、**巡检**、**遥感**、**零售**、**医疗**等十多个行业实际应用场景验证,沉淀产业实际经验,**并提供丰富的案例实践教程**,全程助力开发者产业实践落地。
+:heart:**您可以前往  [完整PaddleX在线使用文档目录](https://paddlex.readthedocs.io/zh_CN/develop/index.html)  查看完整*Read the Doc* 格式的文档,获得更好的阅读体验**:heart:
+
+
 
 ![](./docs/gui/images/paddlexoverview.png)
 
-## 近期贡献者
 
-[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/0)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/0)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/1)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/1)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/2)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/2)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/3)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/3)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/4)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/4)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/5)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/5)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/6)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/6)[![](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/images/7)](https://sourcerer.io/fame/LaraStuStu/PaddlePaddle/Paddlex/links/7)
 
 ## 安装
 
@@ -75,7 +72,7 @@ pip install paddlex -i https://mirror.baidu.com/pypi/simple
 
 ## 完整使用文档及API说明
 
-- [完整PaddleX在线使用文档目录](https://paddlex.readthedocs.io/zh_CN/develop/index.html)
+- [完整PaddleX在线使用文档目录](https://paddlex.readthedocs.io/zh_CN/develop/index.html):heart:
 
 - [10分钟快速上手系列教程](https://paddlex.readthedocs.io/zh_CN/develop/quick_start.html)
 - [PaddleX模型训练教程集合](https://paddlex.readthedocs.io/zh_CN/develop/train/index.html)
@@ -90,30 +87,28 @@ pip install paddlex -i https://mirror.baidu.com/pypi/simple
 - [PaddleX快速上手——Faster-RCNN AI识虫](https://aistudio.baidu.com/aistudio/projectdetail/439888)
 - [PaddleX快速上手——DeepLabv3+ 视盘分割](https://aistudio.baidu.com/aistudio/projectdetail/440197)
 
-
-
-## 全流程产业应用案例
+## 全流程产业应用案例:star:
 
 (continue to be updated)
 
 * 工业巡检:
   * [工业表计读数](https://paddlex.readthedocs.io/zh_CN/develop/examples/meter_reader.html)
-
 * 工业质检:
   * [电池隔膜缺陷检测](https://paddlex.readthedocs.io/zh_CN/develop/examples/industrial_quality_inspection/README.html)
-
 * 卫星遥感: 
   * [RGB遥感影像分割](https://paddlex.readthedocs.io/zh_CN/develop/examples/remote_sensing.html)
   * [多通道遥感影像分割](https://paddlex.readthedocs.io/zh_CN/develop/examples/multi-channel_remote_sensing/README.html)
   * [地块变化检测](https://paddlex.readthedocs.io/zh_CN/develop/examples/multi-channel_remote_sensing/README.html)
-
 * [人像分割](https://paddlex.readthedocs.io/zh_CN/develop/examples/human_segmentation.html)
+* 模型多端安全部署
+  * [CPU/GPU(加密)部署](https://paddlex.readthedocs.io/zh_CN/develop/deploy/server/index.html)
+  * [OpenVINO加速部署](https://paddlex.readthedocs.io/zh_CN/develop/deploy/openvino/index.html)
+  * [Nvidia Jetson开发板部署](https://paddlex.readthedocs.io/zh_CN/develop/deploy/nvidia-jetson.html)
+  * [树莓派部署](https://paddlex.readthedocs.io/zh_CN/develop/deploy/raspberry/index.html)
 
+* [模型可解释性](https://paddlex.readthedocs.io/zh_CN/develop/appendix/interpret.html)
 
-
-## [FAQ](./docs/gui/faq.md)
-
-
+## :question:[FAQ](./docs/gui/faq.md):question:
 
 ## 交流与反馈
 
@@ -130,19 +125,29 @@ pip install paddlex -i https://mirror.baidu.com/pypi/simple
 ## 更新日志
 
 > [历史版本及更新内容](https://paddlex.readthedocs.io/zh_CN/develop/change_log.html)
-- 2020.09.05 v1.2.0
-- 2020.07.13 v1.1.0
-- 2020.07.12 v1.0.8
-- 2020.05.20 v1.0.0
-- 2020.05.17 v0.1.8
+- **2020.09.07 v1.2.0** 
+
+  新增产业最实用目标检测模型PP-YOLO,FasterRCNN、MaskRCNN、YOLOv3、DeepLabv3p等模型新增内置COCO数据集预训练模型,适用于小模型精调。新增多种Backbone,优化体积及预测速度。优化OpenVINO、PaddleLite Android、服务端C++预测部署方案,新增树莓派部署方案等。
+
+- **2020.07.12 v1.1.0** 
+
+  新增人像分割、工业标记读数案例。模型新增HRNet、FastSCNN、FasterRCNN,实例分割MaskRCNN新增Backbone HRNet。集成X2Paddle,PaddleX所有分类模型和语义分割模型支持导出为ONNX协议。新增模型加密Windows平台支持。新增Jetson、Paddle Lite模型部署预测方案。
+
+- **2020.05.20 v1.0.0** 
+
+  新增C++和Python部署,模型加密部署,分类模型OpenVINO部署。新增模型可解释性接口
+
+- **2020.05.17 v0.1.8** 
+
+  新增EasyData平台数据标注格式,支持imgaug数据增强库的pixel-level算子
 
 
 
-## 贡献代码
+## :hugs: 贡献代码:hugs:
 
 我们非常欢迎您为PaddleX贡献代码或者提供使用建议。如果您可以修复某个issue或者增加一个新功能,欢迎给我们提交Pull Requests。
 
-## 开发者贡献项目
+### 开发者贡献项目
 
 * [工业相机实时目标检测GUI](https://github.com/xmy0916/SoftwareofIndustrialCameraUsePaddle) 
 (windows系统,基于pyqt5开发)

BIN
docs/gui/.DS_Store


BIN
docs/gui/images/paddlexoverview_en.jpg


BIN
docs/gui/images/paddlexoverview_en.png


+ 1 - 0
paddlex/__init__.py

@@ -36,6 +36,7 @@ elif version[0] == '2':
     print(
         "[WARNING] You are using paddlepaddle(v{}) which may not compatible with paddlex(v{}), paddlepaddle==1.8.4 is strongly recommended.".
         format(paddle.__version__, __version__))
+if hasattr(paddle, 'enable_static'):
     paddle.enable_static()
 
 from .utils.utils import get_environ_info

+ 39 - 0
paddlex/cv/models/slim/post_quantization.py

@@ -24,6 +24,16 @@ import numpy as np
 import time
 
 
+def _load_variable_data(scope, var_name):
+    '''
+    Load variable value from scope
+    '''
+    var_node = scope.find_var(var_name)
+    assert var_node is not None, \
+        "Cannot find " + var_name + " in scope."
+    return np.array(var_node.get_tensor())
+
+
 class PaddleXPostTrainingQuantization(PostTrainingQuantization):
     def __init__(self,
                  executor,
@@ -284,3 +294,32 @@ class PaddleXPostTrainingQuantization(PostTrainingQuantization):
                         str(len(self._quantized_act_var_name)),
                         str(end - start)))
                 ct += 1
+
+    def _sample_data(self, iter):
+        '''
+        Sample the tensor data of quantized variables,
+        applied in every iteration.
+        '''
+        assert self._algo == "KL", "The algo should be KL to sample data."
+        for var_name in self._quantized_weight_var_name:
+            if var_name not in self._sampling_data:
+                var_tensor = _load_variable_data(self._scope, var_name)
+                self._sampling_data[var_name] = var_tensor
+
+        if self._is_use_cache_file:
+            for var_name in self._quantized_act_var_name:
+                var_tensor = _load_variable_data(self._scope, var_name)
+                var_tensor = var_tensor.ravel()
+                save_path = os.path.join(self._cache_dir,
+                                         var_name + "_" + str(iter) + ".npy")
+                save_dir, file_name = os.path.split(save_path)
+                if not os.path.exists(save_dir):
+                    os.mkdirs(save_dir)
+                np.save(save_path, var_tensor)
+        else:
+            for var_name in self._quantized_act_var_name:
+                if var_name not in self._sampling_data:
+                    self._sampling_data[var_name] = []
+                var_tensor = _load_variable_data(self._scope, var_name)
+                var_tensor = var_tensor.ravel()
+                self._sampling_data[var_name].append(var_tensor)