From 9ebc7288173e593c8c2e3086ee065cf396de1c20 Mon Sep 17 00:00:00 2001 From: Carlos Paniagua Date: Wed, 20 Nov 2024 10:08:02 -0500 Subject: [PATCH] fix: use k=3 for kmeans seg for tiled workflow --- src/ice_masks.jl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ice_masks.jl b/src/ice_masks.jl index ffa65d59..1db1539e 100644 --- a/src/ice_masks.jl +++ b/src/ice_masks.jl @@ -145,12 +145,11 @@ function get_ice_masks( fc_landmasked = apply_landmask(falsecolor_image, .!landmask) - Threads.@threads for tile in tiles - # Conditionally update binarized_tiling as its not used in some workflows + # Threads.@threads + for tile in tiles @debug "Processing tile: $tile" - binarize && (binarized_tiling[tile...] .= imbinarize(morph_residue[tile...])) - - morph_residue_seglabels = kmeans_segmentation(Gray.(morph_residue[tile...] / 255)) + mrt = morph_residue[tile...] + morph_residue_seglabels = kmeans_segmentation(Gray.(mrt / 255), k=3) # TODO: handle case where get_nlabel returns missing floes_label = get_nlabel( @@ -163,9 +162,12 @@ function get_ice_masks( band_7_threshold_relaxed=band_7_threshold_relaxed, band_1_threshold_relaxed=band_1_threshold_relaxed, possible_ice_threshold=possible_ice_threshold, - ) + ) + + ice_mask[tile...] .= (morph_residue_seglabels .== floes_label) - ice_mask[tile...] .= (morph_residue_seglabels .== floes_label) + # Conditionally update binarized_tiling as its not used in some workflows + binarize && (binarized_tiling[tile...] .= imbinarize(mrt)) end return (icemask=ice_mask, bin=binarized_tiling .> 0)