You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ir_vision_test.cc 18 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. /**
  2. * Copyright 2021 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <memory>
  17. #include <string>
  18. #include "common/common.h"
  19. #include "minddata/dataset/kernels/ir/vision/affine_ir.h"
  20. #include "minddata/dataset/kernels/ir/vision/auto_contrast_ir.h"
  21. #include "minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.h"
  22. #include "minddata/dataset/kernels/ir/vision/center_crop_ir.h"
  23. #include "minddata/dataset/kernels/ir/vision/crop_ir.h"
  24. #include "minddata/dataset/kernels/ir/vision/cutmix_batch_ir.h"
  25. #include "minddata/dataset/kernels/ir/vision/cutout_ir.h"
  26. #include "minddata/dataset/kernels/ir/vision/decode_ir.h"
  27. #include "minddata/dataset/kernels/ir/vision/equalize_ir.h"
  28. #include "minddata/dataset/kernels/ir/vision/hwc_to_chw_ir.h"
  29. #include "minddata/dataset/kernels/ir/vision/invert_ir.h"
  30. #include "minddata/dataset/kernels/ir/vision/mixup_batch_ir.h"
  31. #include "minddata/dataset/kernels/ir/vision/normalize_ir.h"
  32. #include "minddata/dataset/kernels/ir/vision/normalize_pad_ir.h"
  33. #include "minddata/dataset/kernels/ir/vision/pad_ir.h"
  34. #include "minddata/dataset/kernels/ir/vision/random_affine_ir.h"
  35. #include "minddata/dataset/kernels/ir/vision/random_color_adjust_ir.h"
  36. #include "minddata/dataset/kernels/ir/vision/random_color_ir.h"
  37. #include "minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.h"
  38. #include "minddata/dataset/kernels/ir/vision/random_crop_ir.h"
  39. #include "minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.h"
  40. #include "minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.h"
  41. #include "minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.h"
  42. #include "minddata/dataset/kernels/ir/vision/random_posterize_ir.h"
  43. #include "minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h"
  44. #include "minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.h"
  45. #include "minddata/dataset/kernels/ir/vision/random_resize_ir.h"
  46. #include "minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.h"
  47. #include "minddata/dataset/kernels/ir/vision/random_rotation_ir.h"
  48. #include "minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.h"
  49. #include "minddata/dataset/kernels/ir/vision/random_sharpness_ir.h"
  50. #include "minddata/dataset/kernels/ir/vision/random_solarize_ir.h"
  51. #include "minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.h"
  52. #include "minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.h"
  53. #include "minddata/dataset/kernels/ir/vision/rescale_ir.h"
  54. #include "minddata/dataset/kernels/ir/vision/resize_ir.h"
  55. #include "minddata/dataset/kernels/ir/vision/resize_preserve_ar_ir.h"
  56. #include "minddata/dataset/kernels/ir/vision/resize_with_bbox_ir.h"
  57. #include "minddata/dataset/kernels/ir/vision/rgba_to_bgr_ir.h"
  58. #include "minddata/dataset/kernels/ir/vision/rgba_to_rgb_ir.h"
  59. #include "minddata/dataset/kernels/ir/vision/rgb_to_gray_ir.h"
  60. #include "minddata/dataset/kernels/ir/vision/rotate_ir.h"
  61. #include "minddata/dataset/kernels/ir/vision/softdvpp_decode_random_crop_resize_jpeg_ir.h"
  62. #include "minddata/dataset/kernels/ir/vision/softdvpp_decode_resize_jpeg_ir.h"
  63. #include "minddata/dataset/kernels/ir/vision/swap_red_blue_ir.h"
  64. #include "minddata/dataset/kernels/ir/vision/uniform_aug_ir.h"
  65. using namespace mindspore::dataset;
  66. class MindDataTestIRVision : public UT::DatasetOpTesting {
  67. public:
  68. MindDataTestIRVision() = default;
  69. };
  70. TEST_F(MindDataTestIRVision, TestAutoContrastFail1) {
  71. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestAutoContrastFail1.";
  72. // Testing invalid cutoff < 0
  73. std::shared_ptr<TensorOperation> auto_contrast1(new vision::AutoContrastOperation(-1.0, {}));
  74. Status rc1 = auto_contrast1->ValidateParams();
  75. EXPECT_ERROR(rc1);
  76. // Testing invalid cutoff > 100
  77. std::shared_ptr<TensorOperation> auto_contrast2(new vision::AutoContrastOperation(110.0, {10, 20}));
  78. Status rc2 = auto_contrast2->ValidateParams();
  79. EXPECT_ERROR(rc2);
  80. }
  81. TEST_F(MindDataTestIRVision, TestCenterCropFail) {
  82. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCenterCrop with invalid parameters.";
  83. Status rc;
  84. // center crop height value negative
  85. std::shared_ptr<TensorOperation> center_crop1(new vision::CenterCropOperation({-32, 32}));
  86. rc = center_crop1->ValidateParams();
  87. EXPECT_ERROR(rc);
  88. // center crop width value negative
  89. std::shared_ptr<TensorOperation> center_crop2(new vision::CenterCropOperation({32, -32}));
  90. rc = center_crop2->ValidateParams();
  91. EXPECT_ERROR(rc);
  92. // 0 value would result in nullptr
  93. std::shared_ptr<TensorOperation> center_crop3(new vision::CenterCropOperation({0, 32}));
  94. rc = center_crop3->ValidateParams();
  95. EXPECT_ERROR(rc);
  96. // center crop with 3 values
  97. std::shared_ptr<TensorOperation> center_crop4(new vision::CenterCropOperation({10, 20, 30}));
  98. rc = center_crop4->ValidateParams();
  99. EXPECT_ERROR(rc);
  100. }
  101. TEST_F(MindDataTestIRVision, TestCropFail) {
  102. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCrop with invalid parameters.";
  103. Status rc;
  104. // wrong width
  105. std::shared_ptr<TensorOperation> crop1(new vision::CropOperation({0, 0}, {32, -32}));
  106. rc = crop1->ValidateParams();
  107. EXPECT_ERROR(rc);
  108. // wrong height
  109. std::shared_ptr<TensorOperation> crop2(new vision::CropOperation({0, 0}, {-32, -32}));
  110. rc = crop2->ValidateParams();
  111. EXPECT_ERROR(rc);
  112. // zero height
  113. std::shared_ptr<TensorOperation> crop3(new vision::CropOperation({0, 0}, {0, 32}));
  114. rc = crop3->ValidateParams();
  115. EXPECT_ERROR(rc);
  116. // negative coordinates
  117. std::shared_ptr<TensorOperation> crop4(new vision::CropOperation({-1, 0}, {32, 32}));
  118. rc = crop4->ValidateParams();
  119. EXPECT_ERROR(rc);
  120. }
  121. TEST_F(MindDataTestIRVision, TestCutOutFail1) {
  122. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCutOutFail1 with invalid parameters.";
  123. Status rc;
  124. // Create object for the tensor op
  125. // Invalid negative length
  126. std::shared_ptr<TensorOperation> cutout_op = std::make_shared<vision::CutOutOperation>(-10, 1);
  127. rc = cutout_op->ValidateParams();
  128. EXPECT_ERROR(rc);
  129. // Invalid negative number of patches
  130. cutout_op = std::make_shared<vision::CutOutOperation>(10, -1);
  131. rc = cutout_op->ValidateParams();
  132. EXPECT_ERROR(rc);
  133. }
  134. TEST_F(MindDataTestIRVision, TestCutOutFail2) {
  135. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCutOutFail2 with invalid params, boundary cases.";
  136. Status rc;
  137. // Create object for the tensor op
  138. // Invalid zero length
  139. std::shared_ptr<TensorOperation> cutout_op = std::make_shared<vision::CutOutOperation>(0, 1);
  140. rc = cutout_op->ValidateParams();
  141. EXPECT_ERROR(rc);
  142. // Invalid zero number of patches
  143. cutout_op = std::make_shared<vision::CutOutOperation>(10, 0);
  144. rc = cutout_op->ValidateParams();
  145. EXPECT_ERROR(rc);
  146. }
  147. TEST_F(MindDataTestIRVision, TestNormalizeFail) {
  148. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestNormalizeFail with invalid parameters.";
  149. Status rc;
  150. // std value 0.0 out of range
  151. std::shared_ptr<TensorOperation> normalize1(new vision::NormalizeOperation({121.0, 115.0, 100.0}, {0.0, 68.0, 71.0}));
  152. rc = normalize1->ValidateParams();
  153. EXPECT_ERROR(rc);
  154. // std value 256.0 out of range
  155. std::shared_ptr<TensorOperation> normalize2(
  156. new vision::NormalizeOperation({121.0, 10.0, 100.0}, {256.0, 68.0, 71.0}));
  157. rc = normalize2->ValidateParams();
  158. EXPECT_ERROR(rc);
  159. // mean value 256.0 out of range
  160. std::shared_ptr<TensorOperation> normalize3(new vision::NormalizeOperation({256.0, 0.0, 100.0}, {70.0, 68.0, 71.0}));
  161. rc = normalize3->ValidateParams();
  162. EXPECT_ERROR(rc);
  163. // mean value 0.0 out of range
  164. std::shared_ptr<TensorOperation> normalize4(new vision::NormalizeOperation({-1.0, 0.0, 100.0}, {70.0, 68.0, 71.0}));
  165. rc = normalize4->ValidateParams();
  166. EXPECT_ERROR(rc);
  167. // normalize with 2 values (not 3 values) for mean
  168. std::shared_ptr<TensorOperation> normalize5(new vision::NormalizeOperation({121.0, 115.0}, {70.0, 68.0, 71.0}));
  169. rc = normalize5->ValidateParams();
  170. EXPECT_ERROR(rc);
  171. // normalize with 2 values (not 3 values) for standard deviation
  172. std::shared_ptr<TensorOperation> normalize6(new vision::NormalizeOperation({121.0, 115.0, 100.0}, {68.0, 71.0}));
  173. rc = normalize6->ValidateParams();
  174. EXPECT_ERROR(rc);
  175. }
  176. TEST_F(MindDataTestIRVision, TestNormalizePadFail) {
  177. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestNormalizePadFail with invalid parameters.";
  178. Status rc;
  179. // std value at 0.0
  180. std::shared_ptr<TensorOperation> normalizepad1(
  181. new vision::NormalizePadOperation({121.0, 115.0, 100.0}, {0.0, 68.0, 71.0}, "float32"));
  182. rc = normalizepad1->ValidateParams();
  183. EXPECT_ERROR(rc);
  184. // normalizepad with 2 values (not 3 values) for mean
  185. std::shared_ptr<TensorOperation> normalizepad2(
  186. new vision::NormalizePadOperation({121.0, 115.0}, {70.0, 68.0, 71.0}, "float32"));
  187. rc = normalizepad2->ValidateParams();
  188. EXPECT_ERROR(rc);
  189. // normalizepad with 2 values (not 3 values) for standard deviation
  190. std::shared_ptr<TensorOperation> normalizepad3(
  191. new vision::NormalizePadOperation({121.0, 115.0, 100.0}, {68.0, 71.0}, "float32"));
  192. rc = normalizepad3->ValidateParams();
  193. EXPECT_ERROR(rc);
  194. // normalizepad with invalid dtype
  195. std::shared_ptr<TensorOperation> normalizepad4(
  196. new vision::NormalizePadOperation({121.0, 115.0, 100.0}, {68.0, 71.0, 71.0}, "123"));
  197. rc = normalizepad4->ValidateParams();
  198. EXPECT_ERROR(rc);
  199. }
  200. TEST_F(MindDataTestIRVision, TestRescaleFail) {
  201. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestRescaleFail with invalid params.";
  202. Status rc;
  203. // incorrect negative rescale parameter
  204. std::shared_ptr<TensorOperation> rescale(new vision::RescaleOperation(-1.0, 0.0));
  205. rc = rescale->ValidateParams();
  206. EXPECT_ERROR(rc);
  207. }
  208. TEST_F(MindDataTestIRVision, TestResizeFail) {
  209. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestResize with invalid parameters.";
  210. Status rc;
  211. // negative resize value
  212. std::shared_ptr<TensorOperation> resize_op1(new vision::ResizeOperation({30, -30}, InterpolationMode::kLinear));
  213. rc = resize_op1->ValidateParams();
  214. EXPECT_ERROR(rc);
  215. // zero resize value
  216. std::shared_ptr<TensorOperation> resize_op2(new vision::ResizeOperation({0, 30}, InterpolationMode::kLinear));
  217. rc = resize_op2->ValidateParams();
  218. EXPECT_ERROR(rc);
  219. // resize with 3 values
  220. std::shared_ptr<TensorOperation> resize_op3(new vision::ResizeOperation({30, 20, 10}, InterpolationMode::kLinear));
  221. rc = resize_op3->ValidateParams();
  222. EXPECT_ERROR(rc);
  223. }
  224. TEST_F(MindDataTestIRVision, TestResizeWithBBoxFail) {
  225. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestResizeWithBBoxFail with invalid parameters.";
  226. Status rc;
  227. // Testing negative resize value
  228. std::shared_ptr<TensorOperation> resize_with_bbox_op(
  229. new vision::ResizeWithBBoxOperation({10, -10}, InterpolationMode::kLinear));
  230. EXPECT_NE(resize_with_bbox_op, nullptr);
  231. rc = resize_with_bbox_op->ValidateParams();
  232. EXPECT_ERROR(rc);
  233. // Testing negative resize value
  234. std::shared_ptr<TensorOperation> resize_with_bbox_op1(
  235. new vision::ResizeWithBBoxOperation({-10}, InterpolationMode::kLinear));
  236. EXPECT_NE(resize_with_bbox_op1, nullptr);
  237. rc = resize_with_bbox_op1->ValidateParams();
  238. EXPECT_ERROR(rc);
  239. // Testing zero resize value
  240. std::shared_ptr<TensorOperation> resize_with_bbox_op2(
  241. new vision::ResizeWithBBoxOperation({0, 10}, InterpolationMode::kLinear));
  242. EXPECT_NE(resize_with_bbox_op2, nullptr);
  243. rc = resize_with_bbox_op2->ValidateParams();
  244. EXPECT_ERROR(rc);
  245. // Testing resize with 3 values
  246. std::shared_ptr<TensorOperation> resize_with_bbox_op3(
  247. new vision::ResizeWithBBoxOperation({10, 10, 10}, InterpolationMode::kLinear));
  248. EXPECT_NE(resize_with_bbox_op3, nullptr);
  249. rc = resize_with_bbox_op3->ValidateParams();
  250. EXPECT_ERROR(rc);
  251. }
  252. TEST_F(MindDataTestIRVision, TestSoftDvppDecodeRandomCropResizeJpegFail) {
  253. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestSoftDvppDecodeRandomCropResizeJpegFail with incorrect parameters.";
  254. Status rc;
  255. // SoftDvppDecodeRandomCropResizeJpeg: size must only contain positive integers
  256. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg1(
  257. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({-500, 600}, {0.08, 1.0}, {3. / 4., 4. / 3.}, 10));
  258. rc = soft_dvpp_decode_random_crop_resize_jpeg1->ValidateParams();
  259. EXPECT_ERROR(rc);
  260. // SoftDvppDecodeRandomCropResizeJpeg: size must only contain positive integers
  261. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg2(
  262. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({-500}, {0.08, 1.0}, {3. / 4., 4. / 3.}, 10));
  263. rc = soft_dvpp_decode_random_crop_resize_jpeg2->ValidateParams();
  264. EXPECT_ERROR(rc);
  265. // SoftDvppDecodeRandomCropResizeJpeg: size must be a vector of one or two values
  266. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg3(
  267. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500, 600, 700}, {0.08, 1.0}, {3. / 4., 4. / 3.}, 10));
  268. rc = soft_dvpp_decode_random_crop_resize_jpeg3->ValidateParams();
  269. EXPECT_ERROR(rc);
  270. // SoftDvppDecodeRandomCropResizeJpeg: scale must be greater than or equal to 0
  271. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg4(
  272. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {-0.1, 0.9}, {3. / 4., 4. / 3.}, 1));
  273. rc = soft_dvpp_decode_random_crop_resize_jpeg4->ValidateParams();
  274. EXPECT_ERROR(rc);
  275. // SoftDvppDecodeRandomCropResizeJpeg: scale must be in the format of (min, max)
  276. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg5(
  277. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.6, 0.2}, {3. / 4., 4. / 3.}, 1));
  278. rc = soft_dvpp_decode_random_crop_resize_jpeg5->ValidateParams();
  279. EXPECT_ERROR(rc);
  280. // SoftDvppDecodeRandomCropResizeJpeg: scale must be a vector of two values
  281. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg6(
  282. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.5, 0.6, 0.7}, {3. / 4., 4. / 3.}, 1));
  283. rc = soft_dvpp_decode_random_crop_resize_jpeg6->ValidateParams();
  284. EXPECT_ERROR(rc);
  285. // SoftDvppDecodeRandomCropResizeJpeg: ratio must be greater than or equal to 0
  286. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg7(
  287. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.5, 0.9}, {-0.2, 0.4}, 5));
  288. rc = soft_dvpp_decode_random_crop_resize_jpeg7->ValidateParams();
  289. EXPECT_ERROR(rc);
  290. // SoftDvppDecodeRandomCropResizeJpeg: ratio must be in the format of (min, max)
  291. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg8(
  292. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.5, 0.9}, {0.4, 0.2}, 5));
  293. rc = soft_dvpp_decode_random_crop_resize_jpeg8->ValidateParams();
  294. EXPECT_ERROR(rc);
  295. // SoftDvppDecodeRandomCropResizeJpeg: ratio must be a vector of two values
  296. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg9(
  297. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.5, 0.9}, {0.1, 0.2, 0.3}, 5));
  298. rc = soft_dvpp_decode_random_crop_resize_jpeg9->ValidateParams();
  299. EXPECT_ERROR(rc);
  300. // SoftDvppDecodeRandomCropResizeJpeg: max_attempts must be greater than or equal to 1
  301. std::shared_ptr<TensorOperation> soft_dvpp_decode_random_crop_resize_jpeg10(
  302. new vision::SoftDvppDecodeRandomCropResizeJpegOperation({500}, {0.5, 0.9}, {0.1, 0.2}, 0));
  303. rc = soft_dvpp_decode_random_crop_resize_jpeg10->ValidateParams();
  304. EXPECT_ERROR(rc);
  305. }
  306. TEST_F(MindDataTestIRVision, TestSoftDvppDecodeResizeJpegFail) {
  307. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestSoftDvppDecodeResizeJpegFail with incorrect size.";
  308. Status rc;
  309. // SoftDvppDecodeResizeJpeg: size must be a vector of one or two values
  310. std::shared_ptr<TensorOperation> soft_dvpp_decode_resize_jpeg_op1(new vision::SoftDvppDecodeResizeJpegOperation({}));
  311. rc = soft_dvpp_decode_resize_jpeg_op1->ValidateParams();
  312. EXPECT_ERROR(rc);
  313. // SoftDvppDecodeResizeJpeg: size must be a vector of one or two values
  314. std::shared_ptr<TensorOperation> soft_dvpp_decode_resize_jpeg_op2(
  315. new vision::SoftDvppDecodeResizeJpegOperation({1, 2, 3}));
  316. rc = soft_dvpp_decode_resize_jpeg_op2->ValidateParams();
  317. EXPECT_ERROR(rc);
  318. // SoftDvppDecodeResizeJpeg: size must only contain positive integers
  319. std::shared_ptr<TensorOperation> soft_dvpp_decode_resize_jpeg_op3(
  320. new vision::SoftDvppDecodeResizeJpegOperation({20, -20}));
  321. rc = soft_dvpp_decode_resize_jpeg_op3->ValidateParams();
  322. EXPECT_ERROR(rc);
  323. // SoftDvppDecodeResizeJpeg: size must only contain positive integers
  324. std::shared_ptr<TensorOperation> soft_dvpp_decode_resize_jpeg_op4(new vision::SoftDvppDecodeResizeJpegOperation({0}));
  325. rc = soft_dvpp_decode_resize_jpeg_op4->ValidateParams();
  326. EXPECT_ERROR(rc);
  327. }
  328. TEST_F(MindDataTestIRVision, TestVisionOperationName) {
  329. MS_LOG(INFO) << "Doing MindDataTestIRVision-TestVisionOperationName.";
  330. std::string correct_name;
  331. // Create object for the tensor op, and check the name
  332. std::shared_ptr<TensorOperation> random_vertical_flip_op = std::make_shared<vision::RandomVerticalFlipOperation>(0.5);
  333. correct_name = "RandomVerticalFlip";
  334. EXPECT_EQ(correct_name, random_vertical_flip_op->Name());
  335. // Create object for the tensor op, and check the name
  336. std::shared_ptr<TensorOperation> softDvpp_decode_resize_jpeg_op(
  337. new vision::SoftDvppDecodeResizeJpegOperation({1, 1}));
  338. correct_name = "SoftDvppDecodeResizeJpeg";
  339. EXPECT_EQ(correct_name, softDvpp_decode_resize_jpeg_op->Name());
  340. }