Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/foundationals/segment_anything/test_hq_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ def test_predictor(
atol=4e-3,
)
assert (
torch.abs(reference_high_res_mask_hq - refiners_high_res_mask_hq).flatten().sum() <= 1
) # The diff on the logits above leads to an absolute diff of 1 pixel on the high res masks
torch.abs(reference_high_res_mask_hq - refiners_high_res_mask_hq).flatten().sum() <= 2
) # The diff on the logits above leads to an absolute diff of 2 pixel on the high res masks
assert torch.allclose(
iou_predictions_np,
torch.max(iou_predictions),
Expand Down
4 changes: 2 additions & 2 deletions tests/foundationals/segment_anything/test_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def test_predictor_single_output(
assert torch.allclose(
low_res_masks[0, 0, ...],
torch.as_tensor(facebook_low_res_masks[0], device=sam_h_single_output.device),
atol=6e-3, # see test_predictor_resized_single_output for more explanation
atol=5e-2, # see test_predictor_resized_single_output for more explanation
)
assert isclose(scores[0].item(), facebook_scores[0].item(), abs_tol=1e-05)

Expand Down Expand Up @@ -497,7 +497,7 @@ def test_mask_encoder(
dense_embeddings = sam_h.mask_encoder(mask_input)

assert facebook_mask_input.shape == mask_input.shape
assert torch.allclose(dense_embeddings, fb_dense_embeddings, atol=1e-4, rtol=1e-4)
assert torch.allclose(dense_embeddings, fb_dense_embeddings, atol=1e-3)


@no_grad()
Expand Down