From: @xulei2020 Reviewed-by: Signed-off-by:pull/13906/MERGE
| @@ -355,6 +355,10 @@ static void Remap(const LiteMat &src, LiteMat &dst, LiteMat &map1, const LiteMat | |||||
| bool WarpAffineBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT | bool WarpAffineBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT | ||||
| PaddBorderType borderType, std::vector<uint8_t> &borderValue) { // NOLINT | PaddBorderType borderType, std::vector<uint8_t> &borderValue) { // NOLINT | ||||
| if (dst_w <= 0 || dst_h <= 0) { | |||||
| return false; | |||||
| } | |||||
| if (!(M.height_ == 2 && M.width_ == 3)) { | if (!(M.height_ == 2 && M.width_ == 3)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -471,6 +475,9 @@ static void PerspectiveInvert(double *src, double *dst) { | |||||
| bool WarpPerspectiveBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT | bool WarpPerspectiveBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT | ||||
| PaddBorderType borderType, std::vector<uint8_t> &borderValue) { // NOLINT | PaddBorderType borderType, std::vector<uint8_t> &borderValue) { // NOLINT | ||||
| if (dst_w <= 0 || dst_h <= 0) { | |||||
| return false; | |||||
| } | |||||
| if (!(M.height_ == 3 && M.width_ == 3)) { | if (!(M.height_ == 3 && M.width_ == 3)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -60,7 +60,7 @@ def check_one_hot_op(method): | |||||
| @wraps(method) | @wraps(method) | ||||
| def new_method(self, *args, **kwargs): | def new_method(self, *args, **kwargs): | ||||
| [num_classes, smoothing_rate], _ = parse_user_args(method, *args, **kwargs) | [num_classes, smoothing_rate], _ = parse_user_args(method, *args, **kwargs) | ||||
| type_check(smoothing_rate, (int, float), "smoothing_rate") | |||||
| type_check(num_classes, (int,), "num_classes") | type_check(num_classes, (int,), "num_classes") | ||||
| check_positive(num_classes) | check_positive(num_classes) | ||||
| @@ -44,6 +44,8 @@ def check_cut_mix_batch_c(method): | |||||
| def new_method(self, *args, **kwargs): | def new_method(self, *args, **kwargs): | ||||
| [image_batch_format, alpha, prob], _ = parse_user_args(method, *args, **kwargs) | [image_batch_format, alpha, prob], _ = parse_user_args(method, *args, **kwargs) | ||||
| type_check(image_batch_format, (ImageBatchFormat,), "image_batch_format") | type_check(image_batch_format, (ImageBatchFormat,), "image_batch_format") | ||||
| type_check(alpha, (int, float), "alpha") | |||||
| type_check(prob, (int, float), "prob") | |||||
| check_pos_float32(alpha) | check_pos_float32(alpha) | ||||
| check_positive(alpha, "alpha") | check_positive(alpha, "alpha") | ||||
| check_value(prob, [0, 1], "prob") | check_value(prob, [0, 1], "prob") | ||||
| @@ -70,6 +72,7 @@ def check_mix_up_batch_c(method): | |||||
| @wraps(method) | @wraps(method) | ||||
| def new_method(self, *args, **kwargs): | def new_method(self, *args, **kwargs): | ||||
| [alpha], _ = parse_user_args(method, *args, **kwargs) | [alpha], _ = parse_user_args(method, *args, **kwargs) | ||||
| type_check(alpha, (int, float), "alpha") | |||||
| check_positive(alpha, "alpha") | check_positive(alpha, "alpha") | ||||
| check_pos_float32(alpha) | check_pos_float32(alpha) | ||||
| @@ -463,11 +466,11 @@ def check_mix_up(method): | |||||
| @wraps(method) | @wraps(method) | ||||
| def new_method(self, *args, **kwargs): | def new_method(self, *args, **kwargs): | ||||
| [batch_size, alpha, is_single], _ = parse_user_args(method, *args, **kwargs) | [batch_size, alpha, is_single], _ = parse_user_args(method, *args, **kwargs) | ||||
| type_check(is_single, (bool,), "is_single") | |||||
| type_check(batch_size, (int,), "batch_size") | |||||
| type_check(alpha, (int, float), "alpha") | |||||
| check_value(batch_size, (1, FLOAT_MAX_INTEGER)) | check_value(batch_size, (1, FLOAT_MAX_INTEGER)) | ||||
| check_positive(alpha, "alpha") | check_positive(alpha, "alpha") | ||||
| type_check(is_single, (bool,), "is_single") | |||||
| return method(self, *args, **kwargs) | return method(self, *args, **kwargs) | ||||
| return new_method | return new_method | ||||
| @@ -1,3 +1,4 @@ | |||||
| ### Introduce of data | ### Introduce of data | ||||
| All of data used in this folder created by Huawei Technologies Co. | All of data used in this folder created by Huawei Technologies Co. | ||||
| @@ -1,7 +1,9 @@ | |||||
| ## DE Dataset Ops Test (Python) | ## DE Dataset Ops Test (Python) | ||||
| #### Environment | |||||
| ### Environment | |||||
| Python3.7 (PyCharm IDE is recommended) | Python3.7 (PyCharm IDE is recommended) | ||||
| ### Introduce of data | ### Introduce of data | ||||
| All of data used in this folder created by Huawei Technologies Co. | All of data used in this folder created by Huawei Technologies Co. | ||||