diff --git a/README_CN.md b/README_CN.md index 662e63cb0..e8c97f5bc 100644 --- a/README_CN.md +++ b/README_CN.md @@ -21,10 +21,10 @@ | Potrait Segmentation | Image Matting | Semantic Segmentation | Real-Time Matting | |:---------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | | | | | -| **OCR** | **Behavior Recognition** | **Object Detection** |**Pose Estimation** -| | | | | -| **Face Alignment** | **3D Object Detection** | **Face Editing** | **Image Animation** -| | | | +| **OCR** | **Behavior Recognition** | **Object Detection** |**Pose Estimation** +| | | | | +| **Face Alignment** | **3D Object Detection** | **Face Editing** | **Image Animation** +| | | | ## 近期更新 @@ -139,10 +139,11 @@ int main(int argc, char* argv[]) { auto im = cv::imread("000000014439.jpg"); vision::DetectionResult res; - model.Predict(&im, &res) + model.Predict(&im, &res); auto vis_im = vision::Visualize::VisDetection(im, res, 0.5); cv::imwrite("vis_image.jpg", vis_im); + return 0; } ``` diff --git a/README_EN.md b/README_EN.md index 4b6de076a..3c853d766 100644 --- a/README_EN.md +++ b/README_EN.md @@ -100,12 +100,12 @@ wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/0000000 ``` * Test inference results - + ```python # For deployment of GPU/TensorRT, please refer to examples/vision/detection/paddledetection/python import cv2 import fastdeploy.vision as vision - + model = vision.detection.PPYOLOE("ppyoloe_crn_l_300e_coco/model.pdmodel", "ppyoloe_crn_l_300e_coco/model.pdiparams", @@ -148,16 +148,17 @@ int main(int argc, char* argv[]) { auto im = cv::imread("000000014439.jpg"); vision::DetectionResult res; - model.Predict(&im, &res) + model.Predict(&im, &res); auto vis_im = vision::Visualize::VisDetection(im, res, 0.5); cv::imwrite("vis_image.jpg", vis_im); + return 0; } ``` ### For more deployment models, please refer to [Vision Model Deployment Examples](examples/vision) . - + ### Supported Server-Side Model List🔥🔥🔥 diff --git a/fastdeploy/vision/common/processors/color_space_convert.cc b/fastdeploy/vision/common/processors/color_space_convert.cc index bcdaf365a..40a23872f 100644 --- a/fastdeploy/vision/common/processors/color_space_convert.cc +++ b/fastdeploy/vision/common/processors/color_space_convert.cc @@ -18,7 +18,9 @@ namespace fastdeploy { namespace vision { bool BGR2RGB::CpuRun(Mat* mat) { cv::Mat* im = mat->GetCpuMat(); - cv::cvtColor(*im, *im, cv::COLOR_BGR2RGB); + cv::Mat new_im; + cv::cvtColor(*im, new_im, cv::COLOR_BGR2RGB); + mat->SetMat(new_im); return true; } @@ -32,7 +34,9 @@ bool BGR2RGB::GpuRun(Mat* mat) { bool RGB2BGR::CpuRun(Mat* mat) { cv::Mat* im = mat->GetCpuMat(); - cv::cvtColor(*im, *im, cv::COLOR_RGB2BGR); + cv::Mat new_im; + cv::cvtColor(*im, new_im, cv::COLOR_RGB2BGR); + mat->SetMat(new_im); return true; } @@ -43,7 +47,6 @@ bool RGB2BGR::GpuRun(Mat* mat) { return true; } #endif - bool BGR2RGB::Run(Mat* mat, ProcLib lib) { auto b = BGR2RGB(); return b(mat, lib); @@ -54,5 +57,5 @@ bool RGB2BGR::Run(Mat* mat, ProcLib lib) { return r(mat, lib); } -} // namespace vision -} // namespace fastdeploy +} // namespace vision +} // namespace fastdeploy diff --git a/fastdeploy/vision/common/processors/mat.h b/fastdeploy/vision/common/processors/mat.h index 14acfd3df..8d83d322a 100644 --- a/fastdeploy/vision/common/processors/mat.h +++ b/fastdeploy/vision/common/processors/mat.h @@ -36,6 +36,7 @@ struct FASTDEPLOY_DECL Mat { width = cpu_mat.cols; channels = cpu_mat.channels(); } + void SetMat(const cv::Mat& mat) { cpu_mat = mat; } private: int channels;