(self, image_list)
| 132 | return PredictConfig(model_dir, use_fd_format=use_fd_format) |
| 133 | |
| 134 | def preprocess(self, image_list): |
| 135 | preprocess_ops = [] |
| 136 | for op_info in self.pred_config.preprocess_infos: |
| 137 | new_op_info = op_info.copy() |
| 138 | op_type = new_op_info.pop('type') |
| 139 | preprocess_ops.append(eval(op_type)(**new_op_info)) |
| 140 | |
| 141 | input_im_lst = [] |
| 142 | input_im_info_lst = [] |
| 143 | for im_path in image_list: |
| 144 | im, im_info = preprocess(im_path, preprocess_ops) |
| 145 | input_im_lst.append(im) |
| 146 | input_im_info_lst.append(im_info) |
| 147 | inputs = create_inputs(input_im_lst, input_im_info_lst) |
| 148 | input_names = self.predictor.get_input_names() |
| 149 | for i in range(len(input_names)): |
| 150 | input_tensor = self.predictor.get_input_handle(input_names[i]) |
| 151 | if input_names[i] == 'x': |
| 152 | input_tensor.copy_from_cpu(inputs['image']) |
| 153 | else: |
| 154 | input_tensor.copy_from_cpu(inputs[input_names[i]]) |
| 155 | |
| 156 | return inputs |
| 157 | |
| 158 | def postprocess(self, inputs, result): |
| 159 | # postprocess output of predictor |
no test coverage detected