MCPcopy Index your code
hub / github.com/PaddlePaddle/PaddleDetection / preprocess

Method preprocess

deploy/python/infer.py:134–156  ·  view source on GitHub ↗
(self, image_list)

Source from the content-addressed store, hash-verified

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

Callers 5

predict_image_sliceMethod · 0.95
predict_imageMethod · 0.95
predict_imageMethod · 0.45
predict_imageMethod · 0.45
predict_imageMethod · 0.45

Calls 5

preprocessFunction · 0.90
appendMethod · 0.80
create_inputsFunction · 0.70
evalFunction · 0.50
copyMethod · 0.45

Tested by

no test coverage detected