• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LITE_TOOLS_CONVERTER_PREPROCESS_PREPROCESS_PARAM_H
17 #define MINDSPORE_LITE_TOOLS_CONVERTER_PREPROCESS_PREPROCESS_PARAM_H
18 #include <string>
19 #include <vector>
20 #include <map>
21 #include <opencv2/opencv.hpp>
22 namespace mindspore {
23 namespace lite {
24 namespace preprocess {
25 enum InputType { IMAGE, BIN, INPUT_TYPE_MAX };
26 enum ImageToFormat { RGB, GRAY, BGR, IMAGE_TO_FORMAT_MAX };
27 
28 struct ImagePreProcessParam {
29   ImageToFormat image_to_format = IMAGE_TO_FORMAT_MAX;
30   cv::ColorConversionCodes image_to_format_code = cv::COLOR_COLORCVT_MAX;
31   std::vector<double> normalize_mean;
32   std::vector<double> normalize_std;
33   int resize_width = -1;
34   int resize_height = -1;
35   cv::InterpolationFlags resize_method = cv::INTER_MAX;
36   int center_crop_width = -1;
37   int center_crop_height = -1;
38 };
39 
40 struct DataPreProcessParam {
41   std::map<std::string, std::string> calibrate_path;
42   std::map<std::string, std::vector<std::string>> calibrate_path_vector;
43   int calibrate_size = 0;
44   InputType input_type = INPUT_TYPE_MAX;
45   ImagePreProcessParam image_pre_process;
46 };
47 }  // namespace preprocess
48 }  // namespace lite
49 }  // namespace mindspore
50 #endif  // MINDSPORE_LITE_TOOLS_CONVERTER_PREPROCESS_PREPROCESS_PARAM_H
51