diff --git a/PythonAPI/pycocotools/_mask.pyx b/PythonAPI/pycocotools/_mask.pyx index 8402c373645b4a7f540254f6a722aefcefb60e37..55e1b1c6cc9901b61b99ab20f05c024a4632afa7 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