-
Notifications
You must be signed in to change notification settings - Fork 475
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 PP-ModNet and PP-HumanMatting Support #240
Conversation
int origin_w = im->cols; | ||
int origin_h = im->rows; | ||
im->convertTo(*im, CV_32FC(im->channels())); | ||
int im_size_max = std::min(origin_w, origin_h); |
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.
这里的逻辑和CpuRun不一致,这里用了std::min()
, 是不是用错了?
|
||
static bool Run(Mat* mat, int max_long = -1, int min_long = -1, | ||
ProcLib lib = ProcLib::OPENCV_CPU); | ||
int GetMaxLong() { return max_long_; } |
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.
如果这个函数不修改max_long_
的话,可以用const限制,这样某些const LimitLong的情形也可以用
int GetMaxLong() const { return max_long_; }
|
||
class ResizeByInputShape : public Processor { | ||
public: | ||
ResizeByInputShape(int width, int height, int interp = 1) { |
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.
这些新加的processor可否在头文件中添加简单的文档说明具体的用处,以便于模型开发进行复用。可以参考convert.h或者normalize.h
@ziqi-jin 另外比较建议参考ppdet的方式,modnet, humanmatting,hrnet等模型可以继承ppmatting再进行一层简单的封装,这样既方便用户可以通过类名直接调用到关心的模型,也可以在后续的维护中只单独修改某个模型的逻辑 |
namespace fastdeploy { | ||
namespace vision { | ||
|
||
bool ResizeByInputShape::CpuRun(Mat* mat) { |
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.
LimitSize
@@ -25,6 +25,9 @@ class ResizeToIntMult : public Processor { | |||
mult_int_ = mult_int; | |||
interp_ = interp; | |||
} | |||
|
|||
// Resize Mat* mat to make the size divisible by mult_int_. |
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.
LimitByStride
namespace fastdeploy { | ||
namespace vision { | ||
|
||
class ResizeByInputShape : public Processor { |
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.
LimitBySize
Merge develop to ppmodnet
Refine ppmatting code
FDASSERT(axis >= 0 && axis < ndim, | ||
"The allowed 'axis' must be in range of (0, %lu)!", ndim); | ||
shape.erase(shape.begin() + axis); | ||
} |
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.
此处需判断这一维必须为1,才能squeeze
PR types
PR changes
Describe
add PP-HumanMatting\ ModNet-MobileNetV2\ ModNet-ResNet50_vd\ ModNet-HRNet_w18
add the process of input_shape for PPMatting
add LimitLong function