Algorithm 1. LNMS algorithm. |
Input: FDM - Predicted FDM of a given image I; Dmean - Pseudo-average size of plant in I. Output: The coordinates of the plant 1: Function Extract coordinates(FDM, Dmean): 2: Max_mask = max_pooling(FDM, kernel_size = (Dmean *0.3, Dmean *0.3)) 3: Max_mask = (Max_mask = FDM) 4: Max_all = Max_mask × FDM 5: adaptive threshold = max(Max_all)×0.3 6: if max(Max_all)<0.01 then 7: coordinates = None 8: else 9: Max_all[Max_all > adaptive threshold] = 1 10: Max_all[Max_all < 1] = 0 11: coordinates = nonzero(Max_all) 12: end if 13: return coordinates 14: end function |