diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index e4182c74..4d1190ac 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -64,7 +64,8 @@ def _isArrayLike(obj): - return hasattr(obj, '__iter__') and hasattr(obj, '__len__') + """Check if an object is array like (set, tuple, list, etc.).""" + return hasattr(obj, '__iter__') and hasattr(obj, '__len__') and not isinstance(obj, str) class COCO: @@ -438,4 +439,4 @@ def annToMask(self, ann): """ rle = self.annToRLE(ann) m = maskUtils.decode(rle) - return m \ No newline at end of file + return m