Skip to content

Commit

Permalink
[Model] Refactor PaddleDetection module (PaddlePaddle#575)
Browse files Browse the repository at this point in the history
* Add namespace for functions

* Refactor PaddleDetection module

* finish all the single image test

* Update preprocessor.cc

* fix some litte detail

* add python api

* Update postprocessor.cc
  • Loading branch information
jiangjiajun authored Nov 15, 2022
1 parent aa21272 commit beaa0fd
Show file tree
Hide file tree
Showing 39 changed files with 1,278 additions and 1,434 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ def build_option(args):
vis_im = fd.vision.vis_detection(im, result, score_threshold=0.5)
cv2.imwrite("visualized_result.jpg", vis_im)
print("Visualized result save in ./visualized_result.jpg")
print(runtime_option)
2 changes: 1 addition & 1 deletion fastdeploy/pipeline/pptinypose/pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace fastdeploy {
namespace pipeline {
PPTinyPose::PPTinyPose(
fastdeploy::vision::detection::PPYOLOE* det_model,
fastdeploy::vision::detection::PicoDet* det_model,
fastdeploy::vision::keypointdetection::PPTinyPose* pptinypose_model)
: detector_(det_model), pptinypose_model_(pptinypose_model) {}

Expand Down
4 changes: 2 additions & 2 deletions fastdeploy/pipeline/pptinypose/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FASTDEPLOY_DECL PPTinyPose {
* \param[in] pptinypose_model Initialized pptinypose model object
*/
PPTinyPose(
fastdeploy::vision::detection::PPYOLOE* det_model,
fastdeploy::vision::detection::PicoDet* det_model,
fastdeploy::vision::keypointdetection::PPTinyPose* pptinypose_model);

/** \brief Predict the keypoint detection result for an input image
Expand All @@ -52,7 +52,7 @@ class FASTDEPLOY_DECL PPTinyPose {
float detection_model_score_threshold = 0;

protected:
fastdeploy::vision::detection::PPYOLOE* detector_ = nullptr;
fastdeploy::vision::detection::PicoDet* detector_ = nullptr;
fastdeploy::vision::keypointdetection::PPTinyPose* pptinypose_model_ =
nullptr;

Expand Down
23 changes: 0 additions & 23 deletions fastdeploy/pipeline/pptinypose/pptinyposepipeline_pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,8 @@ namespace fastdeploy {
void BindPPTinyPosePipeline(pybind11::module& m) {
pybind11::class_<pipeline::PPTinyPose>(m, "PPTinyPose")

// explicitly pybind more kinds of detection models here
.def(pybind11::init<fastdeploy::vision::detection::PPYOLOE*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::PicoDet*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::PPYOLO*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::PPYOLOv2*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::PaddleYOLOX*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::FasterRCNN*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::YOLOv3*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def(pybind11::init<fastdeploy::vision::detection::MaskRCNN*,
fastdeploy::vision::keypointdetection::PPTinyPose*>())

.def("predict", [](pipeline::PPTinyPose& self,
pybind11::array& data) {
auto mat = PyArrayToCvMat(data);
Expand Down
1 change: 0 additions & 1 deletion fastdeploy/vision.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "fastdeploy/vision/detection/contrib/yolov7end2end_trt.h"
#include "fastdeploy/vision/detection/contrib/yolox.h"
#include "fastdeploy/vision/detection/ppdet/model.h"
#include "fastdeploy/vision/detection/contrib/rknpu2/model.h"
#include "fastdeploy/vision/facedet/contrib/retinaface.h"
#include "fastdeploy/vision/facedet/contrib/scrfd.h"
#include "fastdeploy/vision/facedet/contrib/ultraface.h"
Expand Down
16 changes: 0 additions & 16 deletions fastdeploy/vision/detection/contrib/rknpu2/model.h

This file was deleted.

29 changes: 0 additions & 29 deletions fastdeploy/vision/detection/contrib/rknpu2/rkdet_pybind.cc

This file was deleted.

201 changes: 0 additions & 201 deletions fastdeploy/vision/detection/contrib/rknpu2/rkpicodet.cc

This file was deleted.

46 changes: 0 additions & 46 deletions fastdeploy/vision/detection/contrib/rknpu2/rkpicodet.h

This file was deleted.

3 changes: 0 additions & 3 deletions fastdeploy/vision/detection/detection_pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ void BindNanoDetPlus(pybind11::module& m);
void BindPPDet(pybind11::module& m);
void BindYOLOv7End2EndTRT(pybind11::module& m);
void BindYOLOv7End2EndORT(pybind11::module& m);
void BindRKDet(pybind11::module& m);


void BindDetection(pybind11::module& m) {
auto detection_module =
Expand All @@ -44,6 +42,5 @@ void BindDetection(pybind11::module& m) {
BindNanoDetPlus(detection_module);
BindYOLOv7End2EndTRT(detection_module);
BindYOLOv7End2EndORT(detection_module);
BindRKDet(detection_module);
}
} // namespace fastdeploy
Loading

0 comments on commit beaa0fd

Please sign in to comment.