Skip to content

Commit 901ff18

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

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎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
foroutputinoutputs:
51-
forscore, label, boxinzip(output['detection_scores'],
52-
output['detection_classes'],
53-
output['detection_boxes']):
51+
scores_list=output['detection_scores'] ifoutput[
52+
'detection_scores'] isnotNoneelse []
53+
classes_list=output['detection_classes'] ifoutput[
54+
'detection_classes'] isnotNoneelse []
55+
boxes_list=output['detection_boxes'] ifoutput[
56+
'detection_boxes'] isnotNoneelse []
57+
58+
forscore, label, boxinzip(scores_list, classes_list,
59+
boxes_list):
5460
scores.append(score)
5561
labels.append(self.cfg.CLASSES[label])
5662
boxes.append([bforbinbox])

0 commit comments

Comments
 (0)