From 21e449d6737c4fdcc91bf4ef55229ee9dd13526f Mon Sep 17 00:00:00 2001 From: Zirui Wu Date: Fri, 27 Nov 2020 11:06:28 -0500 Subject: [PATCH] disable imgfolder recursive walk permanently --- .../api/python/bindings/dataset/include/datasets_bindings.cc | 2 +- .../dataset/engine/datasetops/source/image_folder_op.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/include/datasets_bindings.cc b/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/include/datasets_bindings.cc index 12d46cc864..c2bcb7d426 100644 --- a/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/include/datasets_bindings.cc +++ b/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/include/datasets_bindings.cc @@ -193,7 +193,7 @@ PYBIND_REGISTER(ImageFolderNode, 2, ([](const py::module *m) { .def(py::init([](std::string dataset_dir, bool decode, std::optional sampler, std::optional extensions, std::optional class_indexing, std::optional> cc) { - bool recursive = true; + bool recursive = false; auto imagefolder = std::make_shared( dataset_dir, decode, toSamplerObj(sampler), recursive, toStringSet(extensions), toStringMap(class_indexing), toDatasetCache(std::move(cc))); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/image_folder_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/image_folder_op.cc index b8b0b3c0a1..1fe9c5d510 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/image_folder_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/image_folder_op.cc @@ -347,7 +347,8 @@ Status ImageFolderOp::RecursiveWalkFolder(Path *dir) { RETURN_IF_NOT_OK(folder_name_queue_->EmplaceBack(subdir.toString().substr(dirname_offset_))); } if (recursive_ == true) { - RETURN_IF_NOT_OK(RecursiveWalkFolder(&subdir)); + MS_LOG(ERROR) << "RecursiveWalkFolder(&subdir) functionality is disabled permanently. No recursive walk of " + << "directory will be performed."; } } }