Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Add Python comments for external models #408

Merged
merged 106 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
1684b05
first commit for yolov7
ziqi-jin Jul 13, 2022
71c00d9
pybind for yolov7
ziqi-jin Jul 14, 2022
21ab2f9
CPP README.md
ziqi-jin Jul 14, 2022
d63e862
CPP README.md
ziqi-jin Jul 14, 2022
7b3b0e2
modified yolov7.cc
ziqi-jin Jul 14, 2022
d039e80
README.md
ziqi-jin Jul 15, 2022
a34a815
python file modify
ziqi-jin Jul 18, 2022
eb010a8
merge test
ziqi-jin Jul 18, 2022
39f64f2
delete license in fastdeploy/
ziqi-jin Jul 18, 2022
d071b37
repush the conflict part
ziqi-jin Jul 18, 2022
d5026ca
README.md modified
ziqi-jin Jul 18, 2022
fb376ad
README.md modified
ziqi-jin Jul 18, 2022
4b8737c
file path modified
ziqi-jin Jul 18, 2022
ce922a0
file path modified
ziqi-jin Jul 18, 2022
6e00b82
file path modified
ziqi-jin Jul 18, 2022
8c359fb
file path modified
ziqi-jin Jul 18, 2022
906c730
file path modified
ziqi-jin Jul 18, 2022
80c1223
README modified
ziqi-jin Jul 18, 2022
6072757
README modified
ziqi-jin Jul 18, 2022
2c6e6a4
move some helpers to private
ziqi-jin Jul 18, 2022
48136f0
add examples for yolov7
ziqi-jin Jul 18, 2022
6feca92
api.md modified
ziqi-jin Jul 18, 2022
ae70d4f
api.md modified
ziqi-jin Jul 18, 2022
f591b85
api.md modified
ziqi-jin Jul 18, 2022
f0def41
YOLOv7
ziqi-jin Jul 18, 2022
15b9160
yolov7 release link
ziqi-jin Jul 18, 2022
4706e8c
yolov7 release link
ziqi-jin Jul 18, 2022
dc83584
yolov7 release link
ziqi-jin Jul 18, 2022
086debd
copyright
ziqi-jin Jul 18, 2022
4f980b9
change some helpers to private
ziqi-jin Jul 18, 2022
2e61c95
Merge branch 'develop' into develop
ziqi-jin Jul 19, 2022
80beadf
change variables to const and fix documents.
ziqi-jin Jul 19, 2022
8103772
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 19, 2022
f5f7a86
gitignore
ziqi-jin Jul 19, 2022
e6cec25
Transfer some funtions to private member of class
ziqi-jin Jul 19, 2022
e25e4f2
Transfer some funtions to private member of class
ziqi-jin Jul 19, 2022
e8a8439
Merge from develop (#9)
ziqi-jin Jul 20, 2022
a182893
first commit for yolor
ziqi-jin Jul 20, 2022
3aa015f
for merge
ziqi-jin Jul 20, 2022
d6b98aa
Develop (#11)
ziqi-jin Jul 20, 2022
871cfc6
Merge branch 'yolor' into develop
ziqi-jin Jul 20, 2022
013921a
Yolor (#16)
ziqi-jin Jul 21, 2022
7a5a6d9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 21, 2022
c996117
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 22, 2022
0aefe32
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 26, 2022
2330414
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 26, 2022
4660161
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 27, 2022
033c18e
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 28, 2022
6c94d65
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 28, 2022
85fb256
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Jul 29, 2022
90ca4cb
add is_dynamic for YOLO series (#22)
ziqi-jin Jul 29, 2022
f6a4ed2
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 1, 2022
3682091
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 3, 2022
ca1e110
Merge remote-tracking branch 'upstream/develop' into develop
ziqi-jin Aug 8, 2022
93ba6a6
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 9, 2022
767842e
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 10, 2022
cc32733
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 10, 2022
2771a3b
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 11, 2022
a1e29ac
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 11, 2022
5ecc6fe
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 11, 2022
2780588
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 12, 2022
c00be81
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 15, 2022
9082178
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 15, 2022
4b14f56
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 15, 2022
4876b82
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 16, 2022
9cebb1f
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 18, 2022
d1e3b29
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 19, 2022
69cf0d2
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 22, 2022
2ff10e1
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 23, 2022
a673a2c
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 25, 2022
832d777
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 25, 2022
e513eac
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Aug 29, 2022
ded2054
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 1, 2022
19db925
modify ppmatting backend and docs
ziqi-jin Sep 1, 2022
15be4a6
modify ppmatting docs
ziqi-jin Sep 1, 2022
3a5b93a
fix the PPMatting size problem
ziqi-jin Sep 3, 2022
f765853
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 3, 2022
c2332b0
fix LimitShort's log
ziqi-jin Sep 3, 2022
950f948
retrigger ci
ziqi-jin Sep 4, 2022
64a13c9
modify PPMatting docs
ziqi-jin Sep 4, 2022
09c073d
modify the way for dealing with LimitShort
ziqi-jin Sep 6, 2022
99969b6
Merge branch 'develop' into develop
jiangjiajun Sep 6, 2022
cf248de
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 8, 2022
9d4a4c9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 13, 2022
622fbf7
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 15, 2022
d1cf1ad
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 19, 2022
ff9a07e
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 21, 2022
2707b03
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Sep 22, 2022
896d1d9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 8, 2022
25ee7e2
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 12, 2022
79068d3
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 17, 2022
74b3ee0
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 21, 2022
a75c0c4
add python comments for external models
ziqi-jin Oct 21, 2022
985d273
modify resnet c++ comments
ziqi-jin Oct 21, 2022
e32a25c
modify C++ comments for external models
ziqi-jin Oct 21, 2022
8a73af6
modify python comments and add result class comments
ziqi-jin Oct 21, 2022
2aa7939
Merge branch 'develop' into doc_python
jiangjiajun Oct 22, 2022
887c53a
Merge branch 'develop' into doc_python
jiangjiajun Oct 23, 2022
963b9b9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 24, 2022
337e8c0
fix comments compile error
ziqi-jin Oct 24, 2022
d1d6890
modify result.h comments
ziqi-jin Oct 24, 2022
67234dd
Merge branch 'develop' into doc_python
jiangjiajun Oct 24, 2022
440e2a9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin Oct 24, 2022
ac35141
Merge branch 'doc_python' into develop
ziqi-jin Oct 24, 2022
1a8fb7f
Merge pull request #38 from ziqi-jin/develop
ziqi-jin Oct 24, 2022
a16b02f
modify yolor comments
ziqi-jin Oct 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/api_docs/python/face_detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Face Detection API

## fastdeploy.vision.facedet.RetinaFace

```{eval-rst}
.. autoclass:: fastdeploy.vision.facedet.RetinaFace
:members:
:inherited-members:
```


## fastdeploy.vision.facedet.SCRFD

```{eval-rst}
.. autoclass:: fastdeploy.vision.facedet.SCRFD
:members:
:inherited-members:
```

## fastdeploy.vision.facedet.UltraFace

```{eval-rst}
.. autoclass:: fastdeploy.vision.facedet.UltraFace
:members:
:inherited-members:
```

## fastdeploy.vision.facedet.YOLOv5Face

```{eval-rst}
.. autoclass:: fastdeploy.vision.facedet.YOLOv5Face
:members:
:inherited-members:
```
41 changes: 41 additions & 0 deletions docs/api_docs/python/face_recognition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Face Recognition API

## fastdeploy.vision.faceid.AdaFace

```{eval-rst}
.. autoclass:: fastdeploy.vision.faceid.AdaFace
:members:
:inherited-members:
```

## fastdeploy.vision.faceid.CosFace

```{eval-rst}
.. autoclass:: fastdeploy.vision.faceid.CosFace
:members:
:inherited-members:
```

## fastdeploy.vision.faceid.ArcFace

```{eval-rst}
.. autoclass:: fastdeploy.vision.faceid.ArcFace
:members:
:inherited-members:
```

## fastdeploy.vision.faceid.PartialFC

```{eval-rst}
.. autoclass:: fastdeploy.vision.faceid.PartialFC
:members:
:inherited-members:
```

## fastdeploy.vision.faceid.VPL

```{eval-rst}
.. autoclass:: fastdeploy.vision.faceid.VPL
:members:
:inherited-members:
```
2 changes: 2 additions & 0 deletions docs/api_docs/python/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ FastDeploy
image_classification.md
keypoint_detection.md
matting.md
face_recognition.md
face_detection.md
vision_results_en.md
16 changes: 15 additions & 1 deletion docs/api_docs/python/matting.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Matting API

comming soon...
## fastdeploy.vision.matting.MODNet

```{eval-rst}
.. autoclass:: fastdeploy.vision.matting.MODNet
:members:
:inherited-members:
```

## fastdeploy.vision.matting.PPMatting

```{eval-rst}
.. autoclass:: fastdeploy.vision.matting.PPMatting
:members:
:inherited-members:
```
90 changes: 90 additions & 0 deletions docs/api_docs/python/object_detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,93 @@
:members:
:inherited-members:
```

## fastdeploy.vision.detection.NanoDetPlus

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.NanoDetPlus
:members:
:inherited-members:
```

## fastdeploy.vision.detection.ScaledYOLOv4

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.ScaledYOLOv4
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOR

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOR
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOv5

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv5
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOv5Lite

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv5Lite
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOv6

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv6
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOv7

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv7
:members:
:inherited-members:
```


## fastdeploy.vision.detection.YOLOR

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOR
:members:
:inherited-members:
```


## fastdeploy.vision.detection.YOLOv7End2EndORT

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv7End2EndORT
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOv7End2EndTRT

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOv7End2EndTRT
:members:
:inherited-members:
```

## fastdeploy.vision.detection.YOLOX

```{eval-rst}
.. autoclass:: fastdeploy.vision.detection.YOLOX
:members:
:inherited-members:
```
13 changes: 7 additions & 6 deletions fastdeploy/vision/classification/contrib/resnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace vision {
*
*/
namespace classification {
/*! @brief ResNet series model
/*! @brief Torchvision ResNet series model
*/
class FASTDEPLOY_DECL ResNet : public FastDeployModel {
public:
Expand All @@ -44,17 +44,18 @@ class FASTDEPLOY_DECL ResNet : public FastDeployModel {
virtual std::string ModelName() const { return "ResNet"; }
/** \brief Predict for the input "im", the result will be saved in "result".
*
* \param[in] im Input image for inference.
* \param[in] im The input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
* \param[in] result Saving the inference result.
* \param[in] topk The length of return values, e.g., if topk==2, the result will include the 2 most possible class label for input image.
*/
virtual bool Predict(cv::Mat* im, ClassifyResult* result, int topk = 1);

/// Tuple of (width, height)
/*! @brief
Argument for image preprocessing step, tuple of (width, height), decide the target size after resize
*/
std::vector<int> size;
/// Mean parameters for normalize
/// Mean parameters for normalize, size should be the the same as channels
std::vector<float> mean_vals;
/// Std parameters for normalize
/// Std parameters for normalize, size should be the the same as channels
std::vector<float> std_vals;


Expand Down
69 changes: 49 additions & 20 deletions fastdeploy/vision/common/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,88 +154,117 @@ struct FASTDEPLOY_DECL OCRResult : public BaseResult {
std::string Str();
};

/*! @brief Face detection result structure for all the face detection models
*/
struct FASTDEPLOY_DECL FaceDetectionResult : public BaseResult {
// box: xmin, ymin, xmax, ymax
/** \brief All the detected object boxes for an input image, the size of `boxes` is the number of detected objects, and the element of `boxes` is a array of 4 float values, means [xmin, ymin, xmax, ymax]
*/
std::vector<std::array<float, 4>> boxes;
// landmark: x, y, landmarks may empty if the
// model don't detect face with landmarks.
// Note, one face might have multiple landmarks,
// such as 5/19/21/68/98/..., etc.
/** \brief
* If the model detect face with landmarks, every detected object box correspoing to a landmark, which is a array of 2 float values, means location [x,y]
*/
std::vector<std::array<float, 2>> landmarks;
/** \brief
* Indicates the confidence of all targets detected from a single image, and the number of elements is consistent with boxes.size()
*/
std::vector<float> scores;
ResultType type = ResultType::FACE_DETECTION;
// set landmarks_per_face manually in your post processes.
/** \brief
* `landmarks_per_face` indicates the number of face landmarks for each detected face
* if the model's output contains face landmarks (such as YOLOv5Face, SCRFD, ...)
*/
int landmarks_per_face;

FaceDetectionResult() { landmarks_per_face = 0; }
FaceDetectionResult(const FaceDetectionResult& res);

/// Clear detection result
void Clear();

void Reserve(int size);

void Resize(int size);

/// Debug function, convert the result to string to print
std::string Str();
};

/*! @brief Segmentation result structure for all the segmentation models
*/
struct FASTDEPLOY_DECL SegmentationResult : public BaseResult {
// mask
/** \brief
* `label_map` stores the pixel-level category labels for input image. the number of pixels is equal to label_map.size()
*/
std::vector<uint8_t> label_map;
/** \brief
* `score_map` stores the probability of the predicted label for each pixel of input image.
*/
std::vector<float> score_map;
/// The output shape, means [H, W]
std::vector<int64_t> shape;
bool contain_score_map = false;

ResultType type = ResultType::SEGMENTATION;

/// Clear detection result
void Clear();

void Reserve(int size);

void Resize(int size);

/// Debug function, convert the result to string to print
std::string Str();
};

/*! @brief Face recognition result structure for all the Face recognition models
*/
struct FASTDEPLOY_DECL FaceRecognitionResult : public BaseResult {
// face embedding vector with 128/256/512 ... dim
/** \brief The feature embedding that represents the final extraction of the face recognition model can be used to calculate the feature similarity between faces.
*/
std::vector<float> embedding;

ResultType type = ResultType::FACE_RECOGNITION;

FaceRecognitionResult() {}
FaceRecognitionResult(const FaceRecognitionResult& res);

/// Clear detection result
void Clear();

void Reserve(int size);

void Resize(int size);

/// Debug function, convert the result to string to print
std::string Str();
};

/*! @brief Matting result structure for all the Matting models
*/
struct FASTDEPLOY_DECL MattingResult : public BaseResult {
// alpha matte and fgr (predicted foreground: HWC/BGR float32)
/** \brief
`alpha` is a one-dimensional vector, which is the predicted alpha transparency value. The range of values is [0., 1.], and the length is hxw. h, w are the height and width of the input image
*/
std::vector<float> alpha; // h x w
/** \brief
If the model can predict foreground, `foreground` save the predicted foreground image, the shape is [hight,width,channel] generally.
*/
std::vector<float> foreground; // h x w x c (c=3 default)
// height, width, channel for foreground and alpha
// must be (h,w,c) and setup before Reserve and Resize
// c is only for foreground if contain_foreground is true.
/** \brief
* The shape of output result, when contain_foreground == false, shape only contains (h, w), when contain_foreground == true, shape contains (h, w, c), and c is generally 3
*/
std::vector<int64_t> shape;
/** \brief
If the model can predict alpha matte and foreground, contain_foreground = true, default false
*/
bool contain_foreground = false;

ResultType type = ResultType::MATTING;

MattingResult() {}
MattingResult(const MattingResult& res);

/// Clear detection result
void Clear();

void Reserve(int size);

void Resize(int size);

/// Debug function, convert the result to string to print
std::string Str();
};

Expand Down
Loading