detections __getitem__: earlier check for empty detections
This commit is contained in:
1 parent
28fa054fdc
commit
a4dfcacbfd
1 file changed
+2
-2
@@ -1201,10 +1201,10 @@ class Detections:
|
||||
"""
|
||||
if isinstance(index, str):
|
||||
return self.data.get(index)
|
||||
if isinstance(index, int):
|
||||
index = [index]
|
||||
if self.is_empty():
|
||||
return Detections.empty()
|
||||
if isinstance(index, int):
|
||||
index = [index]
|
||||
return Detections(
|
||||
xyxy=self.xyxy[index],
|
||||
mask=self.mask[index] if self.mask is not None else None,
|
||||
|
||||
Reference in new issue
Block a user