Skip to content

Commit

Permalink
fixed sam post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
mese79 committed Nov 11, 2024
1 parent 945d1a9 commit 16c5e4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/featureforest/postprocess/postprocess_with_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ def get_sam_mask(
box=input_boxes[start:end],
multimask_output=True,
)
reduced_axis = (0, 1) if masks.ndim == 4 else 0
final_mask = np.bitwise_or(
final_mask,
np.bitwise_or.reduce(masks.astype(bool), axis=(0, 1))
np.bitwise_or.reduce(masks.astype(bool), axis=reduced_axis)
)

return final_mask
Expand Down

0 comments on commit 16c5e4e

Please sign in to comment.