Browse Source

change size

tags/v0.6.0-beta
panfengfeng 5 years ago
parent
commit
5aad4bdfbf
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      mindspore/ccsrc/minddata/dataset/kernels/image/center_crop_op.cc
  2. +1
    -1
      tests/ut/python/dataset/test_center_crop.py

+ 2
- 2
mindspore/ccsrc/minddata/dataset/kernels/image/center_crop_op.cc View File

@@ -37,8 +37,8 @@ Status CenterCropOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_p
int32_t left = crop_wid_ - input->shape()[1];
std::shared_ptr<Tensor> pad_image;

CHECK_FAIL_RETURN_UNEXPECTED((top < input->shape()[0] * 10 && left < input->shape()[1] * 10),
"CenterCropOp padding size is too big, it's more than 10 times the original size.");
CHECK_FAIL_RETURN_UNEXPECTED((top < input->shape()[0] * 3 && left < input->shape()[1] * 3),
"CenterCropOp padding size is too big, it's more than 3 times the original size.");

if (top > 0 && left > 0) { // padding only
return Pad(input, output, top / 2 + top % 2, top / 2, left / 2 + left % 2, left / 2, BorderType::kConstant);


+ 1
- 1
tests/ut/python/dataset/test_center_crop.py View File

@@ -145,7 +145,7 @@ def test_center_crop_errors():
try:
test_center_crop_op(16777216, 16777216)
except RuntimeError as e:
assert "Unexpected error. CenterCropOp padding size is too big, it's more than 10 times the original size." in \
assert "Unexpected error. CenterCropOp padding size is too big, it's more than 3 times the original size." in \
str(e)




Loading…
Cancel
Save