-
Notifications
You must be signed in to change notification settings - Fork 457
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
Add PPMatting Support #163
Merged
Merged
Changes from 83 commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
1684b05
first commit for yolov7
ziqi-jin 71c00d9
pybind for yolov7
ziqi-jin 21ab2f9
CPP README.md
ziqi-jin d63e862
CPP README.md
ziqi-jin 7b3b0e2
modified yolov7.cc
ziqi-jin d039e80
README.md
ziqi-jin a34a815
python file modify
ziqi-jin eb010a8
merge test
ziqi-jin 39f64f2
delete license in fastdeploy/
ziqi-jin d071b37
repush the conflict part
ziqi-jin d5026ca
README.md modified
ziqi-jin fb376ad
README.md modified
ziqi-jin 4b8737c
file path modified
ziqi-jin ce922a0
file path modified
ziqi-jin 6e00b82
file path modified
ziqi-jin 8c359fb
file path modified
ziqi-jin 906c730
file path modified
ziqi-jin 80c1223
README modified
ziqi-jin 6072757
README modified
ziqi-jin 2c6e6a4
move some helpers to private
ziqi-jin 48136f0
add examples for yolov7
ziqi-jin 6feca92
api.md modified
ziqi-jin ae70d4f
api.md modified
ziqi-jin f591b85
api.md modified
ziqi-jin f0def41
YOLOv7
ziqi-jin 15b9160
yolov7 release link
ziqi-jin 4706e8c
yolov7 release link
ziqi-jin dc83584
yolov7 release link
ziqi-jin 086debd
copyright
ziqi-jin 4f980b9
change some helpers to private
ziqi-jin 2e61c95
Merge branch 'develop' into develop
ziqi-jin 80beadf
change variables to const and fix documents.
ziqi-jin 8103772
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin f5f7a86
gitignore
ziqi-jin e6cec25
Transfer some funtions to private member of class
ziqi-jin e25e4f2
Transfer some funtions to private member of class
ziqi-jin e8a8439
Merge from develop (#9)
ziqi-jin a182893
first commit for yolor
ziqi-jin 3aa015f
for merge
ziqi-jin d6b98aa
Develop (#11)
ziqi-jin 871cfc6
Merge branch 'yolor' into develop
ziqi-jin 013921a
Yolor (#16)
ziqi-jin 7a5a6d9
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin c996117
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 0aefe32
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 2330414
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 4660161
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 033c18e
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 6c94d65
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 85fb256
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 90ca4cb
add is_dynamic for YOLO series (#22)
ziqi-jin f6a4ed2
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 3682091
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin ca1e110
Merge remote-tracking branch 'upstream/develop' into develop
ziqi-jin 93ba6a6
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 767842e
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin cc32733
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 2771a3b
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin a1e29ac
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 5ecc6fe
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 2780588
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin c00be81
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 9082178
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 4b14f56
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 4876b82
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 9cebb1f
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin d1e3b29
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 69cf0d2
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 2349b71
ppmat
ziqi-jin 2ff10e1
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 48f5444
first commit for ppmatting
ziqi-jin 0428ce9
keep VisMattingAlpha with background funtion
ziqi-jin a673a2c
Merge branch 'PaddlePaddle:develop' into develop
ziqi-jin 8da74bb
Merge branch 'ppmatv2' into develop
ziqi-jin 126974b
Merge pull request #34 from ziqi-jin/develop
ziqi-jin 78d729f
support ppmatting and swapbackground function
ziqi-jin 0310e29
modify docs error
ziqi-jin 5fd6be5
add photos for docs
ziqi-jin f14c0cb
add photos for docs
ziqi-jin 8890171
add photos for docs
ziqi-jin 5b0ba19
modify docs
ziqi-jin cd8ebc2
modify docs
ziqi-jin 25730f4
modify docs
ziqi-jin 17fc6c9
change remove_small_connected_area function, modify docs
ziqi-jin 11550e6
Merge branch 'develop' into ppmatv2
ziqi-jin 0b3552d
fix compile error
ziqi-jin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision/common/processors/limit_short.h" | ||
|
||
namespace fastdeploy { | ||
namespace vision { | ||
|
||
bool LimitShort::CpuRun(Mat* mat) { | ||
cv::Mat* im = mat->GetCpuMat(); | ||
int origin_w = im->cols; | ||
int origin_h = im->rows; | ||
int im_size_min = std::min(origin_w, origin_h); | ||
int target = im_size_min; | ||
if (max_short_ > 0 && im_size_min > max_short_) { | ||
target = max_short_; | ||
} else if (min_short_ > 0 && im_size_min < min_short_) { | ||
target = min_short_; | ||
} | ||
if (target != im_size_min) { | ||
double scale = | ||
static_cast<double>(target) / static_cast<double>(im_size_min); | ||
cv::resize(*im, *im, cv::Size(), scale, scale, interp_); | ||
mat->SetWidth(im->cols); | ||
mat->SetHeight(im->rows); | ||
} | ||
return true; | ||
} | ||
|
||
#ifdef ENABLE_OPENCV_CUDA | ||
bool LimitShort::GpuRun(Mat* mat) { | ||
cv::cuda::GpuMat* im = mat->GetGpuMat(); | ||
int origin_w = im->cols; | ||
int origin_h = im->rows; | ||
im->convertTo(*im, CV_32FC(im->channels())); | ||
int im_size_min = std::min(origin_w, origin_h); | ||
int target = im_size_min; | ||
if (max_short_ > 0 && im_size_min > max_short_) { | ||
target = max_short_; | ||
} else if (min_short_ > 0 && im_size_min < min_short_) { | ||
target = min_short_; | ||
} | ||
if (target != im_size_min) { | ||
double scale = | ||
static_cast<double>(target) / static_cast<double>(im_size_min); | ||
cv::cuda::resize(*im, *im, cv::Size(), scale, scale, interp_); | ||
mat->SetWidth(im->cols); | ||
mat->SetHeight(im->rows); | ||
} | ||
return true; | ||
} | ||
#endif | ||
|
||
bool LimitShort::Run(Mat* mat, int max_short, int min_short, ProcLib lib) { | ||
auto r = LimitShort(max_short, min_short); | ||
return r(mat, lib); | ||
} | ||
} // namespace vision | ||
} // namespace fastdeploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "fastdeploy/vision/common/processors/base.h" | ||
|
||
namespace fastdeploy { | ||
namespace vision { | ||
|
||
class LimitShort : public Processor { | ||
public: | ||
explicit LimitShort(int max_short = -1, int min_short = -1, int interp = 1) { | ||
max_short_ = max_short; | ||
min_short_ = min_short; | ||
interp_ = interp; | ||
} | ||
bool CpuRun(Mat* mat); | ||
#ifdef ENABLE_OPENCV_CUDA | ||
bool GpuRun(Mat* mat); | ||
#endif | ||
std::string Name() { return "LimitShort"; } | ||
|
||
static bool Run(Mat* mat, int max_short = -1, int min_short = -1, | ||
ProcLib lib = ProcLib::OPENCV_CPU); | ||
|
||
private: | ||
int max_short_; | ||
int min_short_; | ||
int interp_; | ||
}; | ||
} // namespace vision | ||
} // namespace fastdeploy |
56 changes: 56 additions & 0 deletions
56
csrc/fastdeploy/vision/common/processors/resize_to_int_mult.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision/common/processors/resize_to_int_mult.h" | ||
|
||
namespace fastdeploy { | ||
namespace vision { | ||
|
||
bool ResizeToIntMult::CpuRun(Mat* mat) { | ||
cv::Mat* im = mat->GetCpuMat(); | ||
int origin_w = im->cols; | ||
int origin_h = im->rows; | ||
int rw = origin_w - origin_w % mult_int_; | ||
int rh = origin_h - origin_h % mult_int_; | ||
if (rw != origin_w || rh != origin_w) { | ||
cv::resize(*im, *im, cv::Size(rw, rh), 0, 0, interp_); | ||
mat->SetWidth(im->cols); | ||
mat->SetHeight(im->rows); | ||
} | ||
return true; | ||
} | ||
|
||
#ifdef ENABLE_OPENCV_CUDA | ||
bool ResizeToIntMult::GpuRun(Mat* mat) { | ||
cv::cuda::GpuMat* im = mat->GetGpuMat(); | ||
int origin_w = im->cols; | ||
int origin_h = im->rows; | ||
im->convertTo(*im, CV_32FC(im->channels())); | ||
int rw = origin_w - origin_w % mult_int_; | ||
int rh = origin_h - origin_h % mult_int_; | ||
if (rw != origin_w || rh != origin_w) { | ||
cv::cuda::resize(*im, *im, cv::Size(rw, rh), 0, 0, interp_); | ||
mat->SetWidth(im->cols); | ||
mat->SetHeight(im->rows); | ||
} | ||
return true; | ||
} | ||
#endif | ||
|
||
bool ResizeToIntMult::Run(Mat* mat, int mult_int, int interp, ProcLib lib) { | ||
auto r = ResizeToIntMult(mult_int, interp); | ||
return r(mat, lib); | ||
} | ||
} // namespace vision | ||
} // namespace fastdeploy |
42 changes: 42 additions & 0 deletions
42
csrc/fastdeploy/vision/common/processors/resize_to_int_mult.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include "fastdeploy/vision/common/processors/base.h" | ||
|
||
namespace fastdeploy { | ||
namespace vision { | ||
|
||
class ResizeToIntMult : public Processor { | ||
public: | ||
explicit ResizeToIntMult(int mult_int = 32, int interp = 1) { | ||
mult_int_ = mult_int; | ||
interp_ = interp; | ||
} | ||
bool CpuRun(Mat* mat); | ||
#ifdef ENABLE_OPENCV_CUDA | ||
bool GpuRun(Mat* mat); | ||
#endif | ||
std::string Name() { return "ResizeToIntMult"; } | ||
|
||
static bool Run(Mat* mat, int mult_int = 32, int interp = 1, | ||
ProcLib lib = ProcLib::OPENCV_CPU); | ||
|
||
private: | ||
int interp_; | ||
int mult_int_; | ||
}; | ||
} // namespace vision | ||
} // namespace fastdeploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个缩写是不是改成 l 更合理?像normalize是n,convert是c,等等