|
|
@@ -46,13 +46,13 @@
|
|
|
|
|
|
#### 测试表计读数
|
|
|
|
|
|
-1. 下载PaddleX源码:
|
|
|
+step 1. 下载PaddleX源码:
|
|
|
|
|
|
```
|
|
|
git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
```
|
|
|
|
|
|
-2. 预测执行文件位于`PaddleX/examples/meter_reader/`,进入该目录:
|
|
|
+step 2. 预测执行文件位于`PaddleX/examples/meter_reader/`,进入该目录:
|
|
|
|
|
|
```
|
|
|
cd PaddleX/examples/meter_reader/
|
|
|
@@ -76,7 +76,7 @@ cd PaddleX/examples/meter_reader/
|
|
|
| use_erode | 是否使用图像腐蚀对分割预测图进行细分,默认为False |
|
|
|
| erode_kernel | 图像腐蚀操作时的卷积核大小,默认值为4 |
|
|
|
|
|
|
-3. 预测
|
|
|
+step 3. 预测
|
|
|
|
|
|
若要使用GPU,则指定GPU卡号(以0号卡为例):
|
|
|
|
|
|
@@ -112,17 +112,17 @@ python3 reader_infer.py --detector_dir /path/to/det_inference_model --segmenter_
|
|
|
|
|
|
#### c++部署
|
|
|
|
|
|
-1. 下载PaddleX源码:
|
|
|
+step 1. 下载PaddleX源码:
|
|
|
|
|
|
```
|
|
|
git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
```
|
|
|
|
|
|
-2. 将`PaddleX\examples\meter_reader\deploy\cpp`下的`meter_reader`文件夹和`CMakeList.txt`拷贝至`PaddleX\deploy\cpp`目录下,拷贝之前可以将`PaddleX\deploy\cpp`下原本的`CMakeList.txt`做好备份。
|
|
|
+step 2. 将`PaddleX\examples\meter_reader\deploy\cpp`下的`meter_reader`文件夹和`CMakeList.txt`拷贝至`PaddleX\deploy\cpp`目录下,拷贝之前可以将`PaddleX\deploy\cpp`下原本的`CMakeList.txt`做好备份。
|
|
|
|
|
|
-3. 按照[Windows平台部署](../deploy/server/cpp/windows.md)中的Step2至Step4完成C++预测代码的编译。
|
|
|
+step 3. 按照[Windows平台部署](../deploy/server/cpp/windows.md)中的Step2至Step4完成C++预测代码的编译。
|
|
|
|
|
|
-4. 编译成功后,可执行文件在`out\build\x64-Release`目录下,打开`cmd`,并切换到该目录:
|
|
|
+step 4. 编译成功后,可执行文件在`out\build\x64-Release`目录下,打开`cmd`,并切换到该目录:
|
|
|
|
|
|
```
|
|
|
cd PaddleX\deploy\cpp\out\build\x64-Release
|
|
|
@@ -139,8 +139,6 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
| use_gpu | 是否使用 GPU 预测, 支持值为0或1(默认值为0)|
|
|
|
| gpu_id | GPU 设备ID, 默认值为0 |
|
|
|
| save_dir | 保存可视化结果的路径, 默认值为"output"|
|
|
|
- | det_key | 检测模型加密过程中产生的密钥信息,默认值为""表示加载的是未加密的检测模型 |
|
|
|
- | seg_key | 分割模型加密过程中产生的密钥信息,默认值为""表示加载的是未加密的分割模型 |
|
|
|
| seg_batch_size | 分割的批量大小,默认为2 |
|
|
|
| thread_num | 分割预测的线程数,默认为cpu处理器个数 |
|
|
|
| use_camera | 是否使用摄像头采集图片,支持值为0或1(默认值为0) |
|
|
|
@@ -149,7 +147,7 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
| erode_kernel | 图像腐蚀操作时的卷积核大小,默认值为4 |
|
|
|
| score_threshold | 检测模型输出结果中,预测得分低于该阈值的框将被滤除,默认值为0.5|
|
|
|
|
|
|
-5. 推理预测:
|
|
|
+step 5. 推理预测:
|
|
|
|
|
|
用于部署推理的模型应为inference格式,本案例提供的预训练模型均为inference格式,如若是重新训练的模型,需参考[部署模型导出](../deploy/export_model.md)将模型导出为inference格式。
|
|
|
|
|
|
@@ -160,6 +158,13 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
```
|
|
|
|
|
|
* 使用未加密的模型对图像列表做预测
|
|
|
+ 图像列表image_list.txt内容的格式如下,因绝对路径不同,暂未提供该文件,用户可根据实际情况自行生成:
|
|
|
+ ```
|
|
|
+ \path\to\images\1.jpg
|
|
|
+ \path\to\images\2.jpg
|
|
|
+ ...
|
|
|
+ \path\to\images\n.jpg
|
|
|
+ ```
|
|
|
|
|
|
```shell
|
|
|
.\paddlex_inference\meter_reader.exe --det_model_dir=\path\to\det_inference_model --seg_model_dir=\path\to\seg_inference_model --image_list=\path\to\meter_test\image_list.txt --use_gpu=1 --use_erode=1 --save_dir=output
|
|
|
@@ -171,29 +176,21 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
.\paddlex_inference\meter_reader.exe --det_model_dir=\path\to\det_inference_model --seg_model_dir=\path\to\seg_inference_model --use_camera=1 --use_gpu=1 --use_erode=1 --save_dir=output
|
|
|
```
|
|
|
|
|
|
- * 使用加密后的模型对单张图片做预测
|
|
|
-
|
|
|
- 如果未对模型进行加密,请参考[加密PaddleX模型](../deploy/server/encryption.html#paddlex)对模型进行加密。例如加密后的检测模型所在目录为`\path\to\encrypted_det_inference_model`,密钥为`yEBLDiBOdlj+5EsNNrABhfDuQGkdcreYcHcncqwdbx0=`;加密后的分割模型所在目录为`\path\to\encrypted_seg_inference_model`,密钥为`DbVS64I9pFRo5XmQ8MNV2kSGsfEr4FKA6OH9OUhRrsY=`
|
|
|
-
|
|
|
- ```shell
|
|
|
- .\paddlex_inference\meter_reader.exe --det_model_dir=\path\to\encrypted_det_inference_model --seg_model_dir=\path\to\encrypted_seg_inference_model --image=\path\to\test.jpg --use_gpu=1 --use_erode=1 --save_dir=output --det_key yEBLDiBOdlj+5EsNNrABhfDuQGkdcreYcHcncqwdbx0= --seg_key DbVS64I9pFRo5XmQ8MNV2kSGsfEr4FKA6OH9OUhRrsY=
|
|
|
- ```
|
|
|
-
|
|
|
### Linux系统的jetson嵌入式设备安全部署
|
|
|
|
|
|
#### c++部署
|
|
|
|
|
|
-1. 下载PaddleX源码:
|
|
|
+step 1. 下载PaddleX源码:
|
|
|
|
|
|
```
|
|
|
git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
```
|
|
|
|
|
|
-2. 将`PaddleX/examples/meter_reader/deploy/cpp`下的`meter_reader`文件夹和`CMakeList.txt`拷贝至`PaddleX/deploy/cpp`目录下,拷贝之前可以将`PaddleX/deploy/cpp`下原本的`CMakeList.txt`做好备份。
|
|
|
+step 2. 将`PaddleX/examples/meter_reader/deploy/cpp`下的`meter_reader`文件夹和`CMakeList.txt`拷贝至`PaddleX/deploy/cpp`目录下,拷贝之前可以将`PaddleX/deploy/cpp`下原本的`CMakeList.txt`做好备份。
|
|
|
|
|
|
-3. 按照[Nvidia Jetson开发板部署](../deploy/nvidia-jetson.md)中的Step2至Step3完成C++预测代码的编译。
|
|
|
+step 3. 按照[Nvidia Jetson开发板部署](../deploy/nvidia-jetson.md)中的Step2至Step3完成C++预测代码的编译。
|
|
|
|
|
|
-4. 编译成功后,可执行程为`build/meter_reader/meter_reader`,其主要命令参数说明如下:
|
|
|
+step 4. 编译成功后,可执行程为`build/meter_reader/meter_reader`,其主要命令参数说明如下:
|
|
|
|
|
|
| 参数 | 说明 |
|
|
|
| ---- | ---- |
|
|
|
@@ -204,8 +201,6 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
| use_gpu | 是否使用 GPU 预测, 支持值为0或1(默认值为0)|
|
|
|
| gpu_id | GPU 设备ID, 默认值为0 |
|
|
|
| save_dir | 保存可视化结果的路径, 默认值为"output"|
|
|
|
- | det_key | 检测模型加密过程中产生的密钥信息,默认值为""表示加载的是未加密的检测模型 |
|
|
|
- | seg_key | 分割模型加密过程中产生的密钥信息,默认值为""表示加载的是未加密的分割模型 |
|
|
|
| seg_batch_size | 分割的批量大小,默认为2 |
|
|
|
| thread_num | 分割预测的线程数,默认为cpu处理器个数 |
|
|
|
| use_camera | 是否使用摄像头采集图片,支持值为0或1(默认值为0) |
|
|
|
@@ -214,7 +209,7 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
| erode_kernel | 图像腐蚀操作时的卷积核大小,默认值为4 |
|
|
|
| score_threshold | 检测模型输出结果中,预测得分低于该阈值的框将被滤除,默认值为0.5|
|
|
|
|
|
|
-5. 推理预测:
|
|
|
+step 5. 推理预测:
|
|
|
|
|
|
用于部署推理的模型应为inference格式,本案例提供的预训练模型均为inference格式,如若是重新训练的模型,需参考[部署模型导出](../deploy/export_model.md)将模型导出为inference格式。
|
|
|
|
|
|
@@ -225,7 +220,13 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
```
|
|
|
|
|
|
* 使用未加密的模型对图像列表做预测
|
|
|
-
|
|
|
+ 图像列表image_list.txt内容的格式如下,因绝对路径不同,暂未提供该文件,用户可根据实际情况自行生成:
|
|
|
+ ```
|
|
|
+ \path\to\images\1.jpg
|
|
|
+ \path\to\images\2.jpg
|
|
|
+ ...
|
|
|
+ \path\to\images\n.jpg
|
|
|
+ ```
|
|
|
```shell
|
|
|
./build/meter_reader/meter_reader --det_model_dir=/path/to/det_inference_model --seg_model_dir=/path/to/seg_inference_model --image_list=/path/to/image_list.txt --use_gpu=1 --use_erode=1 --save_dir=output
|
|
|
```
|
|
|
@@ -236,14 +237,6 @@ git clone https://github.com/PaddlePaddle/PaddleX
|
|
|
./build/meter_reader/meter_reader --det_model_dir=/path/to/det_inference_model --seg_model_dir=/path/to/seg_inference_model --use_camera=1 --use_gpu=1 --use_erode=1 --save_dir=output
|
|
|
```
|
|
|
|
|
|
- * 使用加密后的模型对单张图片做预测
|
|
|
-
|
|
|
- 如果未对模型进行加密,请参考[加密PaddleX模型](../deploy/server/encryption.html#paddlex)对模型进行加密。例如加密后的检测模型所在目录为`/path/to/encrypted_det_inference_model`,密钥为`yEBLDiBOdlj+5EsNNrABhfDuQGkdcreYcHcncqwdbx0=`;加密后的分割模型所在目录为`/path/to/encrypted_seg_inference_model`,密钥为`DbVS64I9pFRo5XmQ8MNV2kSGsfEr4FKA6OH9OUhRrsY=`
|
|
|
-
|
|
|
- ```shell
|
|
|
- ./build/meter_reader/meter_reader --det_model_dir=/path/to/encrypted_det_inference_model --seg_model_dir=/path/to/encrypted_seg_inference_model --image=/path/to/test.jpg --use_gpu=1 --use_erode=1 --save_dir=output --det_key yEBLDiBOdlj+5EsNNrABhfDuQGkdcreYcHcncqwdbx0= --seg_key DbVS64I9pFRo5XmQ8MNV2kSGsfEr4FKA6OH9OUhRrsY=
|
|
|
- ```
|
|
|
-
|
|
|
|
|
|
## 模型训练
|
|
|
|