Browse Source

!11094 【MD】fix bug for md pipleline build

From: @xulei2020
Reviewed-by: 
Signed-off-by:
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
3945bdcabb
10 changed files with 23 additions and 31 deletions
  1. +2
    -0
      mindspore/ccsrc/minddata/dataset/api/samplers.cc
  2. +4
    -3
      mindspore/ccsrc/minddata/dataset/api/vision.cc
  3. +1
    -1
      mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc
  4. +1
    -1
      mindspore/ccsrc/minddata/dataset/include/samplers.h
  5. +1
    -15
      mindspore/ccsrc/minddata/dataset/include/vision_lite.h
  6. +1
    -0
      mindspore/ccsrc/minddata/dataset/kernels/image/CMakeLists.txt
  7. +5
    -3
      mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc
  8. +4
    -0
      mindspore/ccsrc/minddata/dataset/kernels/image/rotate_op.cc
  9. +1
    -1
      mindspore/lite/CMakeLists.txt
  10. +3
    -7
      mindspore/lite/minddata/CMakeLists.txt

+ 2
- 0
mindspore/ccsrc/minddata/dataset/api/samplers.cc View File

@@ -31,6 +31,8 @@
#include "minddata/mindrecord/include/shard_sequential_sample.h"
#include "minddata/mindrecord/include/shard_shuffle.h"
#include "minddata/dataset/util/random.h"
#else
#include "minddata/dataset/core/config_manager.h"
#endif

