1 /** 2 * Copyright 2020-2023 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_KERNELS_IMAGE_RANDOM_CROP_WITH_BBOX_OP_H_ 17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_WITH_BBOX_OP_H_ 18 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 #include "minddata/dataset/kernels/image/random_crop_op.h" 24 25 namespace mindspore { 26 namespace dataset { 27 class RandomCropWithBBoxOp : public RandomCropOp { 28 public: 29 // Constructor for RandomCropWithBBoxOp, with default value and passing to base class constructor RandomCropWithBBoxOp(int32_t crop_height,int32_t crop_width,int32_t pad_top,int32_t pad_bottom,int32_t pad_left,int32_t pad_right,bool pad_if_needed,BorderType padding_mode,uint8_t fill_r,uint8_t fill_g,uint8_t fill_b)30 RandomCropWithBBoxOp(int32_t crop_height, int32_t crop_width, int32_t pad_top, int32_t pad_bottom, int32_t pad_left, 31 int32_t pad_right, bool pad_if_needed, BorderType padding_mode, uint8_t fill_r, uint8_t fill_g, 32 uint8_t fill_b) 33 : RandomCropOp(crop_height, crop_width, pad_top, pad_bottom, pad_left, pad_right, pad_if_needed, padding_mode, 34 fill_r, fill_g, fill_b) {} 35 36 ~RandomCropWithBBoxOp() override = default; 37 Print(std::ostream & out)38 void Print(std::ostream &out) const override { 39 out << Name() << ": " << RandomCropOp::crop_height_ << " " << RandomCropOp::crop_width_; 40 } 41 42 Status Compute(const TensorRow &input, TensorRow *output) override; 43 Name()44 std::string Name() const override { return kRandomCropWithBBoxOp; } 45 }; 46 } // namespace dataset 47 } // namespace mindspore 48 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_WITH_BBOX_OP_H_ 49