From a0c9895faa50e250b8ddb58588c8631f3a3ef566 Mon Sep 17 00:00:00 2001 From: TY Lin Date: Tue, 27 Sep 2016 11:43:27 -0400 Subject: [PATCH] PythonAPI/_mask.pyx minor change to fix issues in a later Cython version --- PythonAPI/pycocotools/_mask.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonAPI/pycocotools/_mask.pyx b/PythonAPI/pycocotools/_mask.pyx index 8402c37..55e1b1c 100644 --- a/PythonAPI/pycocotools/_mask.pyx +++ b/PythonAPI/pycocotools/_mask.pyx @@ -119,7 +119,7 @@ def _frString(rleObjs): cdef bytes py_string cdef char* c_string for i, obj in enumerate(rleObjs): - py_string = str(obj['counts']) + py_string = str(obj['counts']).encode('utf8') c_string = py_string rleFrString( &Rs._R[i], c_string, obj['size'][0], obj['size'][1] ) return Rs @@ -255,7 +255,7 @@ def frPoly( poly, siz h, siz w ): Rs = RLEs(n) for i, p in enumerate(poly): np_poly = np.array(p, dtype=np.double, order='F') - rleFrPoly( &Rs._R[i], np_poly.data, len(np_poly)/2, h, w ) + rleFrPoly( &Rs._R[i], np_poly.data, int(len(p)/2), h, w ) objs = _toString(Rs) return objs -- GitLab