From 3e1c6682475b7aa422a6bb2796e7f77d25c4f842 Mon Sep 17 00:00:00 2001 From: liyong Date: Thu, 18 Nov 2021 16:34:45 +0800 Subject: [PATCH] fix mnist dataset --- .../engine/datasetops/source/mnist_op.cc | 3 --- .../engine/datasetops/source/qmnist_op.cc | 3 --- tests/st/summary/test_summary_collector.py | 2 +- .../golden/autocontrast_mnist_result_c.npz | Bin 713 -> 709 bytes .../dataset/golden/equalize_mnist_result_c.npz | Bin 713 -> 709 bytes .../golden/random_solarize_02_result.npz | Bin 713 -> 709 bytes tests/ut/python/dataset/test_datasets_emnist.py | 1 - .../dataset/test_datasets_fashion_mnist.py | 1 - tests/ut/python/dataset/test_datasets_kmnist.py | 1 - tests/ut/python/dataset/test_datasets_mnist.py | 1 - tests/ut/python/dataset/test_datasets_qmnist.py | 1 - 11 files changed, 1 insertion(+), 12 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mnist_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mnist_op.cc index ed87d0bd82..49a0a77ecf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mnist_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/mnist_op.cc @@ -192,9 +192,6 @@ Status MnistOp::ReadImageAndLabel(std::ifstream *image_reader, std::ifstream *la TensorShape img_tensor_shape = TensorShape({kMnistImageRows, kMnistImageCols, 1}); for (int64_t j = 0; j != num_images; ++j) { auto pixels = &images_buf[j * size]; - for (int64_t m = 0; m < size; ++m) { - pixels[m] = (pixels[m] == 0) ? 0 : 255; - } std::shared_ptr image; RETURN_IF_NOT_OK(Tensor::CreateFromMemory(img_tensor_shape, data_schema_->Column(0).Type(), reinterpret_cast(pixels), &image)); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc index b5162eab17..fe78f17b7a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc @@ -241,9 +241,6 @@ Status QMnistOp::ReadImageAndLabel(std::ifstream *image_reader, std::ifstream *l TensorShape label_tensor_shape = TensorShape({kQMnistLabelLength}); for (int64_t data_index = 0; data_index != num_images; data_index++) { auto image = &images_buf[data_index * image_size]; - for (int64_t image_index = 0; image_index < image_size; image_index++) { - image[image_index] = (image[image_index] == 0) ? 0 : 255; - } std::shared_ptr image_tensor; RETURN_IF_NOT_OK(Tensor::CreateFromMemory(image_tensor_shape, data_schema_->Column(0).Type(), reinterpret_cast(image), &image_tensor)); diff --git a/tests/st/summary/test_summary_collector.py b/tests/st/summary/test_summary_collector.py index 77c8339d90..21d44ab07c 100644 --- a/tests/st/summary/test_summary_collector.py +++ b/tests/st/summary/test_summary_collector.py @@ -304,7 +304,7 @@ class TestSummary: break return tags - @pytest.mark.level0 + @pytest.mark.level1 @pytest.mark.platform_x86_ascend_training @pytest.mark.platform_arm_ascend_training @pytest.mark.platform_x86_gpu_training diff --git a/tests/ut/data/dataset/golden/autocontrast_mnist_result_c.npz b/tests/ut/data/dataset/golden/autocontrast_mnist_result_c.npz index 683ed673a0109ef79e1251155a81a79b4037e31a..e283681ab33aeae848fb5fe25f81acd5d6d969fa 100644 GIT binary patch delta 180 zcmX@fdX&{9z?+#xgaHB+8SY=%)o;thzyQLW3?dAPMMd!jdU*wvj0^%`L6Ab*i6)+cjqZ delta 210 zcmX@gdXm*7z?+#xgaHB+8B{xRzc?~6Fn};8g9t-nQBk~sUS2^ZBZB}~5Twv?qRA%~ zZw7D1$r_A$tT~BEsX3FQ8MPon?TqRIA20uJan>w1YSaBBd*o?R(&T-NDvIcWh4LkZ z3Q4IEtUwbpa}(23Co?mt2y~02mND6Ey!1N#?e8^iiL)o0V-w6~lI4Uub@D_eJ+>O4 HgBchA#Q8xr diff --git a/tests/ut/data/dataset/golden/equalize_mnist_result_c.npz b/tests/ut/data/dataset/golden/equalize_mnist_result_c.npz index 683ed673a0109ef79e1251155a81a79b4037e31a..bb7c8b5a1e65e802e475dfce29659fe5fa535c0c 100644 GIT binary patch delta 180 zcmX@fdX&{9z?+#xgaHB+89x0Czh=wCzyQLW3?dAPMMd!jdU*wvj0^%`L6Ab*i6)DZSFDX<= uN{wIznwFE8l$tY{ok?Z#Ge*J5HcZN3x`0WB6YiMFQw1YSaBBd*o?R(&T-NDvIcWh4LkZ z3Q4IEtUwbpa}(23Co?mt2y~02mND6Ey!1N#?e8^iiL)o0V-w6~lI4Uub@D_eJ+>O4 HgBchA#Q8xr diff --git a/tests/ut/data/dataset/golden/random_solarize_02_result.npz b/tests/ut/data/dataset/golden/random_solarize_02_result.npz index 683ed673a0109ef79e1251155a81a79b4037e31a..90be85823e518135d83e72fb5c737e018d9121f3 100644 GIT binary patch delta 180 zcmX@fdX&{9z?+#xgaHB+890i)_S-TsFn};8g9t-nQBk~sUS2^ZBZB}~5Twv{qRA(w z&W_1ijC!n@xrynilVcgRKmy&2>H>>RnzpB&`*a3q)bm@@w?CYGh*3rHUd61Am`!0^ zdJNv;{VEwLh4LkZ3Q4IEtU%Lp5|dJMCbKiCOn$~FIN63t8B7;2$#B9QGkGeL9$N*_ HNem1CVpB0} delta 210 zcmX@gdXm*7z?+#xgaHB+8B{xRzc?~6Fn};8g9t-nQBk~sUS2^ZBZB}~5Twv?qRA%~ zZw7D1$r_A$tT~BEsX3FQ8MPon?TqRIA20uJan>w1YSaBBd*o?R(&T-NDvIcWh4LkZ z3Q4IEtUwbpa}(23Co?mt2y~02mND6Ey!1N#?e8^iiL)o0V-w6~lI4Uub@D_eJ+>O4 HgBchA#Q8xr diff --git a/tests/ut/python/dataset/test_datasets_emnist.py b/tests/ut/python/dataset/test_datasets_emnist.py index 76703151f2..7cfdcddb0d 100644 --- a/tests/ut/python/dataset/test_datasets_emnist.py +++ b/tests/ut/python/dataset/test_datasets_emnist.py @@ -59,7 +59,6 @@ def load_emnist(path, usage, name): image_file.read(16) image = np.fromfile(image_file, dtype=np.uint8) image = image.reshape(-1, 28, 28, 1) - image[image > 0] = 255 # Perform binarization to maintain consistency with our API images.append(image) with open(label_path[i], 'rb') as label_file: label_file.read(8) diff --git a/tests/ut/python/dataset/test_datasets_fashion_mnist.py b/tests/ut/python/dataset/test_datasets_fashion_mnist.py index 053b51d254..4b6b6975ec 100644 --- a/tests/ut/python/dataset/test_datasets_fashion_mnist.py +++ b/tests/ut/python/dataset/test_datasets_fashion_mnist.py @@ -44,7 +44,6 @@ def load_fashion_mnist(path): imgpath.read(16) images = np.fromfile(imgpath, dtype=np.uint8) images = images.reshape(-1, 28, 28, 1) - images[images > 0] = 255 # Perform binarization to maintain consistency with our API return images, labels diff --git a/tests/ut/python/dataset/test_datasets_kmnist.py b/tests/ut/python/dataset/test_datasets_kmnist.py index 918cd46aca..63f0069ece 100644 --- a/tests/ut/python/dataset/test_datasets_kmnist.py +++ b/tests/ut/python/dataset/test_datasets_kmnist.py @@ -44,7 +44,6 @@ def load_kmnist(path): imgpath.read(16) images = np.fromfile(imgpath, dtype=np.uint8) images = images.reshape(-1, 28, 28, 1) - images[images > 0] = 255 # Perform binarization to maintain consistency with our API return images, labels diff --git a/tests/ut/python/dataset/test_datasets_mnist.py b/tests/ut/python/dataset/test_datasets_mnist.py index bbd04df8ab..34354169c3 100644 --- a/tests/ut/python/dataset/test_datasets_mnist.py +++ b/tests/ut/python/dataset/test_datasets_mnist.py @@ -39,7 +39,6 @@ def load_mnist(path): imgpath.read(16) images = np.fromfile(imgpath, dtype=np.uint8) images = images.reshape(-1, 28, 28, 1) - images[images > 0] = 255 # Perform binarization to maintain consistency with our API return images, labels diff --git a/tests/ut/python/dataset/test_datasets_qmnist.py b/tests/ut/python/dataset/test_datasets_qmnist.py index 4c65228dff..9a86c95fb5 100644 --- a/tests/ut/python/dataset/test_datasets_qmnist.py +++ b/tests/ut/python/dataset/test_datasets_qmnist.py @@ -66,7 +66,6 @@ def load_qmnist(path, usage, compat=True): image_file.read(16) image = np.fromfile(image_file, dtype=np.uint8) image = image.reshape(-1, 28, 28, 1) - image[image > 0] = 255 # Perform binarization to maintain consistency with our API images.append(image) with open(label_path[i], 'rb') as label_file: label_file.read(12)