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