Skip to content

Commit 66850a4

Browse files
authored
Merge pull request #4 from Bourn3z/dev-offlineinfer
Add the function of concatenating to crops after detection.
2 parents 7d10934 + 9ce69b8 commit 66850a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

deploy/py_infer/src/parallel/module/detection/det_post_node.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ def concat_crops(self, crops: list):
2828
Returns:
2929
numpy.ndarray: A horizontally concatenated image array.
3030
"""
31-
max_height = max(crop.shape[0] for crop in crops)
31+
crops_sorted = sorted(crops, key=lambda points: (points[0][1], points[0][0]))
32+
max_height = max(crop.shape[0] for crop in crops_sorted)
3233
resized_crops = []
33-
for crop in crops:
34+
for crop in crops_sorted:
3435
h, w, c = crop.shape
3536
new_h = max_height
3637
new_w = int((w / h) * new_h)
3738

3839
resized_img = cv2.resize(crop, (new_w, new_h), interpolation=cv2.INTER_LINEAR)
3940
resized_crops.append(resized_img)
40-
crops = np.concatenate(resized_crops, axis=1)
41-
return crops
41+
crops_concated = np.concatenate(resized_crops, axis=1)
42+
return crops_concated
4243

4344
def process(self, input_data):
4445
if input_data.skip:

0 commit comments

Comments
 (0)