Bugfix: florence 2, handle case with no detections
This commit is contained in:
@@ -865,6 +865,9 @@ class Detections:
|
||||
if lmm == LMM.FLORENCE_2:
|
||||
assert isinstance(result, dict)
|
||||
xyxy, labels, xyxyxyxy = from_florence_2(result, **kwargs)
|
||||
if len(xyxy) == 0:
|
||||
return cls.empty()
|
||||
|
||||
data = {}
|
||||
if labels is not None:
|
||||
data[CLASS_NAME_DATA_FIELD] = labels
|
||||
|
||||
@@ -121,7 +121,6 @@ def from_florence_2(
|
||||
xyxyxyxy = np.array(result["quad_boxes"], dtype=np.float32)
|
||||
xyxyxyxy = xyxyxyxy.reshape(-1, 4, 2)
|
||||
xyxy = np.array([polygon_to_xyxy(polygon) for polygon in xyxyxyxy])
|
||||
|
||||
labels = np.array(result["labels"])
|
||||
return xyxy, labels, xyxyxyxy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user