diff --git a/src/main/java/ai/nets/samj/models/PythonMethods.java b/src/main/java/ai/nets/samj/models/PythonMethods.java index e5b31d7..3149de5 100644 --- a/src/main/java/ai/nets/samj/models/PythonMethods.java +++ b/src/main/java/ai/nets/samj/models/PythonMethods.java @@ -79,8 +79,8 @@ public class PythonMethods { + " #" + System.lineSeparator() + " return x_coords,y_coords" + System.lineSeparator() + "" + System.lineSeparator() - + "def get_polygons_from_binary_mask(sam_result, at_least_of_this_size = 3, only_biggest=False):" + System.lineSeparator() - + " labels = measure.regionprops( measure.label(sam_result,connectivity=1) )" + System.lineSeparator() + + "def get_polygons_from_binary_mask(sam_result, at_least_of_this_size = 6, only_biggest=False):" + System.lineSeparator() + + " labels = measure.regionprops( measure.label(sam_result > 0,connectivity=1) )" + System.lineSeparator() + " x_contours = []" + System.lineSeparator() + " y_contours = []" + System.lineSeparator() + " rles = []" + System.lineSeparator() @@ -88,7 +88,6 @@ public class PythonMethods { + " for obj in labels:" + System.lineSeparator() + " if obj.num_pixels >= at_least_of_this_size:" + System.lineSeparator() + " x_coords,y_coords = trace_contour(obj.image, obj.num_pixels, obj.bbox[1],obj.bbox[0])" + System.lineSeparator() - + " np.save('/home/carlos/git/test.npy', obj.image)" + System.lineSeparator() + " rles.append(encode_rle(obj.image))" + System.lineSeparator() + " x_contours.append(x_coords)" + System.lineSeparator() + " y_contours.append(y_coords)" + System.lineSeparator() @@ -141,7 +140,7 @@ public class PythonMethods { + " " + System.lineSeparator() + " # Only encode runs of 1s" + System.lineSeparator() + " if binary[start] == 1:" + System.lineSeparator() - + " rle.extend([start, length])" + System.lineSeparator() + + " rle.extend([int(start), int(length)])" + System.lineSeparator() + " " + System.lineSeparator() + " return rle" + System.lineSeparator() + "globals()['encode_rle'] = encode_rle" + System.lineSeparator();