MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / SortedBoxes

Class SortedBoxes

python/paddle_serving_app/reader/image_reader.py:1056–1074  ·  view source on GitHub ↗

Sorted bounding boxes from Detection

Source from the content-addressed store, hash-verified

1054
1055
1056class SortedBoxes(object):
1057 """
1058 Sorted bounding boxes from Detection
1059 """
1060
1061 def __init__(self):
1062 pass
1063
1064 def __call__(self, dt_boxes):
1065 num_boxes = dt_boxes.shape[0]
1066 sorted_boxes = sorted(dt_boxes, key=lambda x: (x[0][1], x[0][0]))
1067 _boxes = list(sorted_boxes)
1068 for i in range(num_boxes - 1):
1069 if abs(_boxes[i+1][0][1] - _boxes[i][0][1]) < 10 and \
1070 (_boxes[i + 1][0][0] < _boxes[i][0][0]):
1071 tmp = _boxes[i]
1072 _boxes[i] = _boxes[i + 1]
1073 _boxes[i + 1] = tmp
1074 return _boxes
1075
1076
1077class GetRotateCropImage(object):

Callers 3

preprocessMethod · 0.90
preprocessMethod · 0.90
init_opMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected