[Model] Refactor PaddleClas module (#505)

* Refactor the PaddleClas module

* fix bug

* remove debug code

* clean unused code

* support pybind

* Update fd_tensor.h

* Update fd_tensor.cc

* temporary revert python api

* fix ci error

* fix code style problem
This commit is contained in:
Jason
2022-11-07 19:33:47 +08:00
committed by GitHub
parent a0a8ace174
commit 3589c0fa94
15 changed files with 527 additions and 142 deletions

View File

@@ -51,7 +51,7 @@ bool ResizeByShort::ImplByFlyCV(Mat* mat) {
} else if (interp_ == 2) {
interp_method = fcv::InterpolationType::INTER_CUBIC;
} else {
FDERROR << "LimitLong: Only support interp_ be 0/1/2 with FlyCV, but "
FDERROR << "LimitByShort: Only support interp_ be 0/1/2 with FlyCV, but "
"now it's "
<< interp_ << "." << std::endl;
return false;

View File

@@ -35,6 +35,14 @@ std::string ClassifyResult::Str() {
return out;
}
ClassifyResult& ClassifyResult::operator=(ClassifyResult&& other) {
if (&other != this) {
label_ids = std::move(other.label_ids);
scores = std::move(other.scores);
}
return *this;
}
void Mask::Reserve(int size) { data.reserve(size); }
void Mask::Resize(int size) { data.resize(size); }

View File

@@ -44,6 +44,7 @@ struct FASTDEPLOY_DECL BaseResult {
/*! @brief Classify result structure for all the image classify models
*/
struct FASTDEPLOY_DECL ClassifyResult : public BaseResult {
ClassifyResult() = default;
/// Classify result for an image
std::vector<int32_t> label_ids;
/// The confidence for each classify result
@@ -53,6 +54,11 @@ struct FASTDEPLOY_DECL ClassifyResult : public BaseResult {
/// Clear result
void Clear();
/// Copy constructor
ClassifyResult(const ClassifyResult& other) = default;
/// Move assignment
ClassifyResult& operator=(ClassifyResult&& other);
/// Debug function, convert the result to string to print
std::string Str();
};