!3399 Fixing Bug with AutoContrast/Equalize supporting uint8 dtype/mnist

Merge pull request !3399 from islam_amin/autocontrast_bug
This commit is contained in:
mindspore-ci-bot 2020-07-24 23:46:55 +08:00 committed by Gitee
commit 60feafd75e
2 changed files with 3 additions and 2 deletions

View File

@ -679,9 +679,10 @@ Status AutoContrast(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor
}
cv::Mat result;
cv::merge(image_result, result);
result.convertTo(result, input_cv->mat().type());
std::shared_ptr<CVTensor> output_cv = std::make_shared<CVTensor>(result);
if (input_cv->Rank() == 2) output_cv->Squeeze();
(*output) = std::static_pointer_cast<Tensor>(output_cv);
(*output)->Reshape(input->shape());
} catch (const cv::Exception &e) {
RETURN_STATUS_UNEXPECTED("Error in auto contrast");
}
@ -781,8 +782,8 @@ Status Equalize(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *o
cv::Mat result;
cv::merge(image_result, result);
std::shared_ptr<CVTensor> output_cv = std::make_shared<CVTensor>(result);
if (input_cv->Rank() == 2) output_cv->Squeeze();
(*output) = std::static_pointer_cast<Tensor>(output_cv);
(*output)->Reshape(input->shape());
} catch (const cv::Exception &e) {
RETURN_STATUS_UNEXPECTED("Error in equalize.");
}