namespace mindspore {


+ 4
- 3
mindspore/ccsrc/minddata/dataset/api/vision.cc View File

@@ -75,6 +75,7 @@
#include "minddata/dataset/kernels/image/swap_red_blue_op.h"
#include "minddata/dataset/kernels/image/uniform_aug_op.h"
#endif
#include "minddata/dataset/kernels/image/rotate_op.h"

namespace mindspore {
namespace dataset {
@@ -1919,7 +1920,6 @@ std::shared_ptr<TensorOp> ResizeOperation::Build() {
return std::make_shared<ResizeOp>(height, width, interpolation_);
}

#ifdef ENABLE_ANDROID
// RotateOperation
RotateOperation::RotateOperation() { rotate_op = std::make_shared<RotateOp>(0); }

@@ -1927,8 +1927,9 @@ Status RotateOperation::ValidateParams() { return Status::OK(); }

std::shared_ptr<TensorOp> RotateOperation::Build() { return rotate_op; }

void RotateOperation::setAngle(uint64_t angle_id) { rotate_op->setAngle(angle_id); }
#endif
void RotateOperation::setAngle(uint64_t angle_id) {
std::dynamic_pointer_cast<RotateOp>(rotate_op)->setAngle(angle_id);
}

#ifndef ENABLE_ANDROID
// ResizeWithBBoxOperation


+ 1
- 1
mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc View File

@@ -133,7 +133,7 @@ Status BatchOp::operator()() {
RETURN_IF_NOT_OK(GetBatchSize(&cur_batch_size, CBatchInfo(epoch_num, batch_num, cnt - epoch_num)));
RETURN_IF_NOT_OK(child_iterator_->FetchNextTensorRow(&new_row));

#if !defined(_WIN32) && !defined(_WIN64)
#if !defined(_WIN32) && !defined(_WIN64) && ENABLE_PYTHON
if ((num_workers_ > 1 || batch_map_func_) && GetMemoryUsage() > MAX_MEMORY_USAGE_THRESHOLD) {
MS_LOG(WARNING) << "Memory consumption is more than " << MAX_MEMORY_USAGE_THRESHOLD * 100 << "%, "
<< "which may cause oom error. Please reduce num_parallel_workers size / "


+ 1
- 1
mindspore/ccsrc/minddata/dataset/include/samplers.h View File

@@ -21,8 +21,8 @@
#include <string>
#include <vector>

#ifndef ENABLE_ANDROID
#include "minddata/dataset/util/status.h"
#ifndef ENABLE_ANDROID
#include "minddata/mindrecord/include/shard_column.h"
#include "minddata/mindrecord/include/shard_error.h"
#include "minddata/mindrecord/include/shard_reader.h"


+ 1
- 15
mindspore/ccsrc/minddata/dataset/include/vision_lite.h View File

@@ -26,10 +26,6 @@
#include "minddata/dataset/include/transforms.h"
#include "minddata/dataset/include/status.h"

#ifdef ENABLE_ANDROID
#include "minddata/dataset/kernels/image/rotate_op.h"
#endif

namespace mindspore {
namespace dataset {

@@ -42,20 +38,14 @@ constexpr char kCropOperation[] = "Crop";
constexpr char kDecodeOperation[] = "Decode";
constexpr char kNormalizeOperation[] = "Normalize";
constexpr char kResizeOperation[] = "Resize";

#ifdef ENABLE_ANDROID
constexpr char kRotateOperation[] = "Rotate";
#endif
// Transform Op classes (in alphabetical order)
class CenterCropOperation;
class CropOperation;
class DecodeOperation;
class NormalizeOperation;
class ResizeOperation;

#ifdef ENABLE_ANDROID
class RotateOperation;
#endif

/// \brief Function to create a CenterCrop TensorOperation.
/// \notes Crops the input image at the center to the given size.
@@ -98,12 +88,10 @@ std::shared_ptr<NormalizeOperation> Normalize(std::vector<float> mean, std::vect
/// \return Shared pointer to the current TensorOperation.
std::shared_ptr<ResizeOperation> Resize(std::vector<int32_t> size,
InterpolationMode interpolation = InterpolationMode::kLinear);
#ifdef ENABLE_ANDROID
/// \brief Applies an rotate transformation to an image.
/// \notes Rotate the input image using a specified angle id.
/// \return Shared pointer to the current TensorOperation.
std::shared_ptr<RotateOperation> Rotate();
#endif

class CenterCropOperation : public TensorOperation {
public:
@@ -188,7 +176,6 @@ class ResizeOperation : public TensorOperation {
InterpolationMode interpolation_;
};

#ifdef ENABLE_ANDROID
class RotateOperation : public TensorOperation {
public:
RotateOperation();
@@ -204,9 +191,8 @@ class RotateOperation : public TensorOperation {
void setAngle(uint64_t angle_id);

private:
std::shared_ptr<RotateOp> rotate_op;
std::shared_ptr<TensorOp> rotate_op;
};
#endif
} // namespace vision
} // namespace dataset
} // namespace mindspore


+ 1
- 0
mindspore/ccsrc/minddata/dataset/kernels/image/CMakeLists.txt View File

@@ -53,6 +53,7 @@ add_library(kernels-image OBJECT
resize_with_bbox_op.cc
random_resize_with_bbox_op.cc
random_color_op.cc
rotate_op.cc
)
if (ENABLE_ACL)
add_dependencies(kernels-image kernels-soft-dvpp-image kernels-dvpp-image)


+ 5
- 3
mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc View File

@@ -674,9 +674,11 @@ bool ExtractChannel(LiteMat &src, LiteMat &dst, int col) {
return false;
}

if (dst.IsEmpty() || dst.width_ != src.width_ || dst.height_ != src.height_ || dst.channel_ != 1 ||
dst.data_type_ != src.data_type_) {
dst.Init(src.width_, src.height_, 1, src.data_type_);
if (dst.data_type_ == LDataType::FLOAT32 || dst.data_type_ == LDataType::UINT8) {
if (dst.IsEmpty() || dst.width_ != src.width_ || dst.height_ != src.height_ || dst.channel_ != 1 ||
dst.data_type_ != src.data_type_) {
dst.Init(src.width_, src.height_, 1, src.data_type_);
}
}

if (dst.data_type_ == LDataType::FLOAT32) {


+ 4
- 0
mindspore/ccsrc/minddata/dataset/kernels/image/rotate_op.cc View File

@@ -15,7 +15,9 @@
*/

#include "minddata/dataset/kernels/image/rotate_op.h"
#ifdef ENABLE_ANDROID
#include "minddata/dataset/kernels/image/lite_image_utils.h"
#endif

namespace mindspore {
namespace dataset {
@@ -26,7 +28,9 @@ Status RotateOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<T
IO_CHECK(input, output);
CHECK_FAIL_RETURN_UNEXPECTED(input->shape().Size() >= 2, "The shape size " + std::to_string(input->shape().Size()) +
" of input tensor is invalid");
#ifdef ENABLE_ANDROID
Rotate(input, output, angle_id_);
#endif
return Status::OK();
}



+ 1
- 1
mindspore/lite/CMakeLists.txt View File

@@ -116,7 +116,7 @@ if (SUPPORT_GPU)
include(${TOP_DIR}/cmake/external_libs/opencl.cmake)
endif()

if (ENABLE_CONVERTER OR BUILD_MINDDATA STREQUAL "full")
if (ENABLE_CONVERTER OR BUILD_MINDDATA STREQUAL "full" OR BUILD_MINDDATA STREQUAL "wrapper")
include(${TOP_DIR}/cmake/external_libs/json.cmake)
endif()



+ 3
- 7
mindspore/lite/minddata/CMakeLists.txt View File

@@ -90,16 +90,11 @@ AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/util MINDDATA_UTIL_SRC_FILES)
AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/image/lite_cv MINDDATA_KERNELS_IMAGE_LITE_CV_FILES)



if (BUILD_MINDDATA STREQUAL "full")
set(BUILD_MINDDATA "wrapper")
endif ()


if (BUILD_MINDDATA STREQUAL "full")
include_directories("${CMAKE_SOURCE_DIR}/../ccsrc/minddata/dataset/kernels/image")
list(REMOVE_ITEM MINDDATA_API_SRC_FILES
"${MINDDATA_DIR}/api/text.cc"
"${MINDDATA_DIR}/api/minddata_eager.cc"
)

list(REMOVE_ITEM MINDDATA_CALLBACK_SRC_FILES
@@ -198,6 +193,7 @@ if (BUILD_MINDDATA STREQUAL "full")
"${MINDDATA_DIR}/kernels/image/mixup_batch_op.cc"
"${MINDDATA_DIR}/kernels/image/pad_op.cc"
"${MINDDATA_DIR}/kernels/image/posterize_op.cc"
${MINDDATA_DIR}/kernels/image/normalize_pad_op.cc
"${MINDDATA_DIR}/kernels/image/random_affine_op.cc"
"${MINDDATA_DIR}/kernels/image/random_color_adjust_op.cc"
"${MINDDATA_DIR}/kernels/image/random_crop_and_resize_with_bbox_op.cc"
@@ -438,7 +434,7 @@ elseif (BUILD_MINDDATA STREQUAL "lite")
add_library(minddata-lite SHARED
${MINDDATA_CORE_SRC_FILES}
${MINDDATA_KERNELS_SRC_FILES}
${MINDDATA_KERNELS_IMAGE_LITE_CV_FILES}
${MINDDATA_KERNELS_IMAGE_LITE_CV_FILES}
${MINDDATA_KERNELS_IMAGE_SRC_FILES}
${MINDDATA_KERNELS_DATA_SRC_FILES}
${MINDDATA_DIR}/util/status.cc


Loading…
Cancel
Save