Skip to content

Commit

Permalink
[Doc] Add docs for ppocr ppseg examples (#1429)
Browse files Browse the repository at this point in the history
* add docs for examples

* add english doc

* fix

* fix docs
  • Loading branch information
rainyfly authored Feb 28, 2023
1 parent 010f12d commit c8bcada
Show file tree
Hide file tree
Showing 22 changed files with 2,983 additions and 5 deletions.
75 changes: 75 additions & 0 deletions docs/api/vision_results/ocr_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,78 @@ fastdeploy.vision.OCRResult
- **rec_scores**: Member variable which indicates the confidence level of the recognized text, where the element number is the same as `boxes.size()`.
- **cls_scores**: Member variable which indicates the confidence level of the classification result of the text box, where the element number is the same as `boxes.size()`.
- **cls_labels**: Member variable which indicates the directional category of the textbox, where the element number is the same as `boxes.size()`.


## C# Definition

`fastdeploy.vision.OCRResult`

```C#
public class OCRResult {
public List<int[]> boxes;
public List<string> text;
public List<float> rec_scores;
public List<float> cls_scores;
public List<int> cls_labels;
public ResultType type;
}
```

- **boxes**: Member variable which indicates the coordinates of all detected target boxes in a single image. `boxes.Count` indicates the number of detected boxes. Each box is represented by 8 int values to indicate the 4 coordinates of the box, in the order of lower left, lower right, upper right, upper left.
- **text**: Member variable which indicates the content of the recognized text in multiple text boxes, where the element number is the same as `boxes.Count`.
- **rec_scores**: Member variable which indicates the confidence level of the recognized text, where the element number is the same as `boxes.Count`.
- **cls_scores**: Member variable which indicates the confidence level of the classification result of the text box, where the element number is the same as `boxes.Count`.
- **cls_labels**: Member variable which indicates the directional category of the textbox, where the element number is the same as `boxes.Count`.

## C Definition

```c
struct FD_C_OCRResult {
FD_C_TwoDimArrayInt32 boxes;
FD_C_OneDimArrayCstr text;
FD_C_OneDimArrayFloat rec_scores;
FD_C_OneDimArrayFloat cls_scores;
FD_C_OneDimArrayInt32 cls_labels;
FD_C_ResultType type;
};
```

- **boxes**: Member variable which indicates the coordinates of all detected target boxes in a single image.

```c
typedef struct FD_C_TwoDimArrayInt32 {
size_t size;
FD_C_OneDimArrayInt32* data;
} FD_C_TwoDimArrayInt32;
```

```c
typedef struct FD_C_OneDimArrayInt32 {
size_t size;
int32_t* data;
} FD_C_OneDimArrayInt32;
```

- **text**: Member variable which indicates the content of the recognized text in multiple text boxes

```c
typedef struct FD_C_Cstr {
size_t size;
char* data;
} FD_C_Cstr;
typedef struct FD_C_OneDimArrayCstr {
size_t size;
FD_C_Cstr* data;
} FD_C_OneDimArrayCstr;
```

- **rec_scores**: Member variable which indicates the confidence level of the recognized text

```c
typedef struct FD_C_OneDimArrayFloat {
size_t size;
float* data;
} FD_C_OneDimArrayFloat;
```
- **cls_scores**: Member variable which indicates the confidence level of the classification result of the text box
- **cls_labels**: Member variable which indicates the directional category of the textbox
75 changes: 75 additions & 0 deletions docs/api/vision_results/ocr_result_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,78 @@ fastdeploy.vision.OCRResult
- **rec_scores**: 成员变量,表示文本框内识别出来的文本的置信度,其元素个数与`boxes.size()`一致
- **cls_scores**: 成员变量,表示文本框的分类结果的置信度,其元素个数与`boxes.size()`一致
- **cls_labels**: 成员变量,表示文本框的方向分类类别,其元素个数与`boxes.size()`一致

## C# 定义

`fastdeploy.vision.OCRResult`

```C#
public class OCRResult {
public List<int[]> boxes;
public List<string> text;
public List<float> rec_scores;
public List<float> cls_scores;
public List<int> cls_labels;
public ResultType type;
}
```

- **boxes**: 成员变量,表示单张图片检测出来的所有目标框坐标,`boxes.Count`表示单张图内检测出的框的个数,每个框以8个int数值依次表示框的4个坐标点,顺序为左下,右下,右上,左上
- **text**: 成员变量,表示多个文本框内被识别出来的文本内容,其元素个数与`boxes.Count`一致
- **rec_scores**: 成员变量,表示文本框内识别出来的文本的置信度,其元素个数与`boxes.Count`一致
- **cls_scores**: 成员变量,表示文本框的分类结果的置信度,其元素个数与`boxes.Count`一致
- **cls_labels**: 成员变量,表示文本框的方向分类类别,其元素个数与`boxes.Count`一致

## C定义

```c
struct FD_C_OCRResult {
FD_C_TwoDimArrayInt32 boxes;
FD_C_OneDimArrayCstr text;
FD_C_OneDimArrayFloat rec_scores;
FD_C_OneDimArrayFloat cls_scores;
FD_C_OneDimArrayInt32 cls_labels;
FD_C_ResultType type;
};
```

- **boxes**: 成员变量,表示单张图片检测出来的所有目标框坐标。

```c
typedef struct FD_C_TwoDimArrayInt32 {
size_t size;
FD_C_OneDimArrayInt32* data;
} FD_C_TwoDimArrayInt32;
```

```c
typedef struct FD_C_OneDimArrayInt32 {
size_t size;
int32_t* data;
} FD_C_OneDimArrayInt32;
```

- **text**: 成员变量,表示多个文本框内被识别出来的文本内容。

```c
typedef struct FD_C_Cstr {
size_t size;
char* data;
} FD_C_Cstr;

typedef struct FD_C_OneDimArrayCstr {
size_t size;
FD_C_Cstr* data;
} FD_C_OneDimArrayCstr;
```

- **rec_scores**: 成员变量,表示文本框内识别出来的文本的置信度。

```c
typedef struct FD_C_OneDimArrayFloat {
size_t size;
float* data;
} FD_C_OneDimArrayFloat;
```
- **cls_scores**: 成员变量,表示文本框的分类结果的置信度。
- **cls_labels**: 成员变量,表示文本框的方向分类类别。
60 changes: 60 additions & 0 deletions docs/api/vision_results/segmentation_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,63 @@ struct SegmentationResult {
- **label_map**(list of int): Member variable which indicates the segmentation category of each pixel in a single image.
- **score_map**(list of float): Member variable which indicates the predicted segmentation category probability value corresponding to the label_map one-to-one, the member variable is not empty only when `--output_op none` is specified when exporting the PaddleSeg model, otherwise the member variable is empty.
- **shape**(list of int): Member variable which indicates the shape of the output image as H\*W.
## C# Definition
`fastdeploy.vision.SegmentationResult`
```C#
public class SegmentationResult{
public List<byte> label_map;
public List<float> score_map;
public List<long> shape;
public bool contain_score_map;
public ResultType type;
}
```

- **label_map**(list of int): Member variable which indicates the segmentation category of each pixel in a single image.
- **score_map**(list of float): Member variable which indicates the predicted segmentation category probability value corresponding to the label_map one-to-one, the member variable is not empty only when `--output_op none` is specified when exporting the PaddleSeg model, otherwise the member variable is empty.
- **shape**(list of int): Member variable which indicates the shape of the output image as H\*W.



## C Definition

```c
struct FD_C_SegmentationResult {
FD_C_OneDimArrayUint8 label_map;
FD_C_OneDimArrayFloat score_map;
FD_C_OneDimArrayInt64 shape;
FD_C_Bool contain_score_map;
FD_C_ResultType type;
};
```

- **label_map**(FD_C_OneDimArrayUint8): Member variable which indicates the segmentation category of each pixel in a single image.

```c
struct FD_C_OneDimArrayUint8 {
size_t size;
uint8_t* data;
};
```

- **score_map**(FD_C_OneDimArrayFloat): Member variable which indicates the predicted segmentation category probability value corresponding to the label_map one-to-one, the member variable is not empty only when `--output_op none` is specified when exporting the PaddleSeg model, otherwise the member variable is empty.

```c
struct FD_C_OneDimArrayFloat {
size_t size;
float* data;
};
```

- **shape**(FD_C_OneDimArrayInt64): Member variable which indicates the shape of the output image as H\*W.

```c
struct FD_C_OneDimArrayInt64 {
size_t size;
int64_t* data;
};
```
58 changes: 58 additions & 0 deletions docs/api/vision_results/segmentation_result_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,61 @@ struct SegmentationResult {
- **label_map**(list of int): 成员变量,表示单张图片每个像素点的分割类别
- **score_map**(list of float): 成员变量,与label_map一一对应的所预测的分割类别概率值,只有导出PaddleSeg模型时指定`--output_op none`时,该成员变量才不为空,否则该成员变量为空
- **shape**(list of int): 成员变量,表示输出图片的shape,为H\*W
## C# 定义
`fastdeploy.vision.SegmentationResult`
```C#
public class SegmentationResult{
public List<byte> label_map;
public List<float> score_map;
public List<long> shape;
public bool contain_score_map;
public ResultType type;
}
```

- **label_map**(list of byte): 成员变量,表示单张图片每个像素点的分割类别
- **score_map**(list of float): 成员变量,与label_map一一对应的所预测的分割类别概率值,只有导出PaddleSeg模型时指定`--output_op none`时,该成员变量才不为空,否则该成员变量为空
- **shape**(list of long): 成员变量,表示输出图片的shape,为H\*W


## C定义

```c
struct FD_C_SegmentationResult {
FD_C_OneDimArrayUint8 label_map;
FD_C_OneDimArrayFloat score_map;
FD_C_OneDimArrayInt64 shape;
FD_C_Bool contain_score_map;
FD_C_ResultType type;
};
```

- **label_map**(FD_C_OneDimArrayUint8): 成员变量,表示单张图片每个像素点的分割类别

```c
struct FD_C_OneDimArrayUint8 {
size_t size;
uint8_t* data;
};
```

- **score_map**(FD_C_OneDimArrayFloat): 成员变量,与label_map一一对应的所预测的分割类别概率值,只有导出PaddleSeg模型时指定`--output_op none`时,该成员变量才不为空,否则该成员变量为空

```c
struct FD_C_OneDimArrayFloat {
size_t size;
float* data;
};
```

- **shape**(FD_C_OneDimArrayInt64): 成员变量,表示输出图片的shape,为H\*W

```c
struct FD_C_OneDimArrayInt64 {
size_t size;
int64_t* data;
};
```
4 changes: 2 additions & 2 deletions examples/vision/classification/paddleclas/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Then you can run your program and test the model with image
```shell
cd Release
# CPU inference
./infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 0
infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 0
# GPU inference
./infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 1
infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 1
```

## PaddleClas C# Interface
Expand Down
6 changes: 3 additions & 3 deletions examples/vision/classification/paddleclas/csharp/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- 1. 软硬件环境满足要求,参考[FastDeploy环境要求](../../../../../docs/cn/build_and_install/download_prebuilt_libraries.md)
- 2. 根据开发环境,下载预编译部署库和samples代码,参考[FastDeploy预编译库](../../../../../docs/cn/build_and_install/download_prebuilt_libraries.md)

以Linux上ResNet50_vd推理为例,在本目录执行如下命令即可完成编译测试,支持此模型需保证FastDeploy版本1.0.4以上(x.x.x>=1.0.4)
在本目录执行如下命令即可在Windows完成编译测试,支持此模型需保证FastDeploy版本1.0.4以上(x.x.x>=1.0.4)

## 1. 下载C#包管理程序nuget客户端
> https://dist.nuget.org/win-x86-commandline/v6.4.0/nuget.exe
Expand Down Expand Up @@ -50,9 +50,9 @@ fastdeploy_init.bat install %cd% D:\Download\fastdeploy-win-x64-gpu-x.x.x\exampl
```shell
cd Release
# CPU推理
./infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 0
infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 0
# GPU推理
./infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 1
infer_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 1
```

## PaddleClas C#接口
Expand Down
Loading

0 comments on commit c8bcada

Please sign in to comment.