!17244 dataset: repair bug in PILCUBIC resize

From: @ms_yan
Reviewed-by: @jonyguo,@liucunwei
Signed-off-by: @jonyguo
This commit is contained in:
mindspore-ci-bot 2021-05-29 09:58:36 +08:00 committed by Gitee
commit 22aa41fc33
3 changed files with 10 additions and 3 deletions

View File

@ -118,7 +118,9 @@ Status Resize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *out
uint8_t *buffer = reinterpret_cast<uint8_t *>(&(*output_tensor->begin<uint8_t>()));
imOut.Init(output_width, output_height, input_cv->shape()[2], reinterpret_cast<void *>(buffer), LDataType::UINT8);
imIn.Init(input_cv->shape()[1], input_cv->shape()[0], input_cv->shape()[2], input_cv->mat().data, LDataType::UINT8);
ResizeCubic(imIn, imOut, output_width, output_height);
if (ResizeCubic(imIn, imOut, output_width, output_height) == false) {
RETURN_STATUS_UNEXPECTED("Resize: failed to do resize, please check the error msg.");
}
*output = output_tensor;
return Status::OK();
}
@ -595,7 +597,9 @@ Status CropAndResize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tenso
imOut.Init(target_width, target_height, input_cv->shape()[2], reinterpret_cast<void *>(buffer), LDataType::UINT8);
imIn.Init(input_image->shape()[1], input_image->shape()[0], input_image->shape()[2], input_image->mat().data,
LDataType::UINT8);
ResizeCubic(imIn, imOut, target_width, target_height);
if (ResizeCubic(imIn, imOut, target_width, target_height) == false) {
RETURN_STATUS_UNEXPECTED("Resize: failed to do resize, please check the error msg.");
}
*output = output_tensor;
return Status::OK();
}

View File

@ -132,7 +132,7 @@ LiteMat::LiteMat(const LiteMat &m) {
dims_ = m.dims_;
data_type_ = m.data_type_;
ref_count_ = m.ref_count_;
size_ = 0;
size_ = m.size_;
setSteps(m.steps_[0], m.steps_[1], m.steps_[2]);
if (ref_count_) {
addRef(ref_count_, 1);

View File

@ -250,6 +250,9 @@ bool ImageInterpolation(LiteMat input, LiteMat &output, int x_size, int y_size,
return false;
}
}
if (!horizontal_interp && !vertical_interp) {
output = input;
}
return true;
}