mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-08 10:00:29 +08:00
[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:
@@ -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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user