diff --git a/mindspore/ccsrc/minddata/dataset/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/CMakeLists.txt index fa07735421..ffc20cdfe1 100644 --- a/mindspore/ccsrc/minddata/dataset/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/CMakeLists.txt @@ -73,6 +73,7 @@ add_subdirectory(core) add_subdirectory(kernels) add_subdirectory(engine) add_subdirectory(api) +add_subdirectory(audio) add_subdirectory(text) add_subdirectory(callback) add_subdirectory(plugin) @@ -91,6 +92,8 @@ add_dependencies(engine-perf core) add_dependencies(engine-gnn core) add_dependencies(engine core) add_dependencies(callback core) +add_dependencies(audio-kernels core) +add_dependencies(audio-ir-kernels core) add_dependencies(text core) add_dependencies(text-kernels core) add_dependencies(text-ir core) @@ -151,6 +154,8 @@ set(submodules $ $ $ + $ + $ $ $ $ diff --git a/mindspore/ccsrc/minddata/dataset/api/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/api/CMakeLists.txt index 6207f0d2a7..617381e81a 100644 --- a/mindspore/ccsrc/minddata/dataset/api/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/api/CMakeLists.txt @@ -2,6 +2,7 @@ file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc" set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) if(ENABLE_PYTHON) add_library(APItoPython OBJECT + python/bindings/dataset/audio/kernels/ir/bindings.cc python/bindings/dataset/callback/bindings.cc python/bindings/dataset/core/bindings.cc python/bindings/dataset/engine/cache/bindings.cc @@ -27,6 +28,7 @@ if(ENABLE_PYTHON) endif() add_library(cpp-API OBJECT + audio.cc config.cc data_helper.cc datasets.cc diff --git a/mindspore/ccsrc/minddata/dataset/api/audio.cc b/mindspore/ccsrc/minddata/dataset/api/audio.cc new file mode 100644 index 0000000000..748b178f68 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/api/audio.cc @@ -0,0 +1,26 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "minddata/dataset/include/audio.h" + +#include "minddata/dataset/audio/ir/kernels/audio_ir.h" + +namespace mindspore { +namespace dataset { + +namespace audio {} // namespace audio +} // namespace dataset +} // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/audio/kernels/ir/bindings.cc b/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/audio/kernels/ir/bindings.cc new file mode 100644 index 0000000000..cca5f8362b --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/api/python/bindings/dataset/audio/kernels/ir/bindings.cc @@ -0,0 +1,24 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pybind11/pybind11.h" + +#include "minddata/dataset/api/python/pybind_register.h" +#include "minddata/dataset/audio/ir/kernels/audio_ir.h" + +namespace mindspore { +namespace dataset {} // namespace dataset +} // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/audio/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/audio/CMakeLists.txt new file mode 100644 index 0000000000..9599a82564 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(ir) +add_subdirectory(kernels) + +file(GLOB _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") +set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/audio/ir/CMakeLists.txt new file mode 100644 index 0000000000..ceebec399c --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(kernels) + +file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") +set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/CMakeLists.txt new file mode 100644 index 0000000000..4c79998cd7 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") +set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) + +add_library(audio-ir-kernels OBJECT + audio_ir.cc + ) diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.cc b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.cc new file mode 100644 index 0000000000..c63b2d45e9 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.cc @@ -0,0 +1,24 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "minddata/dataset/audio/ir/kernels/audio_ir.h" + +namespace mindspore { +namespace dataset { + +namespace audio {} // namespace audio +} // namespace dataset +} // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.h new file mode 100644 index 0000000000..3df929864d --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/audio_ir.h @@ -0,0 +1,26 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_IR_KERNELS_AUDIO_IR_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_IR_KERNELS_AUDIO_IR_H_ + +namespace mindspore { +namespace dataset { + +namespace audio {} // namespace audio +} // namespace dataset +} // namespace mindspore +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_IR_KERNELS_AUDIO_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/audio/kernels/CMakeLists.txt new file mode 100644 index 0000000000..3407ea79ba --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") +set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD) + +add_library(audio-kernels OBJECT + spectrogram_op.cc + ) diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.cc b/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.cc new file mode 100644 index 0000000000..d014ffef46 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.cc @@ -0,0 +1,21 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "minddata/dataset/audio/kernels/spectrogram_op.h" + +namespace mindspore { +namespace dataset {} // namespace dataset +} // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.h b/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.h new file mode 100644 index 0000000000..183577bd30 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/spectrogram_op.h @@ -0,0 +1,23 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_KERNELS_SPECTROGRAM_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_KERNELS_SPECTROGRAM_OP_H_ + +namespace mindspore { +namespace dataset {} // namespace dataset +} // namespace mindspore +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_AUDIO_KERNELS_SPECTROGRAM_OP_H_ diff --git a/mindspore/ccsrc/minddata/dataset/include/audio.h b/mindspore/ccsrc/minddata/dataset/include/audio.h new file mode 100644 index 0000000000..e75628fab0 --- /dev/null +++ b/mindspore/ccsrc/minddata/dataset/include/audio.h @@ -0,0 +1,27 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_AUDIO_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_AUDIO_H_ + +namespace mindspore { +namespace dataset { + +namespace audio {} // namespace audio +} // namespace dataset +} // namespace mindspore + +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_AUDIO_H_ diff --git a/mindspore/dataset/audio/__init__.py b/mindspore/dataset/audio/__init__.py new file mode 100644 index 0000000000..2d695cb34a --- /dev/null +++ b/mindspore/dataset/audio/__init__.py @@ -0,0 +1,17 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +This module is to support audio augmentations. +""" +from . import transforms diff --git a/mindspore/dataset/audio/transforms.py b/mindspore/dataset/audio/transforms.py new file mode 100644 index 0000000000..d5d03e0f3d --- /dev/null +++ b/mindspore/dataset/audio/transforms.py @@ -0,0 +1,16 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +The module audio.transforms is inherited from _c_dataengine. +"""