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.

vision_ascend.h 3.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_VISION_ASCEND_H_
  17. #define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_VISION_ASCEND_H_
  18. #include <map>
  19. #include <memory>
  20. #include <string>
  21. #include <utility>
  22. #include <vector>
  23. #include "include/api/status.h"
  24. #include "minddata/dataset/include/constants.h"
  25. #include "minddata/dataset/include/transforms.h"
  26. namespace mindspore {
  27. namespace dataset {
  28. // Transform operations for performing computer vision.
  29. namespace vision {
  30. /* ##################################### API class ###########################################*/
  31. class DvppDecodeResizeJpeg final : public TensorTransform {
  32. public:
  33. /// \brief Constructor.
  34. /// \param[in] resize A vector of int value for each dimension, w.r.t H,W order.
  35. explicit DvppDecodeResizeJpeg(std::vector<uint32_t> resize);
  36. /// \brief Destructor.
  37. ~DvppDecodeResizeJpeg() = default;
  38. protected:
  39. /// \brief Function to convert TensorTransform object into a TensorOperation object.
  40. /// \return Shared pointer to TensorOperation object.
  41. std::shared_ptr<TensorOperation> Parse() override;
  42. std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;
  43. private:
  44. struct Data;
  45. std::shared_ptr<Data> data_;
  46. };
  47. class DvppDecodeResizeCropJpeg final : public TensorTransform {
  48. public:
  49. /// \brief Constructor.
  50. /// \param[in] crop A vector of int value for each dimension after final crop, w.r.t H,W order.
  51. /// \param[in] resize A vector of int value for each dimension after resize, w.r.t H,W order.
  52. explicit DvppDecodeResizeCropJpeg(std::vector<uint32_t> crop, std::vector<uint32_t> resize);
  53. /// \brief Destructor.
  54. ~DvppDecodeResizeCropJpeg() = default;
  55. protected:
  56. /// \brief Function to convert TensorTransform object into a TensorOperation object.
  57. /// \return Shared pointer to TensorOperation object.
  58. std::shared_ptr<TensorOperation> Parse() override;
  59. std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;
  60. private:
  61. struct Data;
  62. std::shared_ptr<Data> data_;
  63. };
  64. class DvppDecodePng final : public TensorTransform {
  65. public:
  66. /// \brief Constructor.
  67. DvppDecodePng();
  68. /// \brief Destructor.
  69. ~DvppDecodePng() = default;
  70. protected:
  71. /// \brief Function to convert TensorTransform object into a TensorOperation object.
  72. /// \return Shared pointer to TensorOperation object.
  73. std::shared_ptr<TensorOperation> Parse() override;
  74. std::shared_ptr<TensorOperation> Parse(const MapTargetDevice &env) override;
  75. };
  76. } // namespace vision
  77. } // namespace dataset
  78. } // namespace mindspore
  79. #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_VISION_ASCEND_H_