Skip to main content
. 2024 Jul 1;24(13):4272. doi: 10.3390/s24134272
Algorithm 1: VIFM
Input: image, Target detection results, Square size m
Output: m*m feature map matrix
highimage.shape0
widthimage.shape1
matrix0m×m
for (cls, x, y, w, h) ∈ results do:
  center_x ← x +w2
  center_yy +h2
  index_width ← int(center_xwidthm)
  index_high ← int(center_yhighm)
  if cls ≠’bus’ and cls ≠’car’ and cls ≠’trunck’
    continue
  end if
if index_width ≥ m or index_high ≥ m or index_width < 0 or index_high < 0
   continue
  end if
  matrix[index_width,index_high] ← matrix[index_width,index_high] + 1
  end for
return matrix