From 883d87bbfc3e94fa84cd63c0d658813d70b04ce0 Mon Sep 17 00:00:00 2001 From: Nikhil Sharma Date: Tue, 22 Jun 2021 12:12:42 +0530 Subject: [PATCH] fixed functions module leading to index errors --- tidecv/functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tidecv/functions.py b/tidecv/functions.py index cc0ccd89..fda998bb 100644 --- a/tidecv/functions.py +++ b/tidecv/functions.py @@ -84,12 +84,12 @@ def toRLE(mask:object, w:int, h:int): """ import pycocotools.mask as maskUtils - if type(mask) == list: + if type(mask) == list and len(mask) > 0: # polygon -- a single object might consist of multiple parts # we merge all parts into one mask rle code rles = maskUtils.frPyObjects(mask, h, w) return maskUtils.merge(rles) - elif type(mask['counts']) == list: + elif type(mask) == dict and type(mask['counts']) == list: # uncompressed RLE return maskUtils.frPyObjects(mask, h, w) else: