def mask2poly(predicted_mask, threashold, x_scaler, y_scaler): polygons = extra_functions.mask2polygons_layer( predicted_mask[0] > threashold, epsilon=0, min_area=10) polygons = shapely.affinity.scale(polygons, xfact=1.0 / x_scaler, yfact=1.0 / y_scaler, origin=(0, 0, 0)) return shapely.wkt.dumps(polygons)
def mask2poly(predicted_mask, x_scaler, y_scaler): polygons = extra_functions.mask2polygons_layer(predicted_mask, epsilon=0, min_area=1000) polygons = MultiPolygon( [x for x in polygons if 270000 < x.area < 300000 or x.area < 90000]) polygons = shapely.affinity.scale(polygons, xfact=1.0 / x_scaler, yfact=1.0 / y_scaler, origin=(0, 0, 0)) return shapely.wkt.dumps(polygons)
def mask2poly(predicted_mask, x_scaler, y_scaler): if mask_channel == 7: min_area = 100 elif mask_channel == 6: min_area = 5000 else: min_area = 10 polygons = extra_functions.mask2polygons_layer(predicted_mask, epsilon=0, min_area=min_area) if image_id == '6100_0_2' and mask_channel == 1: polygons = polygons.buffer(0.5) polygons = shapely.affinity.scale(polygons, xfact=1.0 / x_scaler, yfact=1.0 / y_scaler, origin=(0, 0, 0)) return shapely.wkt.dumps(polygons)
def mask2poly(predicted_mask, threshold): polygons = extra_functions.mask2polygons_layer( predicted_mask[0] > threshold, epsilon=1, min_area=5.0) return polygons