Skip to content

Commit 901ff18

Browse files
authored
fix error when detection output is null (#351)
1 parent 3189798 commit 901ff18

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

easycv/toolkit/modelscope/pipelines/detection_pipeline.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ def __call__(self, inputs) -> Any:
4848
labels = []
4949
boxes = []
5050
for output in outputs:
51-
for score, label, box in zip(output['detection_scores'],
52-
output['detection_classes'],
53-
output['detection_boxes']):
51+
scores_list = output['detection_scores'] if output[
52+
'detection_scores'] is not None else []
53+
classes_list = output['detection_classes'] if output[
54+
'detection_classes'] is not None else []
55+
boxes_list = output['detection_boxes'] if output[
56+
'detection_boxes'] is not None else []
57+
58+
for score, label, box in zip(scores_list, classes_list,
59+
boxes_list):
5460
scores.append(score)
5561
labels.append(self.cfg.CLASSES[label])
5662
boxes.append([b for b in box])

0 commit comments

Comments
 (0)