From fed4752169dcadb93c3e09606f7caa1df611f174 Mon Sep 17 00:00:00 2001 From: channingss Date: Thu, 8 Aug 2019 09:57:04 +0800 Subject: [PATCH] delete op for detection --- x2paddle/op_mapper/onnx_op_mapper.py | 51 +--------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/x2paddle/op_mapper/onnx_op_mapper.py b/x2paddle/op_mapper/onnx_op_mapper.py index c373a93..26ae32e 100644 --- a/x2paddle/op_mapper/onnx_op_mapper.py +++ b/x2paddle/op_mapper/onnx_op_mapper.py @@ -359,7 +359,7 @@ class ONNXOpMapper(OpMapper): inputs, outputs) shape_dtype = _np.dtype('int32') if shape is None: - shape = [1, -1] # who knows + shape = [1, -1] _logger.warning( 'in %s(%s -> Reshape -> %s): ' 'input "shape" not inferred, use [1, -1] as dummy value, ' @@ -419,55 +419,6 @@ class ONNXOpMapper(OpMapper): output=node, param_attr=attr) - def _roi_pool(self, node, fluid_op=None): - - val_x = self.graph.get_node(node.layer.input[0], copy=True) - val_rois = self.graph.get_node(node.layer.input[1], copy=True) - val_y = self.graph.get_node(node.layer.output[0], copy=True) - - spatial_scale = node.get_attr('spatial_scale') # required - pooled_height, pooled_width = node.get_attr('pooled_shape') # required - - attr = {'pooled_height': pooled_height, 'spatial_scale': spatial_scale} - feature_attr = '' - is_max_pool = fluid_op == 'roi_pool' - if 'sampling_ratio' in node.attr_map: # - sampling_ratio = node.get_attr['sampling_ratio'] - attr['sampling_ratio'] = sampling_ratio - if 'output_channels' in node.attr_map: # - output_channels = node.get_attr['output_channels'] - attr['output_channels'] = output_channels - - node.fluid_code.add_layer(fluid_op, - inputs=','.join([valx, val_rois]), - output=node, - param_attr=attr) - - def RoiAlign(self, node): - self._roi_pool(node, fluid_op='roi_align') - - def NonMaxSuppression(self, node): - (val_boxes, val_scores, val_max_output_boxes_per_class, - val_iou_threshold, - val_score_threshold) = self.graph.get_nodes(node.layer.input, - copy=True) - - center_point_box = node.get_attr('center_point_box', 0) - - scores = _const_weight_or_none(val_scores) - max_output_boxes_per_class = _const_weight_or_none( - val_max_output_boxes_per_class) - iou_threshold = _const_weight_or_none(val_iou_threshold) - score_threshold = _const_weight_or_none(val_score_threshold) - if center_point_box == 1: - pass - attr = { - 'scores': scores, - 'score_threshold': score_threshold, - 'nms_threshold': iou_threshold, - 'nms_top_k': max_output_boxes_per_class, - } - def Concat(self, node): inputs = [] for i in range(len(node.layer.input)): -- GitLab