From ce8878e1903dc79ec29ba8d34df27fb3c51176f1 Mon Sep 17 00:00:00 2001 From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu> Date: Mon, 1 Feb 2021 14:42:54 +0100 Subject: [PATCH] Keep data type in array_replace. --- pysegcnn/core/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pysegcnn/core/utils.py b/pysegcnn/core/utils.py index d48c6d6..570aeef 100644 --- a/pysegcnn/core/utils.py +++ b/pysegcnn/core/utils.py @@ -2219,11 +2219,11 @@ def array_replace(array, lookup): """ # create an index array to replace the values in the lookup table - indices = np.arange(np.int(lookup[:, 0].max()) + 1).astype(object) + indices = np.arange(np.int(lookup[:, 0].max()) + 1) indices[lookup[:, 0].astype(np.int)] = lookup[:, 1] # the array with the replaced values - return indices[array] + return indices[array].astype(array.dtype) def dec2bin(number, nbits=8): -- GitLab